File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99class Installer
1010{
11+ private const PACKAGE_NAME = 'avvertix/html-shot ' ;
12+
1113 public static function downloadArtifact (Event $ event ): void
1214 {
1315 $ composer = $ event ->getComposer ();
1416 $ io = $ event ->getIO ();
1517
16- $ extra = $ composer ->getPackage ()->getExtra ();
18+ // Look up this package in the local repository so we read its own
19+ // composer.json rather than the root project's composer.json.
20+ $ localRepo = $ composer ->getRepositoryManager ()->getLocalRepository ();
21+ $ package = $ localRepo ->findPackage (self ::PACKAGE_NAME , '* ' );
22+
23+ if ($ package !== null ) {
24+ $ packageRoot = $ composer ->getInstallationManager ()->getInstallPath ($ package );
25+ $ extra = $ package ->getExtra ();
26+ } else {
27+ // Package is the root (development mode).
28+ $ packageRoot = dirname (__DIR__ , 3 );
29+ $ extra = $ composer ->getPackage ()->getExtra ();
30+ }
31+
1732 $ artifacts = $ extra ['artifacts ' ] ?? [];
1833
1934 if ($ artifacts === []) {
@@ -38,7 +53,6 @@ public static function downloadArtifact(Event $event): void
3853 return ;
3954 }
4055
41- $ packageRoot = dirname (__DIR__ , 3 );
4256 $ libDir = $ packageRoot .'/lib ' ;
4357
4458 if (! is_dir ($ libDir ) && ! mkdir ($ libDir , 0755 , true )) {
You can’t perform that action at this time.
0 commit comments