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,6 +22,7 @@ const {
2222const { parseArgs} = require ( '@pkgjs/parseargs' ) ;
2323const chalk = require ( 'chalk' ) ;
2424const { execSync} = require ( 'child_process' ) ;
25+ const path = require ( 'path' ) ;
2526
2627const config = {
2728 options : {
@@ -86,26 +87,28 @@ async function initNewProjectFromSource(
8687 console . log ( '\nDone ✅' ) ;
8788
8889 console . log ( 'Publishing packages to local npm proxy\n' ) ;
89- forEachPackage (
90- ( packageAbsolutePath , packageRelativePathFromRoot , packageManifest ) => {
91- if ( packageManifest . private ) {
92- return ;
93- }
94-
95- const desc = `${ packageManifest . name } (${ packageRelativePathFromRoot } )` ;
96- process . stdout . write (
97- `${ desc } ${ chalk . dim ( '.' ) . repeat ( Math . max ( 0 , 72 - desc . length ) ) } ` ,
98- ) ;
99- execSync (
100- `npm publish --registry ${ VERDACCIO_SERVER_URL } --access public` ,
101- {
102- cwd : packageAbsolutePath ,
103- stdio : verbose ? 'inherit' : [ process . stderr ] ,
104- } ,
105- ) ;
106- process . stdout . write ( chalk . reset . inverse . bold . green ( ' DONE ' ) + '\n' ) ;
107- } ,
108- ) ;
90+ const packages = await getPackages ( {
91+ includeReactNative : false ,
92+ includePrivate : false ,
93+ } ) ;
94+
95+ for ( const { path : packagePath , packageJson} of Object . values ( packages ) ) {
96+ const desc = `${ packageJson . name } (${ path . relative (
97+ REPO_ROOT ,
98+ packagePath ,
99+ ) } )`;
100+ process . stdout . write (
101+ `${ desc } ${ chalk . dim ( '.' ) . repeat ( Math . max ( 0 , 72 - desc . length ) ) } ` ,
102+ ) ;
103+ execSync (
104+ `npm publish --registry ${ VERDACCIO_SERVER_URL } --access public` ,
105+ {
106+ cwd : packagePath ,
107+ stdio : verbose ? 'inherit' : [ process . stderr ] ,
108+ } ,
109+ ) ;
110+ process . stdout . write ( chalk . reset . inverse . bold . green ( ' DONE ' ) + '\n' ) ;
111+ }
109112 console . log ( '\nDone ✅' ) ;
110113
111114 console . log ( 'Running react-native init without install' ) ;
0 commit comments