Skip to content

Commit 24107e6

Browse files
committed
build: skip dependencies removal for top-level packages
1 parent 9d330f2 commit 24107e6

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,21 +1232,23 @@ function publish( pkg, clbk ) {
12321232
shell( command, opts );
12331233
}
12341234

1235-
// For all dependencies, check in *.js files if they are used in what will be published to npm; if not, remove them:
1236-
for ( dep in pkgJSON.dependencies ) {
1237-
if ( hasOwnProp( pkgJSON.dependencies, dep ) ) {
1238-
escaped = replace( dep, '@', '\\@' );
1239-
escaped = replace( escaped, '/', '\\/' );
1240-
command = [
1241-
'if ! find lib -name "*.js" -exec grep -q "'+escaped+'" {} + && ! grep -q -s "'+escaped+'" manifest.json && ! grep -q -s "'+escaped+'" include.gypi; then',
1242-
' printf "false"',
1243-
'else',
1244-
' printf "true"',
1245-
'fi'
1246-
].join( '\n' );
1247-
found = shell( command, opts ).toString();
1248-
if ( found === 'false' && dep !== '@stdlib/error-tools-fmtprodmsg' ) {
1249-
delete pkgJSON.dependencies[ dep ];
1235+
if ( !isTopLevelNS ) {
1236+
// For all dependencies, check in *.js files if they are used in what will be published to npm; if not, remove them:
1237+
for ( dep in pkgJSON.dependencies ) {
1238+
if ( hasOwnProp( pkgJSON.dependencies, dep ) ) {
1239+
escaped = replace( dep, '@', '\\@' );
1240+
escaped = replace( escaped, '/', '\\/' );
1241+
command = [
1242+
'if ! find lib -name "*.js" -exec grep -q "'+escaped+'" {} + && ! grep -q -s "'+escaped+'" manifest.json && ! grep -q -s "'+escaped+'" include.gypi; then',
1243+
' printf "false"',
1244+
'else',
1245+
' printf "true"',
1246+
'fi'
1247+
].join( '\n' );
1248+
found = shell( command, opts ).toString();
1249+
if ( found === 'false' && dep !== '@stdlib/error-tools-fmtprodmsg' ) {
1250+
delete pkgJSON.dependencies[ dep ];
1251+
}
12501252
}
12511253
}
12521254
}

0 commit comments

Comments
 (0)