mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-04 20:22:14 +03:00
some fixes for package-json and package-lock
- fix missing git & ssh in pacakge-json translator - package-lock: if dependency missing, raise warning instead of error.
This commit is contained in:
parent
28b890821f
commit
ec30059894
@ -11,8 +11,10 @@
|
||||
# nixpkgs dependenies
|
||||
bash,
|
||||
coreutils,
|
||||
git,
|
||||
jq,
|
||||
nodePackages,
|
||||
openssh,
|
||||
writeScriptBin,
|
||||
...
|
||||
}:
|
||||
@ -20,8 +22,10 @@
|
||||
[
|
||||
bash
|
||||
coreutils
|
||||
git
|
||||
jq
|
||||
nodePackages.npm
|
||||
openssh
|
||||
]
|
||||
''
|
||||
# accroding to the spec, the translator reads the input from a json file
|
||||
@ -30,10 +34,14 @@
|
||||
# read the json input
|
||||
outputFile=$(jq '.outputFile' -c -r $jsonInput)
|
||||
source=$(jq '.source' -c -r $jsonInput)
|
||||
npmArgs=$(jq '.npmArgs' -c -r $jsonInput)
|
||||
relPath=$(jq '.project.relPath' -c -r $jsonInput)
|
||||
npmArgs=$(jq '.project.subsystemInfo.npmArgs' -c -r $jsonInput)
|
||||
|
||||
cp -r $source/* ./
|
||||
chmod -R +w ./
|
||||
newSource=$(pwd)
|
||||
|
||||
cd $relPath
|
||||
rm -rf package-lock.json
|
||||
|
||||
if [ "$(jq '.project.subsystemInfo.noDev' -c -r $jsonInput)" == "true" ]; then
|
||||
@ -45,7 +53,7 @@
|
||||
npm install --package-lock-only $npmArgs
|
||||
fi
|
||||
|
||||
jq ".source = \"$(pwd)\"" -c -r $jsonInput > $TMPDIR/newJsonInput
|
||||
jq ".source = \"$newSource\"" -c -r $jsonInput > $TMPDIR/newJsonInput
|
||||
|
||||
cd $WORKDIR
|
||||
${translators.translatorsV2.nodejs.pure.package-lock.translateBin} $TMPDIR/newJsonInput
|
||||
|
@ -86,12 +86,26 @@
|
||||
selfScopeDeps = parentScopeDeps // dependencies;
|
||||
requires = pdata.requires or {};
|
||||
dependencies = pdata.dependencies or {};
|
||||
|
||||
filteredRequires =
|
||||
l.filterAttrs
|
||||
(name: spec:
|
||||
if selfScopeDeps ? ${name}
|
||||
then true
|
||||
else
|
||||
l.trace
|
||||
''
|
||||
WARNING: could not find dependency ${name} in package-lock.json
|
||||
This might be expected for bundled dependencies of sub-dependencies.
|
||||
''
|
||||
false)
|
||||
requires;
|
||||
in
|
||||
pdata
|
||||
// {
|
||||
depsExact =
|
||||
lib.forEach
|
||||
(lib.attrNames requires)
|
||||
(lib.attrNames filteredRequires)
|
||||
(reqName: {
|
||||
name = reqName;
|
||||
version = getVersion selfScopeDeps."${reqName}";
|
||||
|
Loading…
Reference in New Issue
Block a user