Skip to content

Commit

Permalink
build: use find instead of relying on glob pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Nov 19, 2023
1 parent 26aef28 commit 2557d9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/_tools/scripts/publish_packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ function publish( pkg, clbk ) {
escaped = replace( dep, '@', '\\@' );
escaped = replace( escaped, '/', '\\/' );
command = [
'if ! grep -q "'+escaped+'" lib/** && ! grep -q -s "'+escaped+'" manifest.json && ! grep -q -s "'+escaped+'" include.gypi; then',
'if ! find lib -name "*.js" -exec grep -q "'+escaped+'" {} + && ! grep -q -s "'+escaped+'" manifest.json && ! grep -q -s "'+escaped+'" include.gypi; then',
' printf "false"',
'else',
' printf "true"',
Expand All @@ -1233,7 +1233,7 @@ function publish( pkg, clbk ) {
escaped = replace( dep, '@', '\\@' );
escaped = replace( escaped, '/', '\\/' );
command = [
'if ! grep -q "'+escaped+'" lib/** && ! grep -q -s "'+escaped+'" manifest.json && ! grep -q -s "'+escaped+'" include.gypi; then',
'if ! find lib -name "*.js" -exec grep -q "'+escaped+'" {} + && ! grep -q -s "'+escaped+'" manifest.json && ! grep -q -s "'+escaped+'" include.gypi; then',
' printf "false"',
'else',
' printf "true"',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
# For all dependencies, check in all *.js files if they are still used; if not, remove them:
jq -r '.dependencies | keys[]' ./package.json | while read -r dep; do
dep=$(echo "$dep" | xargs)
if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
if ! find lib -name "*.js" -exec grep -q "$dep" {} + && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
jq --indent 2 "del(.dependencies[\"$dep\"])" ./package.json > ./package.json.tmp
mv ./package.json.tmp ./package.json
fi
Expand All @@ -129,7 +129,7 @@ jobs:
continue
fi
dep=$(echo "$dep" | xargs)
if ! grep -q "$dep" lib/** && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
if ! find lib -name "*.js" -exec grep -q "$dep" {} + && ! grep -q -s "$dep" manifest.json && ! grep -q -s "$dep" include.gypi; then
jq --indent 2 "del(.devDependencies[\"$dep\"])" ./package.json > ./package.json.tmp
mv ./package.json.tmp ./package.json
fi
Expand Down

0 comments on commit 2557d9d

Please sign in to comment.