@@ -42,45 +42,49 @@ export async function publishInCI(
42
42
npmTag : string ,
43
43
dryRun : boolean
44
44
) {
45
- const taskArray = await Promise . all (
46
- updatedPkgs . map ( async pkg => {
47
- const path = await mapPkgNameToPkgPath ( pkg ) ;
48
-
49
- /**
50
- * Can't require here because we have a cached version of the required JSON
51
- * in memory and it doesn't contain the updates
52
- */
53
- const { version, private : isPrivate } = JSON . parse (
54
- await readFile ( `${ path } /package.json` , 'utf8' )
55
- ) ;
56
-
57
- /**
58
- * Skip private packages
59
- */
60
- if ( isPrivate ) {
61
- return {
62
- title : `Skipping private package: ${ pkg } .` ,
63
- task : ( ) => { }
64
- } ;
65
- }
45
+ const taskArray = [ ] ;
46
+ for ( const pkg of updatedPkgs ) {
47
+ const path = await mapPkgNameToPkgPath ( pkg ) ;
48
+
49
+ /**
50
+ * Can't require here because we have a cached version of the required JSON
51
+ * in memory and it doesn't contain the updates
52
+ */
53
+ const { version, private : isPrivate } = JSON . parse (
54
+ await readFile ( `${ path } /package.json` , 'utf8' )
55
+ ) ;
66
56
67
- /**
68
- * Skip if this version has already been published.
69
- */
70
- const { stdout : npmVersion } = await exec ( 'npm info firebase version' ) ;
57
+ /**
58
+ * Skip private packages
59
+ */
60
+ if ( isPrivate ) {
61
+ console . log ( `Skipping private package: ${ pkg } .` ) ;
62
+ continue ;
63
+ }
64
+
65
+ /**
66
+ * Skip if this version has already been published.
67
+ */
68
+ try {
69
+ const { stdout : npmVersion } = await exec ( `npm info ${ pkg } version` ) ;
71
70
if ( version === npmVersion . trim ( ) ) {
72
- return {
73
- title : `Skipping publish of ${ pkg } - version ${ version } is already published` ,
74
- task : ( ) => { }
75
- } ;
71
+ console . log (
72
+ `Skipping publish of ${ pkg } - version ${ version } is already published`
73
+ ) ;
74
+ continue ;
76
75
}
76
+ } catch ( e ) {
77
+ // 404 from NPM indicates the package doesn't exist there.
78
+ console . log ( `Skipping pkg: ${ pkg } - it has never been published to NPM.` ) ;
79
+ continue ;
80
+ }
81
+
82
+ taskArray . push ( {
83
+ title : `📦 ${ pkg } @${ version } ` ,
84
+ task : ( ) => publishPackageInCI ( pkg , npmTag , dryRun )
85
+ } ) ;
86
+ }
77
87
78
- return {
79
- title : `📦 ${ pkg } @${ version } ` ,
80
- task : ( ) => publishPackageInCI ( pkg , npmTag , dryRun )
81
- } ;
82
- } )
83
- ) ;
84
88
const tasks = new Listr ( taskArray , {
85
89
concurrent : false ,
86
90
exitOnError : false
0 commit comments