netlify-cli 13.2.2 → 14.0.0-rc
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 +14805 -30330
- package/package.json +7 -80
- package/src/commands/dev/dev.mjs +17 -8
- package/src/commands/functions/functions.mjs +1 -1
- package/src/functions-templates/javascript/google-analytics/package.json +1 -1
- package/src/functions-templates/javascript/token-hider/package-lock.json +6 -6
- package/src/functions-templates/typescript/hello-world/package-lock.json +6 -6
- package/src/lib/edge-functions/bootstrap.mjs +1 -1
- package/src/lib/functions/registry.mjs +4 -1
- package/src/lib/functions/server.mjs +2 -2
- package/src/utils/proxy.mjs +6 -2
- package/src/utils/run-build.mjs +2 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "14.0.0-rc",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "^14.
|
|
8
|
+
"node": "^14.18.0 || >=16.0.0"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"/bin",
|
|
@@ -38,50 +38,17 @@
|
|
|
38
38
|
"url": "https://github.com/netlify/cli/issues"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
|
-
"prepare": "husky install node_modules/@netlify/eslint-config-node/.husky/",
|
|
42
|
-
"start": "node ./bin/run.mjs",
|
|
43
|
-
"test": "run-s format test:dev",
|
|
44
|
-
"format": "run-s format:check-fix:*",
|
|
45
|
-
"format:ci": "run-s format:check:*",
|
|
46
|
-
"format:check-fix:lint": "run-e format:check:lint format:fix:lint",
|
|
47
|
-
"format:check:lint": "cross-env-shell eslint $npm_package_config_eslint",
|
|
48
|
-
"format:fix:lint": "cross-env-shell eslint --fix $npm_package_config_eslint",
|
|
49
|
-
"format:check-fix:prettier": "run-e format:check:prettier format:fix:prettier",
|
|
50
|
-
"format:check:prettier": "cross-env-shell prettier --check $npm_package_config_prettier",
|
|
51
|
-
"format:fix:prettier": "cross-env-shell prettier --write $npm_package_config_prettier",
|
|
52
|
-
"test:dev": "run-s certs test:init:* test:dev:*",
|
|
53
|
-
"test:init": "run-s test:init:*",
|
|
54
|
-
"test:init:cli-version": "npm run start -- --version",
|
|
55
|
-
"test:init:cli-help": "npm run start -- --help",
|
|
56
|
-
"test:init:eleventy-deps": "npm ci --prefix tests/integration/eleventy-site --no-audit",
|
|
57
|
-
"test:init:hugo-deps": "npm ci --prefix tests/integration/hugo-site --no-audit",
|
|
58
|
-
"test:dev:ava": "ava --verbose",
|
|
59
|
-
"test:dev:vitest": "vitest run tests/unit/ && vitest run tests/integration",
|
|
60
|
-
"test:ci:ava:integration": "c8 -r json ava --concurrency 1 --no-worker-threads tests/integration/",
|
|
61
|
-
"test:ci:vitest:unit": "vitest run --coverage tests/unit/",
|
|
62
|
-
"test:ci:vitest:integration": "vitest run --coverage tests/integration/",
|
|
63
|
-
"test:affected": "node ./tools/affected-test.mjs",
|
|
64
|
-
"e2e": "node ./tools/e2e/run.mjs",
|
|
65
|
-
"docs": "node ./site/scripts/docs.mjs",
|
|
66
|
-
"watch": "c8 --reporter=lcov ava --watch",
|
|
67
|
-
"site:build": "run-s site:build:*",
|
|
68
|
-
"site:build:install": "cd site && npm ci --no-audit",
|
|
69
|
-
"site:build:assets": "cd site && npm run build",
|
|
70
41
|
"postinstall": "node ./scripts/postinstall.mjs",
|
|
71
|
-
"
|
|
72
|
-
},
|
|
73
|
-
"config": {
|
|
74
|
-
"eslint": "--cache --format=codeframe --max-warnings=0 \"{src,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,html}\" \"*.{mjs,cjs,js,md,html}\" \".*.{mjs,cjs,js,md,html}\"",
|
|
75
|
-
"prettier": "--ignore-path .eslintignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!**/*/package-lock.json\" \"!.github/**/*.md\""
|
|
42
|
+
"prepublishOnly": "node ./scripts/prepare-for-publish.mjs"
|
|
76
43
|
},
|
|
77
44
|
"dependencies": {
|
|
78
45
|
"@fastify/static": "^6.6.0",
|
|
79
|
-
"@netlify/build": "^29.
|
|
46
|
+
"@netlify/build": "^29.9.2",
|
|
80
47
|
"@netlify/config": "^20.3.7",
|
|
81
|
-
"@netlify/edge-bundler": "^8.13.
|
|
48
|
+
"@netlify/edge-bundler": "^8.13.2",
|
|
82
49
|
"@netlify/framework-info": "^9.8.5",
|
|
83
50
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
84
|
-
"@netlify/zip-it-and-ship-it": "^8.
|
|
51
|
+
"@netlify/zip-it-and-ship-it": "^8.10.0",
|
|
85
52
|
"@octokit/rest": "^19.0.0",
|
|
86
53
|
"ansi-escapes": "^6.0.0",
|
|
87
54
|
"ansi-styles": "^5.0.0",
|
|
@@ -181,45 +148,5 @@
|
|
|
181
148
|
"wait-port": "^1.0.1",
|
|
182
149
|
"winston": "^3.2.1",
|
|
183
150
|
"write-file-atomic": "^4.0.0"
|
|
184
|
-
},
|
|
185
|
-
"devDependencies": {
|
|
186
|
-
"@babel/preset-react": "^7.12.13",
|
|
187
|
-
"@netlify/eslint-config-node": "^7.0.0",
|
|
188
|
-
"@vitest/coverage-c8": "^0.29.7",
|
|
189
|
-
"ava": "^4.0.0",
|
|
190
|
-
"c8": "^7.11.0",
|
|
191
|
-
"cpy": "^9.0.1",
|
|
192
|
-
"eslint-plugin-sort-destructure-keys": "^1.3.5",
|
|
193
|
-
"fast-glob": "^3.2.7",
|
|
194
|
-
"form-data": "^4.0.0",
|
|
195
|
-
"got": "^11.8.6",
|
|
196
|
-
"graphviz": "^0.0.9",
|
|
197
|
-
"husky": "^8.0.0",
|
|
198
|
-
"ini": "^2.0.0",
|
|
199
|
-
"mock-fs": "^5.1.2",
|
|
200
|
-
"nock": "^13.2.4",
|
|
201
|
-
"p-timeout": "^4.0.0",
|
|
202
|
-
"rewiremock": "^3.14.3",
|
|
203
|
-
"serialize-javascript": "^6.0.0",
|
|
204
|
-
"sinon": "^14.0.0",
|
|
205
|
-
"strip-ansi": "^7.0.0",
|
|
206
|
-
"temp-dir": "^2.0.0",
|
|
207
|
-
"tomlify-j0.4": "^3.0.0",
|
|
208
|
-
"tree-kill": "^1.2.2",
|
|
209
|
-
"typescript": "^4.4.4",
|
|
210
|
-
"verdaccio": "^5.22.1",
|
|
211
|
-
"vitest": "^0.29.7"
|
|
212
|
-
},
|
|
213
|
-
"ava": {
|
|
214
|
-
"files": [
|
|
215
|
-
"tools/**/*.test.mjs",
|
|
216
|
-
"tests/**/*.test.cjs"
|
|
217
|
-
],
|
|
218
|
-
"cache": true,
|
|
219
|
-
"concurrency": 5,
|
|
220
|
-
"failFast": false,
|
|
221
|
-
"failWithoutAssertions": false,
|
|
222
|
-
"tap": false,
|
|
223
|
-
"timeout": "5m"
|
|
224
151
|
}
|
|
225
|
-
}
|
|
152
|
+
}
|
package/src/commands/dev/dev.mjs
CHANGED
|
@@ -25,6 +25,7 @@ import { startNetlifyGraph, startPollingForAPIAuthentication } from '../../utils
|
|
|
25
25
|
import { startLiveTunnel } from '../../utils/live-tunnel.mjs'
|
|
26
26
|
import openBrowser from '../../utils/open-browser.mjs'
|
|
27
27
|
import { generateInspectSettings, startProxyServer } from '../../utils/proxy-server.mjs'
|
|
28
|
+
import { getProxyUrl } from '../../utils/proxy.mjs'
|
|
28
29
|
import { runDevTimeline } from '../../utils/run-build.mjs'
|
|
29
30
|
import { getGeoCountryArgParser } from '../../utils/validation.mjs'
|
|
30
31
|
|
|
@@ -124,9 +125,23 @@ const dev = async (options, command) => {
|
|
|
124
125
|
startPollingForAPIAuthentication({ api, command, config, site, siteInfo })
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
const liveTunnelUrl = await handleLiveTunnel({ options, site, api, settings })
|
|
129
|
+
const url = liveTunnelUrl || getProxyUrl(settings)
|
|
130
|
+
process.env.URL = url
|
|
131
|
+
process.env.DEPLOY_URL = url
|
|
132
|
+
|
|
127
133
|
log(`${NETLIFYDEVWARN} Setting up local development server`)
|
|
128
134
|
|
|
129
|
-
const { configPath: configPathOverride } = await runDevTimeline({
|
|
135
|
+
const { configPath: configPathOverride } = await runDevTimeline({
|
|
136
|
+
cachedConfig,
|
|
137
|
+
options,
|
|
138
|
+
settings,
|
|
139
|
+
site,
|
|
140
|
+
env: {
|
|
141
|
+
URL: url,
|
|
142
|
+
DEPLOY_URL: url,
|
|
143
|
+
},
|
|
144
|
+
})
|
|
130
145
|
|
|
131
146
|
await startFunctionsServer({
|
|
132
147
|
api,
|
|
@@ -159,7 +174,7 @@ const dev = async (options, command) => {
|
|
|
159
174
|
|
|
160
175
|
const inspectSettings = generateInspectSettings(options.edgeInspect, options.edgeInspectBrk)
|
|
161
176
|
|
|
162
|
-
|
|
177
|
+
await startProxyServer({
|
|
163
178
|
addonsUrls,
|
|
164
179
|
config,
|
|
165
180
|
configPath: configPathOverride,
|
|
@@ -176,16 +191,10 @@ const dev = async (options, command) => {
|
|
|
176
191
|
state,
|
|
177
192
|
})
|
|
178
193
|
|
|
179
|
-
const liveTunnelUrl = await handleLiveTunnel({ options, site, api, settings })
|
|
180
|
-
url = liveTunnelUrl || url
|
|
181
|
-
|
|
182
194
|
if (devConfig.autoLaunch !== false) {
|
|
183
195
|
await openBrowser({ url, silentBrowserNoneError: true })
|
|
184
196
|
}
|
|
185
197
|
|
|
186
|
-
process.env.URL = url
|
|
187
|
-
process.env.DEPLOY_URL = url
|
|
188
|
-
|
|
189
198
|
await startNetlifyGraph({
|
|
190
199
|
command,
|
|
191
200
|
config,
|
|
@@ -39,7 +39,7 @@ The ${name} command will help you manage the functions in this site`,
|
|
|
39
39
|
)
|
|
40
40
|
.addExamples([
|
|
41
41
|
'netlify functions:create --name function-xyz',
|
|
42
|
-
'netlify functions:build --
|
|
42
|
+
'netlify functions:build --functions build/to/directory --src source/directory',
|
|
43
43
|
])
|
|
44
44
|
.action(functions)
|
|
45
45
|
}
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
|
20
20
|
},
|
|
21
21
|
"node_modules/axios": {
|
|
22
|
-
"version": "1.3.
|
|
23
|
-
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.
|
|
24
|
-
"integrity": "sha512-
|
|
22
|
+
"version": "1.3.5",
|
|
23
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.5.tgz",
|
|
24
|
+
"integrity": "sha512-glL/PvG/E+xCWwV8S6nCHcrfg1exGx7vxyUIivIA1iL7BIh6bePylCfVHwp6k13ao7SATxB6imau2kqY+I67kw==",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"follow-redirects": "^1.15.0",
|
|
27
27
|
"form-data": "^4.0.0",
|
|
@@ -198,9 +198,9 @@
|
|
|
198
198
|
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
|
199
199
|
},
|
|
200
200
|
"axios": {
|
|
201
|
-
"version": "1.3.
|
|
202
|
-
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.
|
|
203
|
-
"integrity": "sha512-
|
|
201
|
+
"version": "1.3.5",
|
|
202
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.3.5.tgz",
|
|
203
|
+
"integrity": "sha512-glL/PvG/E+xCWwV8S6nCHcrfg1exGx7vxyUIivIA1iL7BIh6bePylCfVHwp6k13ao7SATxB6imau2kqY+I67kw==",
|
|
204
204
|
"requires": {
|
|
205
205
|
"follow-redirects": "^1.15.0",
|
|
206
206
|
"form-data": "^4.0.0",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"node_modules/@types/node": {
|
|
29
|
-
"version": "14.18.
|
|
30
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.
|
|
31
|
-
"integrity": "sha512-
|
|
29
|
+
"version": "14.18.42",
|
|
30
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.42.tgz",
|
|
31
|
+
"integrity": "sha512-xefu+RBie4xWlK8hwAzGh3npDz/4VhF6icY/shU+zv/1fNn+ZVG7T7CRwe9LId9sAYRPxI+59QBPuKL3WpyGRg=="
|
|
32
32
|
},
|
|
33
33
|
"node_modules/is-promise": {
|
|
34
34
|
"version": "4.0.0",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"@types/node": {
|
|
61
|
-
"version": "14.18.
|
|
62
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.
|
|
63
|
-
"integrity": "sha512-
|
|
61
|
+
"version": "14.18.42",
|
|
62
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.42.tgz",
|
|
63
|
+
"integrity": "sha512-xefu+RBie4xWlK8hwAzGh3npDz/4VhF6icY/shU+zv/1fNn+ZVG7T7CRwe9LId9sAYRPxI+59QBPuKL3WpyGRg=="
|
|
64
64
|
},
|
|
65
65
|
"is-promise": {
|
|
66
66
|
"version": "4.0.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { env } from 'process'
|
|
2
2
|
|
|
3
|
-
const latestBootstrapURL = 'https://
|
|
3
|
+
const latestBootstrapURL = 'https://643581608391e3000851cc94--edge.netlify.com/bootstrap/index-combined.ts'
|
|
4
4
|
|
|
5
5
|
export const getBootstrapURL = () => env.NETLIFY_EDGE_BOOTSTRAP || latestBootstrapURL
|
|
@@ -212,7 +212,10 @@ export class FunctionsRegistry {
|
|
|
212
212
|
await Promise.all(deletedFunctions.map((func) => this.unregisterFunction(func.name)))
|
|
213
213
|
|
|
214
214
|
await Promise.all(
|
|
215
|
-
|
|
215
|
+
// zip-it-and-ship-it returns an array sorted based on which extension should have precedence,
|
|
216
|
+
// where the last ones precede the previous ones. This is why
|
|
217
|
+
// we reverse the array so we get the right functions precedence in the CLI.
|
|
218
|
+
functions.reverse().map(async ({ displayName, mainFile, name, runtime: runtimeName }) => {
|
|
216
219
|
const runtime = runtimes[runtimeName]
|
|
217
220
|
|
|
218
221
|
// If there is no matching runtime, it means this function is not yet
|
|
@@ -222,9 +222,9 @@ export const startFunctionsServer = async (options) => {
|
|
|
222
222
|
functionsDirectories.push(distPath)
|
|
223
223
|
}
|
|
224
224
|
} else {
|
|
225
|
-
// The order of the function directories matters.
|
|
225
|
+
// The order of the function directories matters. Rightmost directories take
|
|
226
226
|
// precedence.
|
|
227
|
-
const sourceDirectories = [settings.functions
|
|
227
|
+
const sourceDirectories = [internalFunctionsDir, settings.functions].filter(Boolean)
|
|
228
228
|
|
|
229
229
|
functionsDirectories.push(...sourceDirectories)
|
|
230
230
|
}
|
package/src/utils/proxy.mjs
CHANGED
|
@@ -575,6 +575,11 @@ const onRequest = async (
|
|
|
575
575
|
proxy.web(req, res, options)
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
+
export const getProxyUrl = function (settings) {
|
|
579
|
+
const scheme = settings.https ? 'https' : 'http'
|
|
580
|
+
return `${scheme}://localhost:${settings.port}`
|
|
581
|
+
}
|
|
582
|
+
|
|
578
583
|
export const startProxy = async function ({
|
|
579
584
|
addonsUrls,
|
|
580
585
|
config,
|
|
@@ -665,8 +670,7 @@ export const startProxy = async function ({
|
|
|
665
670
|
|
|
666
671
|
await Promise.all(eventQueue)
|
|
667
672
|
|
|
668
|
-
|
|
669
|
-
return `${scheme}://localhost:${settings.port}`
|
|
673
|
+
return getProxyUrl(settings)
|
|
670
674
|
}
|
|
671
675
|
|
|
672
676
|
const BYTES_LIMIT = 30
|
package/src/utils/run-build.mjs
CHANGED
|
@@ -56,7 +56,7 @@ const getBuildOptions = ({
|
|
|
56
56
|
saveConfig,
|
|
57
57
|
})
|
|
58
58
|
|
|
59
|
-
const runNetlifyBuild = async ({ cachedConfig, options, settings, site, timeline = 'build' }) => {
|
|
59
|
+
const runNetlifyBuild = async ({ cachedConfig, env, options, settings, site, timeline = 'build' }) => {
|
|
60
60
|
const { default: buildSite, startDev } = await netlifyBuildPromise
|
|
61
61
|
const sharedOptions = getBuildOptions({
|
|
62
62
|
cachedConfig,
|
|
@@ -112,6 +112,7 @@ const runNetlifyBuild = async ({ cachedConfig, options, settings, site, timeline
|
|
|
112
112
|
// Set `quiet` to suppress non-essential output from Netlify Build unless
|
|
113
113
|
// the `debug` flag is set.
|
|
114
114
|
quiet: !options.debug,
|
|
115
|
+
env,
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
// Run Netlify Build using the `startDev` entry point.
|