File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 5
5
"author" : " elastic.io GmbH <info@elastic.io>" ,
6
6
"engine" : " node >=4.1.0" ,
7
7
"scripts" : {
8
+ "prepublish" : " ./prepublish.js" ,
8
9
"pretest" : " gulp jscs" ,
9
10
"test" : " gulp test"
10
11
},
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env node
2
+
3
+ var re = / ^ \d \d ? \. \d \d ? \. \d \d ? $ / ;
4
+ var version = require ( './package.json' ) . version ;
5
+ var versionIsPrerelease = ! re . test ( version ) ;
6
+ var npmTagIsLatest = process . env . npm_config_tag === 'latest' ;
7
+ var publishShouldBeRejected = npmTagIsLatest && versionIsPrerelease ;
8
+
9
+ if ( publishShouldBeRejected ) {
10
+ console . error ( 'It seems that version "%s" is pre-release. Rejecting publishing it to latest npm tag.' , version ) ;
11
+ console . error ( ' Did you mean this?' ) ;
12
+ console . error ( ' npm publish --tag=dev' ) ;
13
+ process . exit ( 1 ) ;
14
+ }
You can’t perform that action at this time.
0 commit comments