Skip to content

Commit 17f75eb

Browse files
committed
Fix npm package.json scan error by removing the author.
Workaround can be removed when jqassistant-plugin/jqassistant-npm-plugin#5 is fixed.
1 parent 6eb4fb2 commit 17f75eb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

scripts/copyPackageJsonFiles.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Copies all package.json files inside the source directory into the artifacts/npm-package-json directory.
44
# It retains the original folder structure where the package.json files were in.
55

6+
# This script "jq" ( https://stedolan.github.io/jq ).
7+
68
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
79
set -o errexit -o pipefail
810

@@ -21,6 +23,7 @@ fi
2123
cd "./${SOURCE_DIRECTORY}"
2224

2325
echo "copyPackageJsonFiles: Existing package.json files will be copied from from ${SOURCE_DIRECTORY} to ../${ARTIFACTS_DIRECTORY}/${NPM_PACKAGE_JSON_ARTIFACTS_DIRECTORY}"
26+
echo "copyPackageJsonFiles: Author will be removed as workaround for https://github.com/jqassistant-plugin/jqassistant-npm-plugin/issues/5"
2427

2528
for file in $( find . -path ./node_modules -prune -o -name 'package.json' -print0 | xargs -0 -r -I {}); do
2629
fileDirectory=$(dirname "${file}")
@@ -29,5 +32,11 @@ fi
2932

3033
mkdir -p "${targetDirectory}"
3134
cp "${file}" "${targetDirectory}"
35+
36+
# Workaround until the following issue is resolved:
37+
# https://github.com/jqassistant-plugin/jqassistant-npm-plugin/issues/5
38+
fileName=$(basename "${file}")
39+
jq 'del(.author)' "${targetDirectory}/${fileName}" > "${targetDirectory}/${fileName}.edited"
40+
jq 'del(.contributors)' "${targetDirectory}/${fileName}.edited" > "${targetDirectory}/${fileName}"
3241
done
3342
)

0 commit comments

Comments
 (0)