netlify-cli 11.5.1 → 11.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm-shrinkwrap.json +58 -40
- package/package.json +1 -1
- package/src/commands/build/build.js +2 -6
- package/src/commands/deploy/deploy.js +4 -2
- package/src/functions-templates/javascript/stripe-charge/package-lock.json +7 -7
- package/src/functions-templates/javascript/stripe-charge/package.json +1 -1
- package/src/functions-templates/javascript/stripe-subscription/package-lock.json +7 -7
- package/src/functions-templates/javascript/stripe-subscription/package.json +1 -1
- package/src/functions-templates/rust/hello-world/Cargo.toml +1 -1
- package/src/lib/build.js +57 -4
- package/src/utils/detect-server-settings.js +7 -1
- package/src/utils/proxy.js +11 -4
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.6.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "netlify-cli",
|
|
9
|
-
"version": "11.
|
|
9
|
+
"version": "11.6.0",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
@@ -4728,9 +4728,9 @@
|
|
|
4728
4728
|
}
|
|
4729
4729
|
},
|
|
4730
4730
|
"node_modules/@verdaccio/ui-theme": {
|
|
4731
|
-
"version": "6.0.0-6-next.
|
|
4732
|
-
"resolved": "https://registry.npmjs.org/@verdaccio/ui-theme/-/ui-theme-6.0.0-6-next.
|
|
4733
|
-
"integrity": "sha512-
|
|
4731
|
+
"version": "6.0.0-6-next.28",
|
|
4732
|
+
"resolved": "https://registry.npmjs.org/@verdaccio/ui-theme/-/ui-theme-6.0.0-6-next.28.tgz",
|
|
4733
|
+
"integrity": "sha512-1sJ28aVGMiRJrSz0e8f4t+IUgt/cyYmuDLhogXHOEjEIIEcfMNyQ5bVYqq03wLVoKWEh5D6gHo1hQnVKQl1L5g==",
|
|
4734
4734
|
"dev": true
|
|
4735
4735
|
},
|
|
4736
4736
|
"node_modules/abab": {
|
|
@@ -8282,9 +8282,9 @@
|
|
|
8282
8282
|
}
|
|
8283
8283
|
},
|
|
8284
8284
|
"node_modules/dayjs": {
|
|
8285
|
-
"version": "1.11.
|
|
8286
|
-
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.
|
|
8287
|
-
"integrity": "sha512-
|
|
8285
|
+
"version": "1.11.5",
|
|
8286
|
+
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz",
|
|
8287
|
+
"integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==",
|
|
8288
8288
|
"dev": true
|
|
8289
8289
|
},
|
|
8290
8290
|
"node_modules/debug": {
|
|
@@ -9103,9 +9103,9 @@
|
|
|
9103
9103
|
}
|
|
9104
9104
|
},
|
|
9105
9105
|
"node_modules/dotenv": {
|
|
9106
|
-
"version": "16.0.
|
|
9107
|
-
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.
|
|
9108
|
-
"integrity": "sha512-
|
|
9106
|
+
"version": "16.0.2",
|
|
9107
|
+
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.2.tgz",
|
|
9108
|
+
"integrity": "sha512-JvpYKUmzQhYoIFgK2MOnF3bciIZoItIIoryihy0rIA+H4Jy0FmgyKYAHCTN98P5ybGSJcIFbh6QKeJdtZd1qhA==",
|
|
9109
9109
|
"engines": {
|
|
9110
9110
|
"node": ">=12"
|
|
9111
9111
|
}
|
|
@@ -21912,23 +21912,23 @@
|
|
|
21912
21912
|
}
|
|
21913
21913
|
},
|
|
21914
21914
|
"node_modules/verdaccio": {
|
|
21915
|
-
"version": "5.
|
|
21916
|
-
"resolved": "https://registry.npmjs.org/verdaccio/-/verdaccio-5.
|
|
21917
|
-
"integrity": "sha512
|
|
21915
|
+
"version": "5.15.3",
|
|
21916
|
+
"resolved": "https://registry.npmjs.org/verdaccio/-/verdaccio-5.15.3.tgz",
|
|
21917
|
+
"integrity": "sha512-8oEtepXF1oksGVYahi2HS1Yx9u6HD/4ukBDNDfwISmlNp7HVKJL2+kjzmDJWam88BpDNxOBU/LFXWSsEAFKFCQ==",
|
|
21918
21918
|
"dev": true,
|
|
21919
21919
|
"dependencies": {
|
|
21920
21920
|
"@verdaccio/commons-api": "10.2.0",
|
|
21921
21921
|
"@verdaccio/local-storage": "10.3.1",
|
|
21922
21922
|
"@verdaccio/readme": "10.4.1",
|
|
21923
21923
|
"@verdaccio/streams": "10.2.0",
|
|
21924
|
-
"@verdaccio/ui-theme": "6.0.0-6-next.
|
|
21924
|
+
"@verdaccio/ui-theme": "6.0.0-6-next.28",
|
|
21925
21925
|
"async": "3.2.4",
|
|
21926
21926
|
"body-parser": "1.20.0",
|
|
21927
21927
|
"clipanion": "3.1.0",
|
|
21928
21928
|
"compression": "1.7.4",
|
|
21929
21929
|
"cookies": "0.8.0",
|
|
21930
21930
|
"cors": "2.8.5",
|
|
21931
|
-
"dayjs": "1.11.
|
|
21931
|
+
"dayjs": "1.11.5",
|
|
21932
21932
|
"debug": "^4.3.3",
|
|
21933
21933
|
"envinfo": "7.8.1",
|
|
21934
21934
|
"eslint-import-resolver-node": "0.3.6",
|
|
@@ -21942,9 +21942,9 @@
|
|
|
21942
21942
|
"jsonwebtoken": "8.5.1",
|
|
21943
21943
|
"kleur": "4.1.5",
|
|
21944
21944
|
"lodash": "4.17.21",
|
|
21945
|
-
"lru-cache": "7.
|
|
21945
|
+
"lru-cache": "7.14.0",
|
|
21946
21946
|
"lunr-mutable-indexes": "2.3.2",
|
|
21947
|
-
"marked": "4.0
|
|
21947
|
+
"marked": "4.1.0",
|
|
21948
21948
|
"memoizee": "0.4.15",
|
|
21949
21949
|
"mime": "3.0.0",
|
|
21950
21950
|
"minimatch": "5.1.0",
|
|
@@ -22071,14 +22071,26 @@
|
|
|
22071
22071
|
}
|
|
22072
22072
|
},
|
|
22073
22073
|
"node_modules/verdaccio/node_modules/lru-cache": {
|
|
22074
|
-
"version": "7.
|
|
22075
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.
|
|
22076
|
-
"integrity": "sha512-
|
|
22074
|
+
"version": "7.14.0",
|
|
22075
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.0.tgz",
|
|
22076
|
+
"integrity": "sha512-EIRtP1GrSJny0dqb50QXRUNBxHJhcpxHC++M5tD7RYbvLLn5KVWKsbyswSSqDuU15UFi3bgTQIY8nhDMeF6aDQ==",
|
|
22077
22077
|
"dev": true,
|
|
22078
22078
|
"engines": {
|
|
22079
22079
|
"node": ">=12"
|
|
22080
22080
|
}
|
|
22081
22081
|
},
|
|
22082
|
+
"node_modules/verdaccio/node_modules/marked": {
|
|
22083
|
+
"version": "4.1.0",
|
|
22084
|
+
"resolved": "https://registry.npmjs.org/marked/-/marked-4.1.0.tgz",
|
|
22085
|
+
"integrity": "sha512-+Z6KDjSPa6/723PQYyc1axYZpYYpDnECDaU6hkaf5gqBieBkMKYReL5hteF2QizhlMbgbo8umXl/clZ67+GlsA==",
|
|
22086
|
+
"dev": true,
|
|
22087
|
+
"bin": {
|
|
22088
|
+
"marked": "bin/marked.js"
|
|
22089
|
+
},
|
|
22090
|
+
"engines": {
|
|
22091
|
+
"node": ">= 12"
|
|
22092
|
+
}
|
|
22093
|
+
},
|
|
22082
22094
|
"node_modules/verdaccio/node_modules/mime": {
|
|
22083
22095
|
"version": "3.0.0",
|
|
22084
22096
|
"resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
|
|
@@ -25648,9 +25660,9 @@
|
|
|
25648
25660
|
"dev": true
|
|
25649
25661
|
},
|
|
25650
25662
|
"@verdaccio/ui-theme": {
|
|
25651
|
-
"version": "6.0.0-6-next.
|
|
25652
|
-
"resolved": "https://registry.npmjs.org/@verdaccio/ui-theme/-/ui-theme-6.0.0-6-next.
|
|
25653
|
-
"integrity": "sha512-
|
|
25663
|
+
"version": "6.0.0-6-next.28",
|
|
25664
|
+
"resolved": "https://registry.npmjs.org/@verdaccio/ui-theme/-/ui-theme-6.0.0-6-next.28.tgz",
|
|
25665
|
+
"integrity": "sha512-1sJ28aVGMiRJrSz0e8f4t+IUgt/cyYmuDLhogXHOEjEIIEcfMNyQ5bVYqq03wLVoKWEh5D6gHo1hQnVKQl1L5g==",
|
|
25654
25666
|
"dev": true
|
|
25655
25667
|
},
|
|
25656
25668
|
"abab": {
|
|
@@ -28388,9 +28400,9 @@
|
|
|
28388
28400
|
}
|
|
28389
28401
|
},
|
|
28390
28402
|
"dayjs": {
|
|
28391
|
-
"version": "1.11.
|
|
28392
|
-
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.
|
|
28393
|
-
"integrity": "sha512-
|
|
28403
|
+
"version": "1.11.5",
|
|
28404
|
+
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.5.tgz",
|
|
28405
|
+
"integrity": "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==",
|
|
28394
28406
|
"dev": true
|
|
28395
28407
|
},
|
|
28396
28408
|
"debug": {
|
|
@@ -29025,9 +29037,9 @@
|
|
|
29025
29037
|
}
|
|
29026
29038
|
},
|
|
29027
29039
|
"dotenv": {
|
|
29028
|
-
"version": "16.0.
|
|
29029
|
-
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.
|
|
29030
|
-
"integrity": "sha512-
|
|
29040
|
+
"version": "16.0.2",
|
|
29041
|
+
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.2.tgz",
|
|
29042
|
+
"integrity": "sha512-JvpYKUmzQhYoIFgK2MOnF3bciIZoItIIoryihy0rIA+H4Jy0FmgyKYAHCTN98P5ybGSJcIFbh6QKeJdtZd1qhA=="
|
|
29031
29043
|
},
|
|
29032
29044
|
"download": {
|
|
29033
29045
|
"version": "8.0.0",
|
|
@@ -38742,23 +38754,23 @@
|
|
|
38742
38754
|
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
|
38743
38755
|
},
|
|
38744
38756
|
"verdaccio": {
|
|
38745
|
-
"version": "5.
|
|
38746
|
-
"resolved": "https://registry.npmjs.org/verdaccio/-/verdaccio-5.
|
|
38747
|
-
"integrity": "sha512
|
|
38757
|
+
"version": "5.15.3",
|
|
38758
|
+
"resolved": "https://registry.npmjs.org/verdaccio/-/verdaccio-5.15.3.tgz",
|
|
38759
|
+
"integrity": "sha512-8oEtepXF1oksGVYahi2HS1Yx9u6HD/4ukBDNDfwISmlNp7HVKJL2+kjzmDJWam88BpDNxOBU/LFXWSsEAFKFCQ==",
|
|
38748
38760
|
"dev": true,
|
|
38749
38761
|
"requires": {
|
|
38750
38762
|
"@verdaccio/commons-api": "10.2.0",
|
|
38751
38763
|
"@verdaccio/local-storage": "10.3.1",
|
|
38752
38764
|
"@verdaccio/readme": "10.4.1",
|
|
38753
38765
|
"@verdaccio/streams": "10.2.0",
|
|
38754
|
-
"@verdaccio/ui-theme": "6.0.0-6-next.
|
|
38766
|
+
"@verdaccio/ui-theme": "6.0.0-6-next.28",
|
|
38755
38767
|
"async": "3.2.4",
|
|
38756
38768
|
"body-parser": "1.20.0",
|
|
38757
38769
|
"clipanion": "3.1.0",
|
|
38758
38770
|
"compression": "1.7.4",
|
|
38759
38771
|
"cookies": "0.8.0",
|
|
38760
38772
|
"cors": "2.8.5",
|
|
38761
|
-
"dayjs": "1.11.
|
|
38773
|
+
"dayjs": "1.11.5",
|
|
38762
38774
|
"debug": "^4.3.3",
|
|
38763
38775
|
"envinfo": "7.8.1",
|
|
38764
38776
|
"eslint-import-resolver-node": "0.3.6",
|
|
@@ -38772,9 +38784,9 @@
|
|
|
38772
38784
|
"jsonwebtoken": "8.5.1",
|
|
38773
38785
|
"kleur": "4.1.5",
|
|
38774
38786
|
"lodash": "4.17.21",
|
|
38775
|
-
"lru-cache": "7.
|
|
38787
|
+
"lru-cache": "7.14.0",
|
|
38776
38788
|
"lunr-mutable-indexes": "2.3.2",
|
|
38777
|
-
"marked": "4.0
|
|
38789
|
+
"marked": "4.1.0",
|
|
38778
38790
|
"memoizee": "0.4.15",
|
|
38779
38791
|
"mime": "3.0.0",
|
|
38780
38792
|
"minimatch": "5.1.0",
|
|
@@ -38820,9 +38832,15 @@
|
|
|
38820
38832
|
}
|
|
38821
38833
|
},
|
|
38822
38834
|
"lru-cache": {
|
|
38823
|
-
"version": "7.
|
|
38824
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.
|
|
38825
|
-
"integrity": "sha512-
|
|
38835
|
+
"version": "7.14.0",
|
|
38836
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.14.0.tgz",
|
|
38837
|
+
"integrity": "sha512-EIRtP1GrSJny0dqb50QXRUNBxHJhcpxHC++M5tD7RYbvLLn5KVWKsbyswSSqDuU15UFi3bgTQIY8nhDMeF6aDQ==",
|
|
38838
|
+
"dev": true
|
|
38839
|
+
},
|
|
38840
|
+
"marked": {
|
|
38841
|
+
"version": "4.1.0",
|
|
38842
|
+
"resolved": "https://registry.npmjs.org/marked/-/marked-4.1.0.tgz",
|
|
38843
|
+
"integrity": "sha512-+Z6KDjSPa6/723PQYyc1axYZpYYpDnECDaU6hkaf5gqBieBkMKYReL5hteF2QizhlMbgbo8umXl/clZ67+GlsA==",
|
|
38826
38844
|
"dev": true
|
|
38827
38845
|
},
|
|
38828
38846
|
"mime": {
|
package/package.json
CHANGED
|
@@ -7,11 +7,7 @@ const { error, exit, generateNetlifyGraphJWT, getEnvelopeEnv, getToken, normaliz
|
|
|
7
7
|
/**
|
|
8
8
|
* @param {import('../../lib/build').BuildConfig} options
|
|
9
9
|
*/
|
|
10
|
-
const checkOptions = ({
|
|
11
|
-
if (!siteInfo.id) {
|
|
12
|
-
error('Could not find the site ID. Please run netlify link.')
|
|
13
|
-
}
|
|
14
|
-
|
|
10
|
+
const checkOptions = ({ token }) => {
|
|
15
11
|
if (!token) {
|
|
16
12
|
error('Could not find the access token. Please run netlify login.')
|
|
17
13
|
}
|
|
@@ -72,7 +68,7 @@ const build = async (options, command) => {
|
|
|
72
68
|
await injectEnv(command, { api, buildOptions, context, site, siteInfo })
|
|
73
69
|
}
|
|
74
70
|
|
|
75
|
-
const { exitCode } = await runBuild(buildOptions)
|
|
71
|
+
const { exitCode } = await runBuild(buildOptions, command, options)
|
|
76
72
|
exit(exitCode)
|
|
77
73
|
}
|
|
78
74
|
|
|
@@ -375,10 +375,11 @@ const runDeploy = async ({
|
|
|
375
375
|
*
|
|
376
376
|
* @param {object} config
|
|
377
377
|
* @param {*} config.cachedConfig
|
|
378
|
+
* @param {*} config.command
|
|
378
379
|
* @param {import('commander').OptionValues} config.options The options of the command
|
|
379
380
|
* @returns
|
|
380
381
|
*/
|
|
381
|
-
const handleBuild = async ({ cachedConfig, options }) => {
|
|
382
|
+
const handleBuild = async ({ cachedConfig, command, options }) => {
|
|
382
383
|
if (!options.build) {
|
|
383
384
|
return {}
|
|
384
385
|
}
|
|
@@ -388,7 +389,7 @@ const handleBuild = async ({ cachedConfig, options }) => {
|
|
|
388
389
|
token,
|
|
389
390
|
options,
|
|
390
391
|
})
|
|
391
|
-
const { configMutations, exitCode, newConfig } = await runBuild(resolvedOptions)
|
|
392
|
+
const { configMutations, exitCode, newConfig } = await runBuild(resolvedOptions, command, options)
|
|
392
393
|
if (exitCode !== 0) {
|
|
393
394
|
exit(exitCode)
|
|
394
395
|
}
|
|
@@ -573,6 +574,7 @@ const deploy = async (options, command) => {
|
|
|
573
574
|
|
|
574
575
|
const { newConfig, configMutations = [] } = await handleBuild({
|
|
575
576
|
cachedConfig: command.netlify.cachedConfig,
|
|
577
|
+
command,
|
|
576
578
|
options,
|
|
577
579
|
})
|
|
578
580
|
const config = newConfig || command.netlify.config
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"stripe": "^
|
|
12
|
+
"stripe": "^10.0.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@types/node": {
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
"node_modules/stripe": {
|
|
108
|
-
"version": "
|
|
109
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-
|
|
110
|
-
"integrity": "sha512
|
|
108
|
+
"version": "10.8.0",
|
|
109
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-10.8.0.tgz",
|
|
110
|
+
"integrity": "sha512-/cQiJ7puqVMDrGDRGqtHn6zPB+nRNA97qyQU59msLQ1OWaQOmwW1IQR7PpRqeqkSv9SgPU7BVBlMKNwWtn1qNA==",
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@types/node": ">=8.1.0",
|
|
113
113
|
"qs": "^6.10.3"
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
"stripe": {
|
|
187
|
-
"version": "
|
|
188
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-
|
|
189
|
-
"integrity": "sha512
|
|
187
|
+
"version": "10.8.0",
|
|
188
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-10.8.0.tgz",
|
|
189
|
+
"integrity": "sha512-/cQiJ7puqVMDrGDRGqtHn6zPB+nRNA97qyQU59msLQ1OWaQOmwW1IQR7PpRqeqkSv9SgPU7BVBlMKNwWtn1qNA==",
|
|
190
190
|
"requires": {
|
|
191
191
|
"@types/node": ">=8.1.0",
|
|
192
192
|
"qs": "^6.10.3"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"stripe": "^
|
|
12
|
+
"stripe": "^10.0.0"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/@types/node": {
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
107
|
"node_modules/stripe": {
|
|
108
|
-
"version": "
|
|
109
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-
|
|
110
|
-
"integrity": "sha512
|
|
108
|
+
"version": "10.8.0",
|
|
109
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-10.8.0.tgz",
|
|
110
|
+
"integrity": "sha512-/cQiJ7puqVMDrGDRGqtHn6zPB+nRNA97qyQU59msLQ1OWaQOmwW1IQR7PpRqeqkSv9SgPU7BVBlMKNwWtn1qNA==",
|
|
111
111
|
"dependencies": {
|
|
112
112
|
"@types/node": ">=8.1.0",
|
|
113
113
|
"qs": "^6.10.3"
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
"stripe": {
|
|
187
|
-
"version": "
|
|
188
|
-
"resolved": "https://registry.npmjs.org/stripe/-/stripe-
|
|
189
|
-
"integrity": "sha512
|
|
187
|
+
"version": "10.8.0",
|
|
188
|
+
"resolved": "https://registry.npmjs.org/stripe/-/stripe-10.8.0.tgz",
|
|
189
|
+
"integrity": "sha512-/cQiJ7puqVMDrGDRGqtHn6zPB+nRNA97qyQU59msLQ1OWaQOmwW1IQR7PpRqeqkSv9SgPU7BVBlMKNwWtn1qNA==",
|
|
190
190
|
"requires": {
|
|
191
191
|
"@types/node": ">=8.1.0",
|
|
192
192
|
"qs": "^6.10.3"
|
package/src/lib/build.js
CHANGED
|
@@ -3,6 +3,8 @@ const process = require('process')
|
|
|
3
3
|
|
|
4
4
|
const netlifyBuildPromise = import('@netlify/build')
|
|
5
5
|
|
|
6
|
+
const { NETLIFYDEVERR, detectServerSettings, error, log } = require('../utils')
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* The buildConfig + a missing cachedConfig
|
|
8
10
|
* @typedef BuildConfig
|
|
@@ -41,11 +43,20 @@ const getBuildOptions = ({ cachedConfig, options: { context, cwd, debug, dry, js
|
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* run the build command
|
|
44
|
-
* @param {BuildConfig}
|
|
46
|
+
* @param {BuildConfig} buildOptions
|
|
47
|
+
* @param {import('../commands/base-command').BaseCommand} command
|
|
48
|
+
* @param {import('commander').OptionValues} commandOptions
|
|
45
49
|
* @returns
|
|
46
50
|
*/
|
|
47
|
-
const runBuild = async (
|
|
51
|
+
const runBuild = async (buildOptions, command, commandOptions) => {
|
|
48
52
|
const { default: build } = await netlifyBuildPromise
|
|
53
|
+
const { cachedConfig, config, site } = command.netlify
|
|
54
|
+
const devConfig = {
|
|
55
|
+
framework: '#auto',
|
|
56
|
+
...(config.functionsDirectory && { functions: config.functionsDirectory }),
|
|
57
|
+
...config.dev,
|
|
58
|
+
...commandOptions,
|
|
59
|
+
}
|
|
49
60
|
|
|
50
61
|
// If netlify NETLIFY_API_URL is set we need to pass this information to @netlify/build
|
|
51
62
|
// TODO don't use testOpts, but add real properties to do this.
|
|
@@ -55,10 +66,52 @@ const runBuild = async (options) => {
|
|
|
55
66
|
scheme: apiUrl.protocol.slice(0, -1),
|
|
56
67
|
host: apiUrl.host,
|
|
57
68
|
}
|
|
58
|
-
|
|
69
|
+
buildOptions = { ...buildOptions, testOpts }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** @type {Partial<import('../../utils/types').ServerSettings>} */
|
|
73
|
+
let settings = {}
|
|
74
|
+
try {
|
|
75
|
+
settings = await detectServerSettings(devConfig, commandOptions, site.root)
|
|
76
|
+
|
|
77
|
+
const defaultConfig = { build: {} }
|
|
78
|
+
|
|
79
|
+
if (settings.buildCommand && settings.dist) {
|
|
80
|
+
buildOptions.cachedConfig.config.build.command = settings.buildCommand
|
|
81
|
+
defaultConfig.build.command = settings.buildCommand
|
|
82
|
+
buildOptions.cachedConfig.config.build.publish = settings.buildCommand
|
|
83
|
+
defaultConfig.build.publish = settings.dist
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (defaultConfig.build.command && defaultConfig.build.publish) {
|
|
87
|
+
buildOptions.defaultConfig = defaultConfig
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// If there are plugins that we should be running for this site, add them
|
|
91
|
+
// to the config as if they were declared in netlify.toml. We must check
|
|
92
|
+
// whether the plugin has already been added by another source (like the
|
|
93
|
+
// TOML file or the UI), as we don't want to run the same plugin twice.
|
|
94
|
+
if (settings.plugins) {
|
|
95
|
+
const { plugins: existingPlugins = [] } = cachedConfig.config
|
|
96
|
+
const existingPluginNames = new Set(existingPlugins.map((plugin) => plugin.package))
|
|
97
|
+
const newPlugins = settings.plugins
|
|
98
|
+
.map((pluginName) => {
|
|
99
|
+
if (existingPluginNames.has(pluginName)) {
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return { package: pluginName, origin: 'config', inputs: {} }
|
|
104
|
+
})
|
|
105
|
+
.filter(Boolean)
|
|
106
|
+
|
|
107
|
+
buildOptions.cachedConfig.config.plugins = [...newPlugins, ...cachedConfig.config.plugins]
|
|
108
|
+
}
|
|
109
|
+
} catch (detectServerSettingsError) {
|
|
110
|
+
log(NETLIFYDEVERR, detectServerSettingsError.message)
|
|
111
|
+
error(detectServerSettingsError)
|
|
59
112
|
}
|
|
60
113
|
|
|
61
|
-
const { configMutations, netlifyConfig: newConfig, severityCode: exitCode } = await build(
|
|
114
|
+
const { configMutations, netlifyConfig: newConfig, severityCode: exitCode } = await build(buildOptions)
|
|
62
115
|
return { exitCode, newConfig, configMutations }
|
|
63
116
|
}
|
|
64
117
|
|
|
@@ -158,7 +158,10 @@ const handleStaticServer = async ({ devConfig, options, projectDir }) => {
|
|
|
158
158
|
*/
|
|
159
159
|
const getSettingsFromFramework = (framework) => {
|
|
160
160
|
const {
|
|
161
|
-
build: {
|
|
161
|
+
build: {
|
|
162
|
+
directory: dist,
|
|
163
|
+
commands: [buildCommand],
|
|
164
|
+
},
|
|
162
165
|
dev: {
|
|
163
166
|
commands: [command],
|
|
164
167
|
port: frameworkPort,
|
|
@@ -172,6 +175,7 @@ const getSettingsFromFramework = (framework) => {
|
|
|
172
175
|
|
|
173
176
|
return {
|
|
174
177
|
command,
|
|
178
|
+
buildCommand,
|
|
175
179
|
frameworkPort,
|
|
176
180
|
dist: staticDir || dist,
|
|
177
181
|
framework: frameworkName,
|
|
@@ -250,6 +254,7 @@ const handleCustomFramework = ({ devConfig }) => {
|
|
|
250
254
|
const mergeSettings = async ({ devConfig, frameworkSettings = {} }) => {
|
|
251
255
|
const {
|
|
252
256
|
command: frameworkCommand,
|
|
257
|
+
buildCommand,
|
|
253
258
|
frameworkPort: frameworkDetectedPort,
|
|
254
259
|
dist,
|
|
255
260
|
framework,
|
|
@@ -263,6 +268,7 @@ const mergeSettings = async ({ devConfig, frameworkSettings = {} }) => {
|
|
|
263
268
|
const useStaticServer = !(command && frameworkPort)
|
|
264
269
|
return {
|
|
265
270
|
command,
|
|
271
|
+
buildCommand,
|
|
266
272
|
frameworkPort: useStaticServer ? await getStaticServerPort({ devConfig }) : frameworkPort,
|
|
267
273
|
dist: devConfig.publish || dist || getDefaultDist(),
|
|
268
274
|
framework,
|
package/src/utils/proxy.js
CHANGED
|
@@ -70,7 +70,7 @@ const proxyToExternalUrl = function ({ dest, destURL, req, res }) {
|
|
|
70
70
|
pathRewrite: () => destURL,
|
|
71
71
|
...(Buffer.isBuffer(req.originalBody) && { buffer: toReadableStream(req.originalBody) }),
|
|
72
72
|
})
|
|
73
|
-
return handler(req, res, {})
|
|
73
|
+
return handler(req, res, () => {})
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const handleAddonUrl = function ({ addonUrl, req, res }) {
|
|
@@ -185,7 +185,7 @@ const serveRedirect = async function ({ match, options, proxy, req, res }) {
|
|
|
185
185
|
|
|
186
186
|
const staticFile = await getStatic(decodeURIComponent(reqUrl.pathname), options.publicFolder)
|
|
187
187
|
if (staticFile) {
|
|
188
|
-
req.url =
|
|
188
|
+
req.url = encodeURI(staticFile) + reqUrl.search
|
|
189
189
|
// if there is an existing static file and it is not a forced redirect, return the file
|
|
190
190
|
if (!match.force) {
|
|
191
191
|
return proxy.web(req, res, { ...options, staticFile })
|
|
@@ -214,18 +214,25 @@ const serveRedirect = async function ({ match, options, proxy, req, res }) {
|
|
|
214
214
|
})
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
let destURL = stripOrigin(dest)
|
|
218
218
|
|
|
219
219
|
if (isExternal(match)) {
|
|
220
|
-
|
|
220
|
+
if (isRedirect(match)) {
|
|
221
|
+
// This is a redirect, so we set the complete external URL as destination
|
|
222
|
+
destURL = `${dest}`
|
|
223
|
+
} else {
|
|
224
|
+
return proxyToExternalUrl({ req, res, dest, destURL })
|
|
225
|
+
}
|
|
221
226
|
}
|
|
222
227
|
|
|
223
228
|
if (isRedirect(match)) {
|
|
229
|
+
console.log(`${NETLIFYDEVLOG} Redirecting ${req.url} to ${destURL}`)
|
|
224
230
|
res.writeHead(match.status, {
|
|
225
231
|
Location: destURL,
|
|
226
232
|
'Cache-Control': 'no-cache',
|
|
227
233
|
})
|
|
228
234
|
res.end(`Redirecting to ${destURL}`)
|
|
235
|
+
|
|
229
236
|
return
|
|
230
237
|
}
|
|
231
238
|
|