netlify-cli 13.2.2 → 14.0.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/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "13.2.2",
4
+ "version": "14.0.0",
5
5
  "author": "Netlify Inc.",
6
6
  "type": "module",
7
7
  "engines": {
8
- "node": "^14.16.0 || >=16.0.0"
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
- "certs": "openssl req -x509 -out localhost.crt -keyout localhost.key -newkey rsa:2048 -nodes -sha256 -subj \"/CN=localhost\" -extensions EXT -config certconf"
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.8.0",
46
+ "@netlify/build": "^29.9.2",
80
47
  "@netlify/config": "^20.3.7",
81
- "@netlify/edge-bundler": "^8.13.0",
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.9.0",
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",
@@ -150,15 +117,15 @@
150
117
  "netlify-redirect-parser": "^14.1.2",
151
118
  "netlify-redirector": "^0.4.0",
152
119
  "node-fetch": "^2.6.0",
153
- "node-version-alias": "^2.0.0",
120
+ "node-version-alias": "^3.0.0",
154
121
  "ora": "^6.0.0",
155
122
  "p-filter": "^3.0.0",
156
123
  "p-map": "^5.0.0",
157
- "p-wait-for": "^3.0.0",
124
+ "p-wait-for": "^5.0.0",
158
125
  "parallel-transform": "^1.2.0",
159
126
  "parse-github-url": "^1.0.2",
160
127
  "parse-gitignore": "^2.0.0",
161
- "path-key": "^3.1.1",
128
+ "path-key": "^4.0.0",
162
129
  "prettyjson": "^1.2.1",
163
130
  "pump": "^3.0.0",
164
131
  "raw-body": "^2.4.1",
@@ -169,7 +136,7 @@
169
136
  "strip-ansi-control-characters": "^2.0.0",
170
137
  "tabtab": "^3.0.2",
171
138
  "tempy": "^3.0.0",
172
- "terminal-link": "^2.1.1",
139
+ "terminal-link": "^3.0.0",
173
140
  "through2-filter": "^3.0.0",
174
141
  "through2-map": "^3.0.0",
175
142
  "to-readable-stream": "^2.1.0",
@@ -180,46 +147,6 @@
180
147
  "uuid": "^9.0.0",
181
148
  "wait-port": "^1.0.1",
182
149
  "winston": "^3.2.1",
183
- "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"
150
+ "write-file-atomic": "^5.0.0"
224
151
  }
225
- }
152
+ }
@@ -1,6 +1,6 @@
1
1
  import execa from 'execa'
2
2
 
3
- import { injectEnvVariables } from '../../utils/dev.mjs'
3
+ import { getDotEnvVariables, injectEnvVariables } from '../../utils/dev.mjs'
4
4
  import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs'
5
5
 
