@@ 30-41 (lines=12) @@ | ||
27 | ||
28 | // Collect package name→slug mappings. |
|
29 | $package_map = array(); |
|
30 | foreach ( glob( "$base/projects/packages/*/composer.json" ) as $file ) { |
|
31 | $slug = substr( $file, $l + 10, -14 ); |
|
32 | if ( ! isset( $output[ $slug ] ) ) { |
|
33 | // Not an actual project (should never happen here, but...). |
|
34 | continue; |
|
35 | } |
|
36 | ||
37 | $json = json_decode( file_get_contents( $file ), true ); |
|
38 | if ( isset( $json['name'] ) ) { |
|
39 | $package_map[ $json['name'] ] = $slug; |
|
40 | } |
|
41 | } |
|
42 | ||
43 | // Collect js-package name→slug mappings. |
|
44 | $js_package_map = array(); |
|
@@ 45-56 (lines=12) @@ | ||
42 | ||
43 | // Collect js-package name→slug mappings. |
|
44 | $js_package_map = array(); |
|
45 | foreach ( glob( "$base/projects/js-packages/*/package.json" ) as $file ) { |
|
46 | $slug = substr( $file, $l + 10, -13 ); |
|
47 | if ( ! isset( $output[ $slug ] ) ) { |
|
48 | // Not an actual project. |
|
49 | continue; |
|
50 | } |
|
51 | ||
52 | $json = json_decode( file_get_contents( $file ), true ); |
|
53 | if ( isset( $json['name'] ) ) { |
|
54 | $js_package_map[ $json['name'] ] = $slug; |
|
55 | } |
|
56 | } |
|
57 | ||
58 | // Collect dependencies. |
|
59 | foreach ( $output as $slug => &$deps ) { |