Skip to content

Commit

Permalink
fix(release): re-read package.json in case it changed
Browse files Browse the repository at this point in the history
  • Loading branch information
varl committed Jun 30, 2021
1 parent 57d88bd commit 4132ddc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@semantic-release/release-notes-generator": "^9.0.1",
"dhis2-uid": "^0.1.2",
"ejs": "^3.0.1",
"fs-extra": "^10.0.0",
"inquirer": "^7.1.0",
"jsondiffpatch": "^0.4.1",
"semantic-release": "^16.0.4",
Expand Down
6 changes: 3 additions & 3 deletions packages/utils/src/support/semantic-release-app-hub.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs')
const path = require('path')
const { publishCommand } = require('@dhis2/cli-app-scripts')
const SemanticReleaseError = require('@semantic-release/error')
const fs = require('fs-extra')
const semver = require('semver')

const { handler: publishAppHub } = publishCommand
Expand All @@ -10,7 +10,7 @@ exports.verifyConditions = (config, context) => {
const { pkgRoot } = config
const { env } = context

const packagePath = path.join(pkgRoot, 'package.json')
const packagePath = fs.readJsonSync(pkgRoot, 'package.json')
const configPath = path.join(pkgRoot, 'd2.config.js')

if (!fs.existsSync(configPath)) {
Expand Down Expand Up @@ -72,7 +72,7 @@ exports.publish = async (config, context) => {
const { env, nextRelease } = context

const packagePath = path.join(pkgRoot, 'package.json')
const pkg = require(packagePath)
const pkg = fs.readJsonSync(packagePath)

if (semver.lt(pkg.version, nextRelease.version)) {
throw new SemanticReleaseError(
Expand Down
9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10687,6 +10687,15 @@ [email protected], fs-extra@^7.0.0:
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1"
integrity sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==
dependencies:
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^2.0.0"

fs-extra@^8.0.0, fs-extra@^8.0.1, fs-extra@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
Expand Down

0 comments on commit 4132ddc

Please sign in to comment.