File tree 4 files changed +28
-4
lines changed
4 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " cross-os" ,
3
- "version" : " 1.1.0 " ,
3
+ "version" : " 1.1.1 " ,
4
4
"description" : " Allow to add OS-specific scripts in your package.json!" ,
5
5
"main" : " source/index.js" ,
6
6
"bin" : " source/index.js" ,
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const pipeline = new Promise(resolve => {
18
18
let script = process . argv . pop ( ) ,
19
19
property = 'scripts' ;
20
20
21
- if ( config [ property ] && ! config [ property ] [ script ] ) {
21
+ if ( ! config [ property ] [ script ] || typeof config [ property ] [ script ] !== 'object' ) {
22
22
property = 'cross-os'
23
23
}
24
24
Original file line number Diff line number Diff line change 9
9
"third" : " echo 'it is working just fine'" ,
10
10
"fourth" : " node ../source/index.js first" ,
11
11
"sixth" : " node ../source/index.js first" ,
12
- "seventh" : " node ../source/index.js fifth"
12
+ "seventh" : " node ../source/index.js fifth" ,
13
+ "foo" : " node ../source/index.js foo"
13
14
},
14
15
"cross-os" : {
15
16
"fifth" : {
16
17
"win32" : " echo hello from cross-os win32" ,
17
18
"linux" : " echo hello from cross-os linux" ,
18
19
"darwin" : " echo hello from cross-os darwin"
19
20
},
20
- "sixth" : " echo i should not been seen"
21
+ "sixth" : " echo i should not been seen" ,
22
+ "foo" : {
23
+ "win32" : " echo bar from win32" ,
24
+ "linux" : " echo bar from linux" ,
25
+ "darwin" : " echo bar from darwin"
26
+ }
21
27
}
22
28
}
Original file line number Diff line number Diff line change @@ -108,4 +108,22 @@ describe('Loader', () => {
108
108
109
109
} )
110
110
111
+ it ( 'should not conflict with script containing the same name as its callee' , done => {
112
+
113
+ const child = exec ( 'npm run foo --silent' )
114
+
115
+ let output = '' ;
116
+
117
+ child . stdout . on ( 'data' , ( buffer : Buffer ) => {
118
+ output += buffer . toString ( 'utf-8' )
119
+ } )
120
+
121
+ child . on ( 'exit' , code => {
122
+ expect ( output . trim ( ) ) . to . match ( / b a r / )
123
+ expect ( code ) . to . be ( 0 )
124
+ done ( )
125
+ } )
126
+
127
+ } )
128
+
111
129
} )
You can’t perform that action at this time.
0 commit comments