package-json transl.: add arg 'npmArgs'

This commit is contained in:
DavHau 2022-02-04 13:40:56 +07:00
parent dcdf2f27df
commit 817f4d3ba0

View File

@ -31,6 +31,7 @@
# read the json input # read the json input
outputFile=$(jq '.outputFile' -c -r $jsonInput) outputFile=$(jq '.outputFile' -c -r $jsonInput)
inputDirectory=$(jq '.inputDirectories | .[0]' -c -r $jsonInput) inputDirectory=$(jq '.inputDirectories | .[0]' -c -r $jsonInput)
npmArgs=$(jq '.npmArgs' -c -r $jsonInput)
# inputFiles=$(jq '.inputFiles | .[]' -c -r $jsonInput) # inputFiles=$(jq '.inputFiles | .[]' -c -r $jsonInput)
cp -r $inputDirectory/* ./ cp -r $inputDirectory/* ./
@ -42,9 +43,9 @@
echo "excluding dev dependencies" echo "excluding dev dependencies"
jq '.devDependencies = {}' ./package.json > package.json.mod jq '.devDependencies = {}' ./package.json > package.json.mod
mv package.json.mod package.json mv package.json.mod package.json
npm install --package-lock-only --production npm install --package-lock-only --production $npmArgs
else else
npm install --package-lock-only npm install --package-lock-only $npmArgs
fi fi
cat package-lock.json cat package-lock.json
@ -71,5 +72,14 @@
inputFiles = []; inputFiles = [];
}; };
extraArgs = translators.translators.nodejs.pure.package-lock.extraArgs; extraArgs = translators.translators.nodejs.pure.package-lock.extraArgs // {
npmArgs = {
description = "Additional arguments for npm";
type = "argument";
default = "";
examples = [
"--force"
];
};
};
} }