1313
1414const { retry} = require ( '../circleci/retry' ) ;
1515const { REPO_ROOT } = require ( '../consts' ) ;
16- const forEachPackage = require ( '../monorepo/for-each-package ' ) ;
16+ const { getPackages } = require ( '../utils/monorepo ' ) ;
1717const {
1818 VERDACCIO_SERVER_URL ,
1919 VERDACCIO_STORAGE_PATH ,
@@ -22,7 +22,6 @@ const {
2222const { parseArgs} = require ( '@pkgjs/parseargs' ) ;
2323const chalk = require ( 'chalk' ) ;
2424const { execSync} = require ( 'child_process' ) ;
25- const { promises : fs } = require ( 'fs' ) ;
2625const path = require ( 'path' ) ;
2726
2827const config = {
@@ -92,26 +91,28 @@ async function initNewProjectFromSource(
9291 console . log ( '\nDone ✅' ) ;
9392
9493 console . log ( 'Publishing packages to local npm proxy\n' ) ;
95- forEachPackage (
96- ( packageAbsolutePath , packageRelativePathFromRoot , packageManifest ) => {
97- if ( packageManifest . private ) {
98- return ;
99- }
100-
101- const desc = `${ packageManifest . name } (${ packageRelativePathFromRoot } )` ;
102- process . stdout . write (
103- `${ desc } ${ chalk . dim ( '.' ) . repeat ( Math . max ( 0 , 72 - desc . length ) ) } ` ,
104- ) ;
105- execSync (
106- `npm publish --registry ${ VERDACCIO_SERVER_URL } --access public` ,
107- {
108- cwd : packageAbsolutePath ,
109- stdio : verbose ? 'inherit' : [ process . stderr ] ,
110- } ,
111- ) ;
112- process . stdout . write ( chalk . reset . inverse . bold . green ( ' DONE ' ) + '\n' ) ;
113- } ,
114- ) ;
94+ const packages = await getPackages ( {
95+ includeReactNative : false ,
96+ includePrivate : false ,
97+ } ) ;
98+
99+ for ( const { path : packagePath , packageJson} of Object . values ( packages ) ) {
100+ const desc = `${ packageJson . name } (${ path . relative (
101+ REPO_ROOT ,
102+ packagePath ,
103+ ) } )`;
104+ process . stdout . write (
105+ `${ desc } ${ chalk . dim ( '.' ) . repeat ( Math . max ( 0 , 72 - desc . length ) ) } ` ,
106+ ) ;
107+ execSync (
108+ `npm publish --registry ${ VERDACCIO_SERVER_URL } --access public` ,
109+ {
110+ cwd : packagePath ,
111+ stdio : verbose ? 'inherit' : [ process . stderr ] ,
112+ } ,
113+ ) ;
114+ process . stdout . write ( chalk . reset . inverse . bold . green ( ' DONE ' ) + '\n' ) ;
115+ }
115116 console . log ( '\nDone ✅' ) ;
116117
117118 console . log ( 'Running react-native init without install' ) ;
0 commit comments