diff --git a/package.json b/package.json index 6b51f11..5da7a2c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,9 @@ "build": "npm run clean && babel ./src -d lib", "test": "npm run test:unit && npm run test:wdio", "test:unit": "npm run clean && mocha --compilers js:babel-register test/unit/**/*.test.js", - "test:wdio": "npm run clean && wdio ./test/wdio/wdio.config.js" + "test:wdio": "npm run clean && wdio ./test/wdio/wdio.config.js", + "prepublish": "npm run build", + "release": "np" }, "repository": { "type": "git", @@ -50,6 +52,7 @@ "babel-register": "^6.9.0", "chai": "^3.5.0", "mocha": "^2.4.5", + "np": "^2.10.0", "phantomjs": "^1.9.20", "rimraf": "^2.5.2", "sinon": "^1.17.4", diff --git a/scripts/build.js b/scripts/build.js deleted file mode 100644 index 9041e47..0000000 --- a/scripts/build.js +++ /dev/null @@ -1,8 +0,0 @@ -var execSync = require('child_process').execSync; - -function exec(command) { - execSync(command, { stdio: [0, 1, 2] }); -} - -exec('npm run test'); -exec('npm run build'); diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100644 index ac57a90..0000000 --- a/scripts/release.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -e -set -e - -export RELEASE=1 - -if ! [ -e scripts/release.sh ]; then - echo >&2 "Please run scripts/release.sh from the repo root" - exit 1 -fi - -update_version() { - echo "$(node -p "p=require('./${1}');p.version='${2}';JSON.stringify(p,null,2)")" > $1 - echo "Updated ${1} version to ${2}" -} - -validate_semver() { - if ! [[ $1 =~ ^[0-9]\.[0-9]+\.[0-9](-.+)? ]]; then - echo >&2 "Version $1 is not valid! It must be a valid semver string like 1.0.2 or 2.3.0-beta.1" - exit 1 - fi -} - -current_version=$(node -p "require('./package').version") - -printf "Next version (current is $current_version)? " -read next_version - -validate_semver $next_version - -next_ref="v$next_version" - -node scripts/build.js - -update_version 'package.json' $next_version - -git commit -am "Version $next_version" - -# push first to make sure we're up-to-date -git push origin master - -git tag $next_ref - -git push origin $next_ref - - -npm publish