Skip to content

Commit 02b1a92

Browse files
committed
Ensure installation section is not inserted for C usage section
1 parent 6549a54 commit 02b1a92

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/node_modules/@stdlib/_tools/scripts/publish_packages.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ var CHANGELOG = [
175175
].join( '\n' );
176176

177177
var EXISTING_REPOS = {};
178-
var RE_USAGE_SECTION = /(## CLI\n\n)?(<!-- CLI usage documentation. -->\n\n)?<section class="usage">/g;
178+
var RE_USAGE_SECTION = /(## CLI\n\n)?(<!-- CLI usage documentation. -->\n\n|<!-- C usage documentation. -->\n\n)?<section class="usage">/g;
179179
var BASIC_GITHUB_TOPICS = [
180180
'nodejs',
181181
'javascript',
@@ -343,12 +343,16 @@ function onTopics( error, data, info ) {
343343
* @private
344344
* @param {string} match - entire match
345345
* @param {string} p1 - first capture group
346+
* @param {string} p2 - second capture group
346347
* @returns {string} replacement
347348
*/
348-
function replacer( match, p1 ) {
349-
if ( p1 && endsWith( p1, '## CLI\n\n' ) ) {
349+
function replacer( match, p1, p2 ) {
350+
if ( p1 === '## CLI\n\n' ) {
350351
return p1 + CLI_INSTALLATION_SECTION+'\n<section class="usage">';
351352
}
353+
else if ( p2 === '<!-- C usage documentation. -->\n\n' ) {
354+
return p2 + '<section class="usage">';
355+
}
352356
return INSTALLATION_SECTION + '\n<section class="usage">';
353357
}
354358

0 commit comments

Comments
 (0)