@@ -13,7 +13,9 @@ const packages = fs.readdirSync(PACKAGES_DIR).filter(item => {
1313 return fs . statSync ( itemPath ) . isDirectory ( ) && ! item . startsWith ( '.' ) ;
1414} ) ;
1515
16- console . log ( `Found ${ packages . length } packages to process` ) ;
16+ // console.debug(`Found ${packages.length} packages to process`);
17+
18+ const NPM_VERSION_TAG = ( process . env . NPM_VERSION_TAG || 'latest' ) . replace ( / ^ v / , '' ) ;
1719
1820// Process all packages
1921const results = packages
@@ -22,11 +24,11 @@ const results = packages
2224 const pkg = JSON . parse ( fs . readFileSync ( json , 'utf8' ) ) ;
2325
2426 if ( pkg . private === true ) {
25- console . log ( `Skipping package: ${ pkg . name } ` ) ;
27+ // console.debug (`Skipping package: ${pkg.name}`);
2628 return null ;
2729 }
2830
29- console . log ( `\nProcessing package: ${ pkg . name } ` ) ;
31+ // console.debug (`\nProcessing package: ${pkg.name}`);
3032 process . chdir ( path . join ( PACKAGES_DIR , dir ) ) ;
3133
3234 // Run npm publish dry-run
@@ -40,34 +42,36 @@ const results = packages
4042 / n p m n o t i c e i n t e g r i t y : \s + ( s h a \d + - [ A - Z a - z 0 - 9 + / = ] + (?: \[ \. \. \. \] [ A - Z a - z 0 - 9 + / = ] * = = ? ) ? ) /
4143 ) ;
4244
43- console . log ( ` Package: ${ pkg . name } ` ) ;
44- console . log ( ` Tarball hash: ${ integrity } ` ) ;
45- console . log ( ` Shasum: ${ shasum } ` ) ;
45+ // console.debug (` Package: ${pkg.name}`);
46+ // console.debug (` Tarball hash: ${integrity}`);
47+ // console.debug (` Shasum: ${shasum}`);
4648
47- // Check latest published version on npm registry
48- const registryCheck = spawnSync ( 'curl' , [ `https://registry.npmjs.org/ ${ pkg . name } /latest` ] , {
49+ const registryUrl = `https:// registry.npmjs.org/ ${ pkg . name } / ${ NPM_VERSION_TAG } ` ;
50+ const registryCheck = spawnSync ( 'curl' , [ registryUrl ] , {
4951 encoding : 'utf8' ,
5052 } ) ;
5153 const registryData = JSON . parse ( registryCheck . stdout ) ;
5254 const registryShasum = registryData . dist ?. shasum ;
5355
54- const status = registryShasum === shasum ? 'matches' : `DIFFERS` ;
55- console . log ( ` ${ status } ` ) ;
56-
5756 return {
5857 name : pkg . name ,
5958 tarballHash : integrity ,
6059 shasum,
60+ differs : registryShasum === shasum ,
6161 } ;
6262 } )
63- . filter ( Boolean ) as PackageInfo [ ] ;
63+ . filter ( Boolean ) as ( PackageInfo & { differs : boolean } ) [ ] ;
6464
6565// Restore original directory
6666process . chdir ( ORIGINAL_DIR ) ;
6767
6868// Output final results
69- console . log ( '\n=== PACKAGE BUILD RESULTS ===' ) ;
70- console . table ( results ) ;
69+ // console.debug('\n=== PACKAGE BUILD RESULTS ===');
70+ // console.debug(results);
71+
72+ // Output JSON array of differing packages
73+ const differingPackages = results . filter ( r => r . differs ) . map ( r => r . name ) ;
74+ console . log ( JSON . stringify ( differingPackages ) ) ;
7175
7276// HELPERS
7377function extractFromOutput ( output : string , regex : RegExp ) : string {
0 commit comments