Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions lib/node_modules/@stdlib/_tools/scripts/publish_packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var topics = setTopics.factory({

var CURRENT_YEAR = currentYear();

var INSTALLATION_SECTION_BASIC = [
var INSTALL_SEC_BASIC = [
'<section class="installation">',
'',
'## Installation',
Expand All @@ -94,7 +94,7 @@ var INSTALLATION_SECTION_BASIC = [
'</section>',
''
].join( '\n' );
var INSTALLATION_SECTION_BUNDLES = [
var INSTALL_SEC_BUNDLES = [
'<section class="installation">',
'',
'## Installation',
Expand All @@ -116,11 +116,11 @@ var INSTALLATION_SECTION_BUNDLES = [
'</section>',
''
].join( '\n' );
var INSTALLATION_SECTION_BUNDLES_CLI = [
var INSTALL_SEC_BUNDLES_CLI = [
'- To use as a general utility for the command line, install the corresponding [CLI package][cli-section] globally.',
''
].join( '\n' );
var CLI_INSTALLATION_SECTION = [
var CLI_INSTALL_SEC = [
'<section class="installation">',
'',
'## Installation',
Expand Down Expand Up @@ -339,8 +339,8 @@ var BASIC_GITHUB_TOPICS = [
'node-js'
];
var RE_ALLOWED_TOPIC_CHARS = /^[A-Z0-9-]+$/i;
var memoizedNPMversionForDeps = memoize( npmVersion );
var memoizedNPMversionForDevDeps = memoize( npmVersion );
var memoizedNPMverForDeps = memoize( npmVersion );
var memoizedNPMverForDevDeps = memoize( npmVersion );


// FUNCTIONS //
Expand Down Expand Up @@ -404,7 +404,7 @@ function populateDeps( pkgJSON, deps, devDeps, mainJSON, useGitHub ) {
if ( useGitHub ) {
out.dependencies[ dep ] = 'github:stdlib-js/' + replace( dep, '@stdlib/', '' ) + '#main';
} else {
out.dependencies[ dep ] = memoizedNPMversionForDeps( dep );
out.dependencies[ dep ] = memoizedNPMverForDeps( dep );
}
}
} else {
Expand All @@ -426,7 +426,8 @@ function populateDeps( pkgJSON, deps, devDeps, mainJSON, useGitHub ) {
if ( useGitHub ) {
out.devDependencies[ dep ] = 'github:stdlib-js/' + replace( dep, '@stdlib/', '' ) + '#main';
} else {
out.devDependencies[ dep ] = memoizedNPMversionForDevDeps( dep );
out.devDependencies[ dep ] =
memoizedNPMverForDevDeps( dep );
}
}
} else {
Expand Down Expand Up @@ -840,7 +841,8 @@ function publish( pkg, clbk ) {
if ( contains( readme, '<section class="links">' ) ) {
readme = replace( readme, '<section class="links">', mainRepoSection( customLicense, branch, !noBundles, extractCLI ) );
} else {
readme += mainRepoSection( customLicense, branch, !noBundles, extractCLI );
readme +=
mainRepoSection( customLicense, branch, !noBundles, extractCLI );
readme += '\n\n';
readme += '</section>';
readme += '\n\n';
Expand Down Expand Up @@ -1014,7 +1016,7 @@ function publish( pkg, clbk ) {

// Ensure `npm install` does not automatically build a native add-on...
if ( pkgJSON.gypfile ) {
// TODO: consider removing this once we have determined our native add-on story for individual packages
// Note: consider removing this once we have determined our native add-on story for individual packages
pkgJSON.gypfile = false;
}
pkgJSON.version = version;
Expand Down Expand Up @@ -1075,7 +1077,7 @@ function publish( pkg, clbk ) {
// Replace `@stdlib/bench` with `@stdlib/bench-harness` in standalone packages:
command = 'find '+dist+' -type f -name \'*.js\' -print0 | xargs -0 sed -i "s/\'@stdlib\\/bench\'/\'@stdlib\\/bench-harness\'/g"';
shell( command );
pkgJSON.devDependencies[ '@stdlib/bench-harness' ] = memoizedNPMversionForDevDeps( '@stdlib/bench-harness' );
pkgJSON.devDependencies[ '@stdlib/bench-harness' ] = memoizedNPMverForDevDeps( '@stdlib/bench-harness' );
delete pkgJSON.devDependencies[ '@stdlib/bench' ];
}
}
Expand Down Expand Up @@ -1104,7 +1106,7 @@ function publish( pkg, clbk ) {

// Add `@stdlib/error-tools-fmtprodmsg` in package.json if the package depends on `@stdlib/string-format`:
if ( pkgJSON.dependencies[ '@stdlib/string-format' ] ) {
fmtProdMsgVersion = memoizedNPMversionForDeps( '@stdlib/error-tools-fmtprodmsg' );
fmtProdMsgVersion = memoizedNPMverForDeps( '@stdlib/error-tools-fmtprodmsg' );
pkgJSON.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = fmtProdMsgVersion;
deps.push( '@stdlib/error-tools-fmtprodmsg' );
}
Expand Down Expand Up @@ -1319,17 +1321,17 @@ function publish( pkg, clbk ) {

if ( isString( p1 ) ) {
if ( startsWith( p1, '## CLI' ) ) {
return p1 + CLI_INSTALLATION_SECTION + ( p2 || '\n<!-- CLI usage documentation. -->\n' ) + '\n<section class="usage">';
return p1 + CLI_INSTALL_SEC + ( p2 || '\n<!-- CLI usage documentation. -->\n' ) + '\n<section class="usage">';
}
if ( startsWith( p1, '<!-- C usage documentation. -->' ) ) {
return p1 + '<section class="usage">';
}
}
if ( noBundles ) {
out = INSTALLATION_SECTION_BASIC;
out = INSTALL_SEC_BASIC;
} else {
out = INSTALLATION_SECTION_BUNDLES;
out = out.replace( '<cli>', ( extractCLI ) ? INSTALLATION_SECTION_BUNDLES_CLI : '' );
out = INSTALL_SEC_BUNDLES;
out = out.replace( '<cli>', ( extractCLI ) ? INSTALL_SEC_BUNDLES_CLI : '' );
}
out += '\n<section class="usage">';
return out;
Expand Down