File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -41,3 +41,32 @@ Example composer.json
4141 }
4242}
4343```
44+
45+ ## Configuration
46+
47+ There are three parameters you can configure: The node version (` node-version ` ), the yarn version (` yarn-version ` ) and
48+ the download url template for the node.js binary archives (` node-download-url ` ).
49+
50+ In the node download url the following parameters are replaced:
51+
52+ - version: ` ${version} `
53+ - type of your os: ` ${osType} `
54+ - system architecture: ` ${architecture} `
55+ - file format ` ${format} `
56+
57+ Example composer.json:
58+
59+ ``` json
60+ {
61+ // ...
62+ "extra" : {
63+ "mariusbuescher" : {
64+ "node-composer" : {
65+ "node-version" : " 6.11.0" ,
66+ "yarn-version" : " 0.24.5" ,
67+ "node-download-url" : " https://nodejs.org/dist/v${version}/node-v${version}-${osType}-${architecture}.${format}"
68+ }
69+ }
70+ }
71+ }
72+ ```
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ class Config
1616 */
1717 private $ yarnVersion ;
1818
19+ /**
20+ * @var string
21+ */
22+ private $ nodeDownloadUrl ;
23+
1924 /**
2025 * Config constructor.
2126 */
@@ -32,6 +37,7 @@ public static function fromArray(array $conf)
3237 $ self = new self ();
3338
3439 $ self ->nodeVersion = $ conf ['node-version ' ];
40+ $ self ->nodeDownloadUrl = isset ($ conf ['node-download-url ' ]) ? $ conf ['node-download-url ' ] : null ;
3541 $ self ->yarnVersion = isset ($ conf ['yarn-version ' ]) ? $ conf ['yarn-version ' ] : null ;
3642
3743 if ($ self ->nodeVersion === null ) {
@@ -57,4 +63,12 @@ public function getYarnVersion()
5763 {
5864 return $ this ->yarnVersion ;
5965 }
66+
67+ /**
68+ * @return string
69+ */
70+ public function getNodeDownloadUrl ()
71+ {
72+ return $ this ->nodeDownloadUrl ;
73+ }
6074}
Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ public function onPostUpdate(Event $event)
6767 $ nodeInstaller = new NodeInstaller (
6868 $ this ->io ,
6969 new RemoteFilesystem ($ this ->io , $ this ->composer ->getConfig ()),
70- $ context
70+ $ context ,
71+ $ this ->config ->getNodeDownloadUrl ()
7172 );
7273
7374 $ installedNodeVersion = $ nodeInstaller ->isInstalled ();
You can’t perform that action at this time.
0 commit comments