README
poormans-package-change
- Do you manage more than 10 package at same time?
- Did you forgot/lazy to tag previous version with git?
- Did you remember which package changed since last publish?
- Should you increase version and publish it again?
Run this now! It's FREE! Pickup your phone (BEEEEEP)
Usage
poormans-package-change <command> [--args]
command: detect-package-change
Usage: poormans-package-change detect-package-change --registry ??? --dist-tag ??? --package ??? --bump --json --quiet
registry: default to use system .npmrc
dist-tag: default to "latest"
package: this folder contains package.json (default to ./)
bump: increase patch version in package.json if change detected
json: print json output even if stdout is tty
quiet: disable verbose debug output to stderr
Require git available on PATH.
Output:
{ changedFiles: [......], changed: true }if!process.stdout.isTTYOR--jsonis setchanged no.orchanged yes.if stdout isTTY AND--jsonis not set- no output if
--bumpis set
The return code always 0 if no error. no matter changed or not.
What happens
- download newest
package.jsonfrom npm, and cache it at${TMPDIR}/package-json-cache - compare
versionfield with local package.json- If they are not equal. Then I will do nothing and print "changed yes.".
- download published tarball from npm
- run
yarn packlocally, ornpm run prepack+npm packif no yarn. - compare files in created
.tgzfile and downloaded one. (by running some magicgitcommands)- if
--bumpis set, increase patch version inpackage.json - if any file do not equal, print "changed yes.".
- if everything exact same, print "changed no."
- if
command: run-if-version-mismatch
Usage: poormans-package-change run-if-version-mismatch [--quiet] -- <command to run>
Eg: poormans-package-change run-if-version-mismatch -- yarn publish
Run a command, if local version in package.json is NOT same with npm registry.
The -- is required.
Example
# update package.json if something changed
poormans-package-change detect-package-change --bump --quiet
# run yarn publish if version is not same with npm
# maybe modified by above command
# maybe by hand
poormans-package-change run-if-version-mismatch --quiet -- yarn publish