Skip to content

Commit

Permalink
build: supply package via environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Aug 11, 2023
1 parent 46a806e commit ce11027
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/node_modules/@stdlib/_tools/scripts/publish_packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -1100,9 +1100,14 @@ function publish( pkg, clbk ) {

// 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;
command = jscodeshift+' ./lib/**/*.js ./lib/*.js -t '+join( __dirname, 'transform_error_messages.js' );
debug( 'Executing command: %s', command );
shell( command, opts );
shell( command, {
'cwd': opts.cwd,
'env': {
'STDLIB_PKG': '@stdlib/'+dist
}
});

// 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
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
var logger = require( 'debug' );
var pkg2id = require( '@stdlib/error/tools/pkg2id' );
var msg2id = require( '@stdlib/error/tools/msg2id');
var ENV = require( '@stdlib/process/env' );


// VARIABLES //

var debug = logger( 'scripts:transform-error-messages' );
var pkg = '@stdlib/' + process.argv[ 2 ];
var pkg = ENV[ 'STDLIB_PKG' ];
var prefix = pkg2id( pkg );
var ERROR_NAMES = [
'Error',
Expand Down

0 comments on commit ce11027

Please sign in to comment.