-
-
Save asyncanup/efdc57d85ee233df5579 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env coffee | |
fs = require 'fs' | |
sh = require 'execSync' | |
config = require './package.json' | |
name = config.name = "#{config.name}-semver" | |
version = config.version = config.version.replace(/\./g, '') + '.0.0' | |
fs.renameSync 'package.json', 'package.json.real' | |
fs.writeFileSync 'package.json', JSON.stringify config, null, 2 | |
sh.run 'npm publish .' | |
sh.run "npm tag #{name}@#{version} stable" | |
fs.unlinkSync 'package.json' | |
fs.renameSync 'package.json.real', 'package.json' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moved
fs
actions closer together so you don't have corrupted state in case the script fails.TODO:
config.version.replace
is unsafe without a try/catch (what ifconfig.version
isundefined
)