-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: properly apply file changes and version update
- Loading branch information
1 parent
bbea5f9
commit fa0b173
Showing
8 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const log = require('proc-log') | ||
const PackageJson = require('@npmcli/package-json') | ||
|
||
const run = async ({ config: c }) => { | ||
const { | ||
moduleDir: dir, | ||
__CONFIG_KEY__: key, | ||
__VERSION__: version, | ||
} = c | ||
|
||
log.verbose('apply-version', dir) | ||
|
||
const pkg = await PackageJson.load(dir) | ||
if (!pkg.content[key]) { | ||
pkg.content[key] = { version } | ||
} else { | ||
pkg.content[key].version = version | ||
} | ||
await pkg.save() | ||
} | ||
|
||
module.exports = { | ||
run, | ||
when: ({ config: c }) => c.needsUpdate && !c.isDogFood, | ||
name: 'apply-version', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters