Skip to content

Commit

Permalink
build: swap out packages after removal of unneeded ones
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Aug 11, 2023
1 parent ed29174 commit a0af010
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/node_modules/@stdlib/_tools/scripts/publish_packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -1094,20 +1094,14 @@ function publish( pkg, clbk ) {
console.log( 'Publishing '+dist+' to npm...' );
pkgJSON = populateDeps( pkgJSON, deps, devDeps, mainJSON, false );

// Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json:
if ( pkgJSON.dependencies[ '@stdlib/string-format' ] ) {
delete pkgJSON.dependencies[ '@stdlib/string-format' ];
}
fmtProdMsgVersion = npmVersion( '@stdlib/error-tools-fmtprodmsg' );
pkgJSON.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = fmtProdMsgVersion;

opts = {
'cwd': dist
};

// Transform error messages via jscodeshift:
jscodeshift = join( rootDir(), 'node_modules', '.bin', 'jscodeshift' );
command = jscodeshift+' ./lib/**/*.js ./lib/*.js -t '+join( __dirname, 'transform_error_messages.js' )+' '+distPkg;
shell( command, opts );

// Format rewritten error messages:
command = 'find . -name "*.js" -exec sed -E -i "s/Error\\( format\\( \\"([a-zA-Z0-9]+)\\"/Error\\( format\\( \'\\1\'/g" {} \\;';
Expand Down Expand Up @@ -1186,6 +1180,13 @@ function publish( pkg, clbk ) {
}
}

// Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json:
if ( pkgJSON.dependencies[ '@stdlib/string-format' ] ) {
delete pkgJSON.dependencies[ '@stdlib/string-format' ];
}
fmtProdMsgVersion = npmVersion( '@stdlib/error-tools-fmtprodmsg' );
pkgJSON.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = fmtProdMsgVersion;

// Replace LICENSE comments with abbreviated ones:
if ( hasCLI ) {
command = 'find '+dist+' -name "*.js" -type f';
Expand Down

0 comments on commit a0af010

Please sign in to comment.