php: use project.name from discoverer

This commit is contained in:
Martin Toman 2022-09-12 15:07:45 -07:00
parent 969cba514c
commit 39c5375a94
2 changed files with 11 additions and 7 deletions

View File

@ -7,10 +7,8 @@
l = lib // builtins;
# get translators for the project
getTranslators = path: let
nodes = l.readDir path;
in
l.optional (nodes ? "composer.lock") "composer-lock"
getTranslators = tree:
l.optional (tree.files ? "composer.lock") "composer-lock"
++ ["composer-json"];
# discover php projects
@ -18,8 +16,14 @@
currentProjectInfo = dlib.construct.discoveredProject {
inherit subsystem;
inherit (tree) relPath;
name = tree.files."composer.json".jsonContent.name or tree.relPath;
translators = getTranslators tree.fullPath;
name =
tree.files."composer.json".jsonContent.name
or (
if tree.relPath != ""
then tree.relPath
else "unknown"
);
translators = getTranslators tree;
subsystemInfo = {};
};
in

View File

@ -245,7 +245,7 @@ in {
};
# name of the default package
defaultPackage = composerJson.name or "unknown";
defaultPackage = project.name;
/*
List the package candidates which should be exposed to the user.