Update version format for usage with semver

Tracking the version under one `-prerelease` channel allows other packages to depend on `^0.1.0-prerelease` for the most up to date version.

Track the git sha for the release in package.json

Reuse the json package needed for writing the sha to retrieve the package.json version field
This commit is contained in:
Ray Schamp 2016-09-27 00:52:27 -04:00
parent 09dc67fa83
commit 59337ef8b5
2 changed files with 3 additions and 1 deletions

View File

@ -23,7 +23,7 @@ after_script:
# Authenticate NPM
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
# Set version to commit SHA
npm --no-git-tag-version version $(node -p -e "require('./package.json').version")-${TRAVIS_COMMIT:0:5}
npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s)
npm publish
# Publish to gh-pages as most recent committer
git config --global user.email $(git log --pretty=format:"%ce" -n1)

View File

@ -11,6 +11,7 @@
},
"main": "./dist.js",
"scripts": {
"version": "./node_modules/.bin/json -f package.json -I -e \"this.repository.sha = '$(git log -n1 --pretty=format:%H)'\"",
"prepublish": "make build",
"start": "make serve",
"test": "make test"
@ -24,6 +25,7 @@
"babel-preset-es2015": "6.9.0",
"eslint": "2.7.0",
"gh-pages": "0.11.0",
"json": "9.0.4",
"json-loader": "0.5.4",
"lodash.defaultsdeep": "4.6.0",
"raw-loader": "0.5.1",