mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
nodejs: discoverer read files from tree
This commit is contained in:
parent
544c22bdbf
commit
49b299ce80
@ -35,9 +35,8 @@
|
||||
in
|
||||
childrenRemoved;
|
||||
|
||||
getTranslatorNames = path: let
|
||||
nodes = l.readDir path;
|
||||
packageJson = l.fromJSON (l.readFile "${path}/package.json");
|
||||
getTranslatorNames = tree: let
|
||||
packageJson = tree.files."package.json".jsonContent;
|
||||
translators =
|
||||
# if the package has no dependencies we use the
|
||||
# package-lock translator with `packageLock = null`
|
||||
@ -47,8 +46,8 @@
|
||||
&& (packageJson.workspaces or [] == [])
|
||||
then ["package-lock"]
|
||||
else
|
||||
l.optionals (nodes ? "package-lock.json") ["package-lock"]
|
||||
++ l.optionals (nodes ? "yarn.lock") ["yarn-lock"]
|
||||
l.optionals (tree.files ? "package-lock.json") ["package-lock"]
|
||||
++ l.optionals (tree.files ? "yarn.lock") ["yarn-lock"]
|
||||
++ ["package-json"];
|
||||
in
|
||||
translators;
|
||||
@ -166,7 +165,7 @@
|
||||
inherit subsystem;
|
||||
inherit (tree) relPath;
|
||||
name = tree.files."package.json".jsonContent.name or tree.relPath;
|
||||
translators = getTranslatorNames tree.fullPath;
|
||||
translators = getTranslatorNames tree;
|
||||
subsystemInfo = l.optionalAttrs (workspaces != []) {
|
||||
workspaces =
|
||||
l.map
|
||||
|
Loading…
Reference in New Issue
Block a user