File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 34
34
"watch" : " babel resources/watch.js | node" ,
35
35
"cover" : " babel-node node_modules/.bin/isparta cover --root src --report html node_modules/.bin/_mocha -- $npm_package_options_mocha" ,
36
36
"cover:lcov" : " babel-node node_modules/.bin/isparta cover --root src --report lcovonly node_modules/.bin/_mocha -- $npm_package_options_mocha" ,
37
- "preversion" : " npm test" ,
37
+ "preversion" : " . ./resources/checkgit.sh && npm test" ,
38
38
"prepublish" : " . ./resources/prepublish.sh"
39
39
},
40
40
"dependencies" : {
Original file line number Diff line number Diff line change
1
+ #
2
+ # This script determines if current git state is the up to date master. If so
3
+ # it exits normally. If not it prompts for an explicit continue. This script
4
+ # intends to protect from versioning for NPM without first pushing changes
5
+ # and including any changes on master.
6
+ #
7
+
8
+ # First fetch to ensure git is up to date. Fail-fast if this fails.
9
+ git fetch;
10
+ if [[ $? -ne 0 ]]; then exit 1; fi ;
11
+
12
+ # Extract useful information.
13
+ GITBRANCH=$( git branch -v 2> /dev/null | sed ' /^[^*]/d' ) ;
14
+ GITBRANCHNAME=$( echo " $GITBRANCH " | sed ' s/* \([A-Za-z0-9_\-]*\).*/\1/' ) ;
15
+ GITBRANCHSYNC=$( echo " $GITBRANCH " | sed ' s/* [^[]*.\([^]]*\).*/\1/' ) ;
16
+
17
+ # Check if master is checked out
18
+ if [ " $GITBRANCHNAME " != " master" ]; then
19
+ read -p " Git not on master but $GITBRANCHNAME . Continue? (y|N) " yn;
20
+ if [ " $yn " != " y" ]; then exit 1; fi ;
21
+ fi ;
22
+
23
+ # Check if branch is synced with remote
24
+ if [ " $GITBRANCHSYNC " != " " ]; then
25
+ read -p " Git not up to date but $GITBRANCHSYNC . Continue? (y|N) " yn;
26
+ if [ " $yn " != " y" ]; then exit 1; fi ;
27
+ fi ;
You can’t perform that action at this time.
0 commit comments