punkave/tag-old-releases

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

tag-old-releases

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.

Usage
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
How it works

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:

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.

A better idea (going forward)

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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.