6
6
  /**
@@ -16,7 +16,8 @@ const devExec = async (cmd, options, command) => {
16
16
  env = await getEnvelopeEnv({ api, context: options.context, env, siteInfo })
17
17
  }
18
18
 
19
- await injectEnvVariables({ devConfig: { ...config.dev }, env, site })
19
+ env = await getDotEnvVariables({ devConfig: { ...config.dev }, env, site })
20
+ injectEnvVariables(env)
20
21
 
21
22
  await execa(cmd, command.args.slice(1), {
22
23
  stdio: 'inherit',
@@ -18,13 +18,14 @@ import {
18
18
  normalizeConfig,
19
19
  } from '../../utils/command-helpers.mjs'
20
20
  import detectServerSettings, { getConfigWithPlugins } from '../../utils/detect-server-settings.mjs'
21
- import { getSiteInformation, injectEnvVariables } from '../../utils/dev.mjs'
21
+ import { getDotEnvVariables, getSiteInformation, injectEnvVariables } from '../../utils/dev.mjs'
22
22
  import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs'
23
23
  import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs'
24
24
  import { startNetlifyGraph, startPollingForAPIAuthentication } from '../../utils/graph.mjs'
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
 
@@ -95,7 +96,8 @@ const dev = async (options, command) => {
95
96
  log(`${NETLIFYDEVLOG} Injecting environment variable values for ${chalk.yellow('all scopes')}`)
96
97
  }
97
98
 
98
- await injectEnvVariables({ devConfig, env, site })
99
+ env = await getDotEnvVariables({ devConfig, env, site })
100
+ injectEnvVariables(env)
99
101
  await promptEditorHelper({ chalk, config, log, NETLIFYDEVLOG, repositoryRoot, state })
100
102
 
101
103
  const { addonsUrls, capabilities, siteUrl, timeouts } = await getSiteInformation({
@@ -124,9 +126,23 @@ const dev = async (options, command) => {
124
126
  startPollingForAPIAuthentication({ api, command, config, site, siteInfo })
125
127
  }
126
128
 
129
+ const liveTunnelUrl = await handleLiveTunnel({ options, site, api, settings })
130
+ const url = liveTunnelUrl || getProxyUrl(settings)
131
+ process.env.URL = url
132
+ process.env.DEPLOY_URL = url
133
+
127
134
  log(`${NETLIFYDEVWARN} Setting up local development server`)
128
135
 
129
- const { configPath: configPathOverride } = await runDevTimeline({ cachedConfig, options, settings, site })
136
+ const { configPath: configPathOverride } = await runDevTimeline({
137
+ cachedConfig,
138
+ options,
139
+ settings,
140
+ site,
141
+ env: {
142
+ URL: url,
143
+ DEPLOY_URL: url,
144
+ },
145
+ })
130
146
 
131
147
  await startFunctionsServer({
132
148
  api,
@@ -159,7 +175,7 @@ const dev = async (options, command) => {
159
175
 
160
176
  const inspectSettings = generateInspectSettings(options.edgeInspect, options.edgeInspectBrk)
161
177
 
162
- let url = await startProxyServer({
178
+ await startProxyServer({
163
179
  addonsUrls,
164
180
  config,
165
181
  configPath: configPathOverride,
@@ -176,16 +192,10 @@ const dev = async (options, command) => {
176
192
  state,
177
193
  })
178
194
 
179
- const liveTunnelUrl = await handleLiveTunnel({ options, site, api, settings })
180
- url = liveTunnelUrl || url
181
-
182
195
  if (devConfig.autoLaunch !== false) {
183
196
  await openBrowser({ url, silentBrowserNoneError: true })
184
197
  }
185
198
 
186
- process.env.URL = url
187
- process.env.DEPLOY_URL = url
188
-
189
199
  await startNetlifyGraph({
190
200
  command,
191
201
  config,
@@ -19,7 +19,7 @@ import ora from 'ora'
19
19
  import { fileExistsAsync } from '../../lib/fs.mjs'
20
20
  import { getAddons, getCurrentAddon, getSiteData } from '../../utils/addons/prepare.mjs'
21
21
  import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, error, log } from '../../utils/command-helpers.mjs'
22
- import { injectEnvVariables } from '../../utils/dev.mjs'
22
+ import { getDotEnvVariables, injectEnvVariables } from '../../utils/dev.mjs'
23
23
  import execa from '../../utils/execa.mjs'
24
24
  import { readRepoURL, validateRepoURL } from '../../utils/read-repo-url.mjs'
25
25
 
@@ -549,11 +549,12 @@ const handleOnComplete = async ({ command, onComplete }) => {
549
549
  const { config } = command.netlify
550
550
 
551
551
  if (onComplete) {
552
- await injectEnvVariables({
552
+ const env = await getDotEnvVariables({
553
553
  devConfig: { ...config.dev },
554
554
  env: command.netlify.cachedConfig.env,
555
555
  site: command.netlify.site,
556
556
  })
557
+ injectEnvVariables(env)
557
558
  await onComplete.call(command)
558
559
  }
559
560
  }
@@ -2,7 +2,7 @@
2
2
  import { join } from 'path'
3
3
 
4
4
  import { startFunctionsServer } from '../../lib/functions/server.mjs'
5
- import { acquirePort, getSiteInformation, injectEnvVariables } from '../../utils/dev.mjs'
5
+ import { acquirePort, getDotEnvVariables, getSiteInformation, injectEnvVariables } from '../../utils/dev.mjs'
6
6
  import { getFunctionsDir } from '../../utils/functions/index.mjs'
7
7
 
8
8
  const DEFAULT_PORT = 9999
@@ -16,11 +16,12 @@ const functionsServe = async (options, command) => {
16
16
  const { api, config, site, siteInfo } = command.netlify
17
17
 
18
18
  const functionsDir = getFunctionsDir({ options, config }, join('netlify', 'functions'))
19
- const { env } = command.netlify.cachedConfig
19
+ let { env } = command.netlify.cachedConfig
20
20
 
21
21
  env.NETLIFY_DEV = { sources: ['internal'], value: 'true' }
22
22
 
23
- await injectEnvVariables({ devConfig: { ...config.dev }, env, site })
23
+ env = await getDotEnvVariables({ devConfig: { ...config.dev }, env, site })
24
+ injectEnvVariables(env)
24
25
 
25
26
  const { capabilities, siteUrl, timeouts } = await getSiteInformation({
26
27
  offline: options.offline,
@@ -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 --name function-abc --timeout 30s',
42
+ 'netlify functions:build --functions build/to/directory --src source/directory',
43
43
  ])
44
44
  .action(functions)
45
45
  }
@@ -16,7 +16,7 @@ import {
16
16
  normalizeConfig,
17
17
  } from '../../utils/command-helpers.mjs'
18
18
  import detectServerSettings, { getConfigWithPlugins } from '../../utils/detect-server-settings.mjs'
19
- import { getSiteInformation, injectEnvVariables } from '../../utils/dev.mjs'
19
+ import { getDotEnvVariables, getSiteInformation, injectEnvVariables } from '../../utils/dev.mjs'
20
20
  import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs'
21
21
  import { getInternalFunctionsDir } from '../../utils/functions/functions.mjs'
22
22
  import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs'
@@ -52,7 +52,8 @@ const serve = async (options, command) => {
52
52
  log(`${NETLIFYDEVLOG} Injecting environment variable values for ${chalk.yellow('all scopes')}`)
53
53
  }
54
54
 
55
- await injectEnvVariables({ devConfig, env, site })
55
+ env = await getDotEnvVariables({ devConfig, env, site })
56
+ injectEnvVariables(env)
56
57
  await promptEditorHelper({ chalk, config, log, NETLIFYDEVLOG, repositoryRoot, state })
57
58
 
58
59
  const { addonsUrls, capabilities, siteUrl, timeouts } = await getSiteInformation({
@@ -42,8 +42,10 @@ const waitForBuildFinish = async function (api, siteId, spinner) {
42
42
 
43
43
  await pWaitFor(waitForBuildToFinish, {
44
44
  interval: BUILD_FINISH_INTERVAL,
45
- timeout: BUILD_FINISH_TIMEOUT,
46
- message: 'Timeout while waiting for deploy to finish',
45
+ timeout: {
46
+ milliseconds: BUILD_FINISH_TIMEOUT,
47
+ message: 'Timeout while waiting for deploy to finish',
48
+ },
47
49
  })
48
50
 
49
51
  // return only when build done or timeout happens
@@ -7,7 +7,7 @@
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "engines": {
10
- "node": "^14.16.0 || >=16.0.0"
10
+ "node": "^14.18.0 || >=16.0.0"
11
11
  },
12
12
  "keywords": [
13
13
  "netlify",
@@ -19,9 +19,9 @@
19
19
  "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
20
20
  },
21
21
  "node_modules/axios": {
22
- "version": "1.3.4",
23
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz",
24
- "integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==",
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.4",
202
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz",
203
- "integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==",
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.40",
30
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.40.tgz",
31
- "integrity": "sha512-pGteXO/JQX7wPxGR8lyT+doqjMa7XvlVowwrDwLfX92k5SdLkk4cwC7CYSLBxrenw/R5oQwKioVIak7ZgplM3g=="
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.40",
62
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.40.tgz",
63
- "integrity": "sha512-pGteXO/JQX7wPxGR8lyT+doqjMa7XvlVowwrDwLfX92k5SdLkk4cwC7CYSLBxrenw/R5oQwKioVIak7ZgplM3g=="
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://6419767d9dc968000848742a--edge.netlify.com/bootstrap/index-combined.ts'
3
+ const latestBootstrapURL = 'https://643581608391e3000851cc94--edge.netlify.com/bootstrap/index-combined.ts'
4
4
 
5
5
  export const getBootstrapURL = () => env.NETLIFY_EDGE_BOOTSTRAP || latestBootstrapURL
@@ -79,11 +79,12 @@ export const initializeProxy = async ({
79
79
  const server = prepareServer({
80
80
  config,
81
81
  configPath,
82
- directories: [internalFunctionsPath, userFunctionsPath].filter(Boolean),
82
+ directory: userFunctionsPath,
83
83
  env: configEnv,
84
84
  getUpdatedConfig,
85
85
  importMaps: [importMap].filter(Boolean),
86
86
  inspectSettings,
87
+ internalDirectory: internalFunctionsPath,
87
88
  internalFunctions,
88
89
  port: isolatePort,
89
90
  projectDir,
@@ -153,11 +154,12 @@ export const isEdgeFunctionsRequest = (req) => req[headersSymbol] !== undefined
153
154
  const prepareServer = async ({
154
155
  config,
155
156
  configPath,
156
- directories,
157
+ directory,
157
158
  env: configEnv,
158
159
  getUpdatedConfig,
159
160
  importMaps,
160
161
  inspectSettings,
162
+ internalDirectory,
161
163
  internalFunctions,
162
164
  port,
163
165
  projectDir,
@@ -187,9 +189,10 @@ const prepareServer = async ({
187
189
  bundler,
188
190
  config,
189
191
  configPath,
190
- directories,
192
+ directories: [directory].filter(Boolean),
191
193
  env: configEnv,
192
194
  getUpdatedConfig,
195
+ internalDirectories: [internalDirectory].filter(Boolean),
193
196
  internalFunctions,
194
197
  projectDir,
195
198
  runIsolate,