88use Neos \ContentRepositoryRegistry \ContentRepositoryRegistry ;
99use Neos \Flow \Cli \CommandController ;
1010use Neos \Flow \Package \FlowPackageInterface ;
11+ use Neos \Flow \Package \GenericPackage ;
1112use Neos \Flow \Package \PackageManager ;
1213use Neos \Utility \Files ;
1314use PackageFactory \NodeTypeObjects \Factory \NodeTypeObjectFileFactory ;
@@ -89,6 +90,32 @@ public function buildCommand(string $packageKey, string $crId = 'default'): void
8990 $ this ->output ->outputLine ($ packageKey . " is not a Flow package " );
9091 $ this ->quit (1 );
9192 }
93+ if (!$ package instanceof GenericPackage) {
94+ $ this ->output ->outputLine ($ packageKey . " is not a Generic package " );
95+ $ this ->quit (1 );
96+ }
97+
98+ /**
99+ * @var array<int, array{namespace:string, classPath:string, mappingType:string}> $autoloadConfigurations
100+ */
101+ $ autoloadConfigurations = $ package ->getFlattenedAutoloadConfiguration ();
102+ $ namespace = null ;
103+ foreach ($ autoloadConfigurations as $ autoloadConfiguration ) {
104+ if (
105+ $ autoloadConfiguration ['mappingType ' ] === 'psr-4 '
106+ && str_ends_with ($ autoloadConfiguration ['namespace ' ], '\\NodeTypes \\' )
107+ && $ autoloadConfiguration ['classPath ' ] === $ package ->getPackagePath () . 'NodeTypes/ '
108+ ) {
109+ $ namespace = $ autoloadConfiguration ['namespace ' ];
110+ break ;
111+ }
112+ }
113+
114+ if ($ namespace === null ) {
115+ $ this ->outputLine ('<error>No PSR4-NodeTypes namespace for the NodeTypes folder is registered via composer</error> ' );
116+ $ this ->quit (1 );
117+ }
118+
92119 $ contentRepository = $ this ->contentRepositoryRegistry ->get (ContentRepositoryId::fromString ($ crId ));
93120 $ nodeTypeManager = $ contentRepository ->getNodeTypeManager ();
94121 $ nodeTypes = $ nodeTypeManager ->getNodeTypes (false );
@@ -111,7 +138,7 @@ public function buildCommand(string $packageKey, string $crId = 'default'): void
111138 $ nodeTypeObjectFile ->fileContent
112139 );
113140
114- $ this ->outputLine (' - ' . $ specification ->nodeTypeName . '/ ' . $ specification ->className );
141+ $ this ->outputLine (' - ' . $ specification ->nodeTypeName . ' -> ' . $ specification ->className );
115142 }
116143 }
117144}
0 commit comments