chore(v1): get rid of dreamLockUtils.nix

This commit is contained in:
DavHau 2023-05-29 22:32:06 +02:00
parent 4663912a1c
commit 69560f5128
2 changed files with 17 additions and 19 deletions

View File

@ -6,14 +6,13 @@
l = lib // builtins;
cfg = config.nodejs-package-lock;
dreamLockUtils = import ../../../lib/internal/dreamLockUtils.nix {inherit lib;};
nodejsUtils = import ../../../lib/internal/nodejsUtils.nix {inherit lib parseSpdxId;};
parseSpdxId = import ../../../lib/internal/parseSpdxId.nix {inherit lib;};
prepareSourceTree = import ../../../lib/internal/prepareSourceTree.nix {inherit lib;};
simpleTranslate = import ../../../lib/internal/simpleTranslate.nix {inherit lib;};
translate = import ./translate.nix {
inherit lib dreamLockUtils nodejsUtils parseSpdxId simpleTranslate;
inherit lib nodejsUtils parseSpdxId simpleTranslate;
};
dreamLock = translate {

View File

@ -1,7 +1,6 @@
{
lib,
nodejsUtils,
dreamLockUtils,
simpleTranslate,
...
}: let
@ -224,7 +223,7 @@
http = dependencyObject:
if lib.hasPrefix "https://" dependencyObject.version
then rec {
then {
version = getVersion dependencyObject;
url = dependencyObject.version;
hash = dependencyObject.integrity;
@ -237,7 +236,7 @@
// {
hash = dependencyObject.integrity;
}
else rec {
else {
url = dependencyObject.resolved;
hash = dependencyObject.integrity;
};
@ -245,21 +244,21 @@
path = dependencyObject:
# in case of an entry with missing resolved field
if ! lib.hasPrefix "file:" dependencyObject.version
then
dreamLockUtils.mkPathSource {
path = let
module = l.elemAt (l.splitString "/" dependencyObject.pname) 0;
in "node_modules/${module}";
rootName = projectName;
rootVersion = packageVersion;
}
then {
type = "path";
path = let
module = l.elemAt (l.splitString "/" dependencyObject.pname) 0;
in "node_modules/${module}";
rootName = projectName;
rootVersion = packageVersion;
}
# in case of a "file:" entry
else
dreamLockUtils.mkPathSource {
path = getPath dependencyObject;
rootName = projectName;
rootVersion = packageVersion;
};
else {
type = "path";
path = getPath dependencyObject;
rootName = projectName;
rootVersion = packageVersion;
};
};
getDependencies = dependencyObject: