Skip to content

Commit 27ac499

Browse files
committed
the release script
1 parent aaee8f7 commit 27ac499

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

Diff for: .npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
.travis.yml
66
coverage
77
demo
8+
release.sh
89
test

Diff for: package.json

-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
"node": ">=0.12"
88
},
99
"scripts": {
10-
"build": "babel lib --out-dir lib && babel preset.js --out-file preset.js",
11-
"cleanup": "git reset --hard",
12-
"prepublish": "in-publish && npm run -s build || in-install",
13-
"publish": "in-publish && npm run -s cleanup || in-install",
1410
"test": "npm run test:babel",
1511
"test:babel": "NODE_PATH=$(pwd)/test/tokens/node_modules $npm_package_scripts_test_unit --compilers js:babel-register",
1612
"test:coverage": "NODE_PATH=$(pwd)/test/tokens/node_modules babel-node --presets es2015 `npm bin`/isparta cover --report text --report html `npm bin`/_mocha -- --require test/setup.js --ui tdd test/*/*.js",
@@ -42,7 +38,6 @@
4238
"generic-names": "^1.0.1",
4339
"glob-to-regexp": "^0.1.0",
4440
"icss-replace-symbols": "^1.0.2",
45-
"in-publish": "^2.0.0",
4641
"lodash": "^4.3.0",
4742
"postcss": "^5.0.19",
4843
"postcss-modules-extract-imports": "^1.0.0",

Diff for: release.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
3+
if [ `git status -s|wc -l` -gt '0' ]; then
4+
echo 'commit changes first'
5+
exit 1
6+
fi
7+
8+
case "$1" in
9+
major|x..)
10+
versionType=major;;
11+
12+
minor|.x.)
13+
versionType=minor;;
14+
15+
patch|..x)
16+
versionType=patch;;
17+
18+
*)
19+
echo 'choose the version to deploy'
20+
echo 'deploy major|minor|patch|x..|.x.|..x'
21+
exit;;
22+
esac
23+
24+
# test the code
25+
npm run test:node || exit 1
26+
# update package version
27+
npm --no-git-tag-version version "$versionType"
28+
git add package.json
29+
version=`sed -n '/version/p' package.json|cut -d'"' -f4`
30+
git commit -m "version $version"
31+
git tag "$version"
32+
33+
cli=node_modules/.bin
34+
${cli}/babel lib --out-dir lib || exit 1
35+
${cli}/babel preset.js --out-file preset.js || exit 1
36+
npm publish
37+
git reset HEAD --hard

0 commit comments

Comments
 (0)