@@ -2,37 +2,33 @@ const fs = require('fs')
22const path = require ( 'path' )
33const packagePath = path . join ( __dirname , '../' , 'packages' )
44const spawn = require ( 'child_process' ) . spawn
5-
6- const packages = fs . readdirSync ( packagePath , 'utf8' )
7- . filter ( file => fs . statSync ( path . join ( packagePath , file ) ) . isDirectory ( ) )
85
9- const runPublish = ( folderName ) => new Promise ( ( resolve , reject ) => {
10- const process = spawn (
11- 'npm' ,
12- [ 'publish' ] ,
13- {
6+ const packages = fs
7+ . readdirSync ( packagePath , 'utf8' )
8+ . filter ( file => fs . statSync ( path . join ( packagePath , file ) ) . isDirectory ( ) )
9+
10+ const runPublish = folderName =>
11+ new Promise ( ( resolve , reject ) => {
12+ const process = spawn ( 'npm' , [ 'publish' ] , {
1413 stdio : 'inherit' ,
15- cwd : path . join ( packagePath , folderName )
16- }
17- )
14+ cwd : path . join ( packagePath , folderName ) ,
15+ } )
1816
19- process . on ( 'exit' , ( code ) => {
20- if ( code !== 0 ) {
21- process . exit ( 1 )
22- reject ( code )
23- }
24- resolve ( code )
17+ process . on ( 'exit' , code => {
18+ if ( code !== 0 ) {
19+ reject ( code )
20+ }
21+ resolve ( code )
22+ } )
2523 } )
26- } )
2724
28- const publishPackages = ( packageFolders ) => {
25+ const publishPackages = packageFolders => {
2926 const folderName = packageFolders . slice ( - 1 ) [ 0 ]
3027 if ( folderName != null ) {
31- return runPublish ( folderName )
32- . then ( ( ) => {
28+ return runPublish ( folderName ) . then ( ( ) => {
3329 console . log ( `\nPUBLISHED: ${ folderName } ` )
34- publishPackages ( packageFolders . slice ( 0 , - 1 )
35- ) } )
30+ publishPackages ( packageFolders . slice ( 0 , - 1 ) )
31+ } )
3632 } else {
3733 console . log ( 'published' )
3834 }
0 commit comments