Name: tag-old-releases
Owner: P'unk Avenue
Description: Retroactively tag old npm releases in git. Obviously subjective, use at your own risk.
Created: 2018-03-05 14:20:19.0
Updated: 2018-03-05 14:20:28.0
Pushed: 2018-03-05 14:20:27.0
Homepage: null
Size: 3
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Did you forget to tag all your npm releases in git? Yeah me too. This utility tags them retroactively.
Obviously, that's a subjective thing. So use this at your own risk.
install -g tag-old-releases
rc/my-repo
old-releases
To print git tag
commands without actually running them:
install -g tag-old-releases
rc/my-repo
old-releases --dry-run
tag-old-releases
scans through git log
of the master
branch, checking out each commit as it goes backwards through time. The oldest release in which package.json
has a given version
is tagged as the release for this version, unless a tag already exists. Tags are named simply x.y.z
(version number).
The rationale is that your release process looks like this:
master
npm publish
If your process differs ? for instance if well-meaning contributors bump the version number early and then other critical commits are made before npm publish
- then this script will make the wrong choice for those versions. Sorry - best we can do.
In future, we suggest a script like this in place of npm publish
:
sr/bin/env node
exec = require('child_process').execSync;
version = require(process.cwd() + '/package.json').version;
('git tag ' + version + ' && git push --tags && npm publish');
This will keep you out of trouble by tagging releases at the time you publish.