mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-30 18:15:46 +03:00
feat: nodejs: package-lock: handle bundled dependenceis better
- assume bundled dep if type looks like http but resolved field is missing - use path source type to handle bundled deps
This commit is contained in:
parent
b899116277
commit
ee4a3e7062
@ -216,7 +216,12 @@
|
||||
getSourceType = dependencyObject:
|
||||
if identifyGitSource dependencyObject
|
||||
then "git"
|
||||
else if lib.hasPrefix "file:" dependencyObject.version
|
||||
else if
|
||||
(lib.hasPrefix "file:" dependencyObject.version)
|
||||
|| (
|
||||
(! lib.hasPrefix "https://" dependencyObject.version)
|
||||
&& (! dependencyObject ? resolved)
|
||||
)
|
||||
then "path"
|
||||
else "http";
|
||||
|
||||
@ -245,11 +250,25 @@
|
||||
};
|
||||
|
||||
path = dependencyObject:
|
||||
dlib.construct.pathSource {
|
||||
path = getPath dependencyObject;
|
||||
rootName = project.name;
|
||||
rootVersion = packageVersion;
|
||||
};
|
||||
# in case of an entry with missing resolved field
|
||||
if
|
||||
(! lib.hasPrefix "https://" dependencyObject.version)
|
||||
&& (! dependencyObject ? resolved)
|
||||
then
|
||||
dlib.construct.pathSource {
|
||||
path = let
|
||||
module = l.elemAt (l.splitString "/" dependencyObject.pname) 0;
|
||||
in "node_modules/${module}";
|
||||
rootName = project.name;
|
||||
rootVersion = packageVersion;
|
||||
}
|
||||
# in case of a "file:" entry
|
||||
else
|
||||
dlib.construct.pathSource {
|
||||
path = getPath dependencyObject;
|
||||
rootName = project.name;
|
||||
rootVersion = packageVersion;
|
||||
};
|
||||
};
|
||||
|
||||
getDependencies = dependencyObject:
|
||||
|
Loading…
Reference in New Issue
Block a user