@build-script/poormans-package-change
v1.0.34
Published
- 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?
Downloads
50
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.isTTY
OR--json
is setchanged no.
orchanged yes.
if stdout isTTY AND--json
is not set- no output if
--bump
is set
The return code always 0 if no error. no matter changed or not.
What happens
- download newest
package.json
from npm, and cache it at${TMPDIR}/package-json-cache
- compare
version
field with local package.json- If they are not equal. Then I will do nothing and print "changed yes.".
- download published tarball from npm
- run
pnpm pack
locally, ornpm run prepack
+npm pack
if no pnpm. - compare files in created
.tgz
file and downloaded one. (by running some magicgit
commands)- if
--bump
is 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 -- pnpm publish --no-git-checks
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 pnpm publish if version is not same with npm
# maybe modified by above command
# maybe by hand
poormans-package-change run-if-version-mismatch --quiet -- pnpm publish --no-git-checks