netlify-cli 8.7.0 → 8.9.2

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,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "8.7.0",
4
+ "version": "8.9.2",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
@@ -42,6 +42,7 @@
42
42
  "url": "https://github.com/netlify/cli/issues"
43
43
  },
44
44
  "scripts": {
45
+ "prepare": "husky install node_modules/@netlify/eslint-config-node/.husky/",
45
46
  "prepublishOnly": "run-s prepublishOnly:*",
46
47
  "prepublishOnly:test": "run-local \"npm test\"",
47
48
  "start": "node ./bin/run",
@@ -66,8 +67,6 @@
66
67
  "test:affected": "node ./tools/affected-test.js",
67
68
  "docs": "node ./site/scripts/docs.js",
68
69
  "watch": "c8 --reporter=lcov ava --watch",
69
- "prepack": "npm prune --prod",
70
- "postpack": "npm i",
71
70
  "site:build": "run-s site:build:*",
72
71
  "site:build:install": "cd site && npm ci --no-audit",
73
72
  "site:build:assets": "cd site && npm run build",
@@ -78,14 +77,14 @@
78
77
  "prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{js,md,yml,json,html}\" \"*.{js,yml,json,html}\" \".*.{js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!.github/**/*.md\""
79
78
  },
80
79
  "dependencies": {
81
- "@netlify/build": "^26.1.1",
80
+ "@netlify/build": "^26.1.3",
82
81
  "@netlify/config": "^17.0.3",
83
- "@netlify/framework-info": "^8.0.0",
82
+ "@netlify/framework-info": "^8.0.2",
84
83
  "@netlify/local-functions-proxy": "^1.1.1",
85
- "@netlify/plugin-edge-handlers": "^3.0.2",
84
+ "@netlify/plugin-edge-handlers": "^3.0.3",
86
85
  "@netlify/plugins-list": "^6.2.1",
87
86
  "@netlify/routing-local-proxy": "^0.34.1",
88
- "@netlify/zip-it-and-ship-it": "5.4.0",
87
+ "@netlify/zip-it-and-ship-it": "^5.4.0",
89
88
  "@octokit/rest": "^18.0.0",
90
89
  "@sindresorhus/slugify": "^1.1.0",
91
90
  "ansi-escapes": "^5.0.0",
@@ -135,7 +134,7 @@
135
134
  "is-wsl": "^2.2.0",
136
135
  "isexe": "^2.0.0",
137
136
  "jwt-decode": "^3.0.0",
138
- "lambda-local": "^2.0.0",
137
+ "lambda-local": "2.0.0",
139
138
  "listr": "^0.14.3",
140
139
  "locate-path": "^6.0.0",
141
140
  "lodash": "^4.17.20",
@@ -184,9 +183,7 @@
184
183
  },
185
184
  "devDependencies": {
186
185
  "@babel/preset-react": "^7.12.13",
187
- "@commitlint/cli": "^16.0.0",
188
- "@commitlint/config-conventional": "^16.0.0",
189
- "@netlify/eslint-config-node": "^4.1.2",
186
+ "@netlify/eslint-config-node": "^4.1.3",
190
187
  "ava": "^3.15.0",
191
188
  "c8": "^7.11.0",
192
189
  "eslint-plugin-sort-destructure-keys": "^1.3.5",
@@ -194,6 +191,7 @@
194
191
  "form-data": "^4.0.0",
195
192
  "got": "^11.8.1",
196
193
  "graphviz": "^0.0.9",
194
+ "husky": "^7.0.4",
197
195
  "ini": "^2.0.0",
198
196
  "jsonwebtoken": "^8.5.1",
199
197
  "mock-fs": "^5.1.2",
@@ -223,11 +221,5 @@
223
221
  "failWithoutAssertions": false,
224
222
  "tap": false,
225
223
  "timeout": "5m"
226
- },
227
- "husky": {
228
- "hooks": {
229
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
230
- "pre-push": "npm run format"
231
- }
232
224
  }
233
225
  }
@@ -455,6 +455,10 @@ const deploy = async (options, command) => {
455
455
  warn('--branch flag has been renamed to --alias and will be removed in future versions')
456
456
  }
457
457
 
458
+ if (options.context && !options.build) {
459
+ return error('--context flag is only available when using the --build flag')
460
+ }
461
+
458
462
  await command.authenticate(options.auth)
459
463
 
460
464
  let siteId = options.site || site.id
@@ -670,6 +674,7 @@ Support for package.json's main field, and intrinsic index.js entrypoints are co
670
674
  .option('--timeout <number>', 'Timeout to wait for deployment to finish', (value) => Number.parseInt(value))
671
675
  .option('--trigger', 'Trigger a new build of your site on Netlify without uploading local files')
672
676
  .option('--build', 'Run build command before deploying')
677
+ .option('--context <context>', 'Context to use when resolving build configuration')
673
678
  .option(
674
679
  '--skip-functions-cache',
675
680
  'Ignore any functions created as part of a previous `build` or `deploy` commands, forcing them to be bundled again as part of the deployment',
@@ -683,6 +688,7 @@ Support for package.json's main field, and intrinsic index.js entrypoints are co
683
688
  'netlify deploy --message "A message with an $ENV_VAR"',
684
689
  'netlify deploy --auth $NETLIFY_AUTH_TOKEN',
685
690
  'netlify deploy --trigger',
691
+ 'netlify deploy --build --context deploy-preview',
686
692
  ])
687
693
  .action(deploy)
688
694
 
@@ -9,18 +9,26 @@
9
9
  "version": "1.0.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "node-fetch": "^2.3.0"
12
+ "node-fetch": "^2.6.7"
13
13
  }
14
14
  },
15
15
  "node_modules/node-fetch": {
16
- "version": "2.6.6",
17
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
18
- "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
16
+ "version": "2.6.7",
17
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
18
+ "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
19
19
  "dependencies": {
20
20
  "whatwg-url": "^5.0.0"
21
21
  },
22
22
  "engines": {
23
23
  "node": "4.x || >=6.0.0"
24
+ },
25
+ "peerDependencies": {
26
+ "encoding": "^0.1.0"
27
+ },
28
+ "peerDependenciesMeta": {
29
+ "encoding": {
30
+ "optional": true
31
+ }
24
32
  }
25
33
  },
26
34
  "node_modules/tr46": {
@@ -45,9 +53,9 @@
45
53
  },
46
54
  "dependencies": {
47
55
  "node-fetch": {
48
- "version": "2.6.6",
49
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
50
- "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
56
+ "version": "2.6.7",
57
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
58
+ "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
51
59
  "requires": {
52
60
  "whatwg-url": "^5.0.0"
53
61
  }
@@ -9,7 +9,7 @@
9
9
  "version": "1.0.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "node-fetch": "^2.6.1",
12
+ "node-fetch": "^2.6.7",
13
13
  "uuid": "^8.0.0"
14
14
  },
15
15
  "engines": {
@@ -17,14 +17,22 @@
17
17
  }
18
18
  },
19
19
  "node_modules/node-fetch": {
20
- "version": "2.6.6",
21
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
22
- "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
20
+ "version": "2.6.7",
21
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
22
+ "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
23
23
  "dependencies": {
24
24
  "whatwg-url": "^5.0.0"
25
25
  },
26
26
  "engines": {
27
27
  "node": "4.x || >=6.0.0"
28
+ },
29
+ "peerDependencies": {
30
+ "encoding": "^0.1.0"
31
+ },
32
+ "peerDependenciesMeta": {
33
+ "encoding": {
34
+ "optional": true
35
+ }
28
36
  }
29
37
  },
30
38
  "node_modules/tr46": {
@@ -57,9 +65,9 @@
57
65
  },
58
66
  "dependencies": {
59
67
  "node-fetch": {
60
- "version": "2.6.6",
61
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz",
62
- "integrity": "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==",
68
+ "version": "2.6.7",
69
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
70
+ "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
63
71
  "requires": {
64
72
  "whatwg-url": "^5.0.0"
65
73
  }
@@ -9,7 +9,7 @@
9
9
  "version": "1.0.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "stripe": "^8.119.0"
12
+ "stripe": "^8.197.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": "8.195.0",
109
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.195.0.tgz",
110
- "integrity": "sha512-pXEZFNJb4p9uZ69+B4A+zJEmBiFw3BzNG51ctPxUZij7ghFTnk2/RuUHmSGto2XVCcC46uG75czXVAvCUkOGtQ==",
108
+ "version": "8.197.0",
109
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.197.0.tgz",
110
+ "integrity": "sha512-EQLgqFiX1wNQEeve6QnUcGIby6XtXXzbzEWPJiZ68qFj02YFjNjLLxl9atueKgUQ+YRbrMAlrc6ECwvm+cf/Rw==",
111
111
  "dependencies": {
112
112
  "@types/node": ">=8.1.0",
113
113
  "qs": "^6.6.0"
@@ -184,9 +184,9 @@
184
184
  }
185
185
  },
186
186
  "stripe": {
187
- "version": "8.195.0",
188
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.195.0.tgz",
189
- "integrity": "sha512-pXEZFNJb4p9uZ69+B4A+zJEmBiFw3BzNG51ctPxUZij7ghFTnk2/RuUHmSGto2XVCcC46uG75czXVAvCUkOGtQ==",
187
+ "version": "8.197.0",
188
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.197.0.tgz",
189
+ "integrity": "sha512-EQLgqFiX1wNQEeve6QnUcGIby6XtXXzbzEWPJiZ68qFj02YFjNjLLxl9atueKgUQ+YRbrMAlrc6ECwvm+cf/Rw==",
190
190
  "requires": {
191
191
  "@types/node": ">=8.1.0",
192
192
  "qs": "^6.6.0"
@@ -9,7 +9,7 @@
9
9
  "version": "1.0.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "stripe": "^8.119.0"
12
+ "stripe": "^8.197.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": "8.195.0",
109
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.195.0.tgz",
110
- "integrity": "sha512-pXEZFNJb4p9uZ69+B4A+zJEmBiFw3BzNG51ctPxUZij7ghFTnk2/RuUHmSGto2XVCcC46uG75czXVAvCUkOGtQ==",
108
+ "version": "8.197.0",
109
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.197.0.tgz",
110
+ "integrity": "sha512-EQLgqFiX1wNQEeve6QnUcGIby6XtXXzbzEWPJiZ68qFj02YFjNjLLxl9atueKgUQ+YRbrMAlrc6ECwvm+cf/Rw==",
111
111
  "dependencies": {
112
112
  "@types/node": ">=8.1.0",
113
113
  "qs": "^6.6.0"
@@ -184,9 +184,9 @@
184
184
  }
185
185
  },
186
186
  "stripe": {
187
- "version": "8.195.0",
188
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.195.0.tgz",
189
- "integrity": "sha512-pXEZFNJb4p9uZ69+B4A+zJEmBiFw3BzNG51ctPxUZij7ghFTnk2/RuUHmSGto2XVCcC46uG75czXVAvCUkOGtQ==",
187
+ "version": "8.197.0",
188
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-8.197.0.tgz",
189
+ "integrity": "sha512-EQLgqFiX1wNQEeve6QnUcGIby6XtXXzbzEWPJiZ68qFj02YFjNjLLxl9atueKgUQ+YRbrMAlrc6ECwvm+cf/Rw==",
190
190
  "requires": {
191
191
  "@types/node": ">=8.1.0",
192
192
  "qs": "^6.6.0"
@@ -10,7 +10,7 @@
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "axios": "^0.24.0",
13
- "qs": "^6.7.0"
13
+ "qs": "^6.10.3"
14
14
  }
15
15
  },
16
16
  "node_modules/axios": {
@@ -101,9 +101,9 @@
101
101
  }
102
102
  },
103
103
  "node_modules/qs": {
104
- "version": "6.10.2",
105
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.2.tgz",
106
- "integrity": "sha512-mSIdjzqznWgfd4pMii7sHtaYF8rx8861hBO80SraY5GT0XQibWZWJSid0avzHGkDIZLImux2S5mXO0Hfct2QCw==",
104
+ "version": "6.10.3",
105
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz",
106
+ "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==",
107
107
  "dependencies": {
108
108
  "side-channel": "^1.0.4"
109
109
  },
@@ -185,9 +185,9 @@
185
185
  "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g=="
186
186
  },
187
187
  "qs": {
188
- "version": "6.10.2",
189
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.2.tgz",
190
- "integrity": "sha512-mSIdjzqznWgfd4pMii7sHtaYF8rx8861hBO80SraY5GT0XQibWZWJSid0avzHGkDIZLImux2S5mXO0Hfct2QCw==",
188
+ "version": "6.10.3",
189
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz",
190
+ "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==",
191
191
  "requires": {
192
192
  "side-channel": "^1.0.4"
193
193
  }
@@ -100,6 +100,16 @@ const getDefaultDist = () => {
100
100
  return process.cwd()
101
101
  }
102
102
 
103
+ const getStaticServerPort = async ({ devConfig }) => {
104
+ const port = await acquirePort({
105
+ configuredPort: devConfig.staticServerPort,
106
+ defaultPort: DEFAULT_STATIC_PORT,
107
+ errorMessage: 'Could not acquire configured static server port',
108
+ })
109
+
110
+ return port
111
+ }
112
+
103
113
  /**
104
114
  *
105
115
  * @param {object} param0
@@ -132,11 +142,7 @@ const handleStaticServer = async ({ devConfig, options, projectDir }) => {
132
142
  const dist = options.dir || devConfig.publish || getDefaultDist()
133
143
  log(`${NETLIFYDEVWARN} Running static server from "${path.relative(path.dirname(projectDir), dist)}"`)
134
144
 
135
- const frameworkPort = await acquirePort({
136
- configuredPort: devConfig.staticServerPort,
137
- defaultPort: DEFAULT_STATIC_PORT,
138
- errorMessage: 'Could not acquire configured static server port',
139
- })
145
+ const frameworkPort = await getStaticServerPort({ devConfig })
140
146
  return {
141
147
  ...(devConfig.command && { command: devConfig.command }),
142
148
  useStaticServer: true,
@@ -156,7 +162,7 @@ const getSettingsFromFramework = (framework) => {
156
162
  dev: {
157
163
  commands: [command],
158
164
  port: frameworkPort,
159
- pollingStrategies,
165
+ pollingStrategies = [],
160
166
  },
161
167
  name: frameworkName,
162
168
  staticAssetsDirectory: staticDir,
@@ -238,6 +244,31 @@ const handleCustomFramework = ({ devConfig }) => {
238
244
  }
239
245
  }
240
246
 
247
+ const mergeSettings = async ({ devConfig, frameworkSettings = {} }) => {
248
+ const {
249
+ command: frameworkCommand,
250
+ frameworkPort: frameworkDetectedPort,
251
+ dist,
252
+ framework,
253
+ env,
254
+ pollingStrategies = [],
255
+ } = frameworkSettings
256
+
257
+ const command = devConfig.command || frameworkCommand
258
+ const frameworkPort = devConfig.targetPort || frameworkDetectedPort
259
+ // if the framework doesn't start a server, we use a static one
260
+ const useStaticServer = !(command && frameworkPort)
261
+ return {
262
+ command,
263
+ frameworkPort: useStaticServer ? await getStaticServerPort({ devConfig }) : frameworkPort,
264
+ dist: devConfig.publish || dist || getDefaultDist(),
265
+ framework,
266
+ env,
267
+ pollingStrategies,
268
+ useStaticServer,
269
+ }
270
+ }
271
+
241
272
  /**
242
273
  * Handles a forced framework and retrieves the settings for it
243
274
  * @param {*} param0
@@ -245,17 +276,8 @@ const handleCustomFramework = ({ devConfig }) => {
245
276
  */
246
277
  const handleForcedFramework = async ({ devConfig, projectDir }) => {
247
278
  // this throws if `devConfig.framework` is not a supported framework
248
- const { command, dist, env, framework, frameworkPort, pollingStrategies } = getSettingsFromFramework(
249
- await getFramework(devConfig.framework, { projectDir }),
250
- )
251
- return {
252
- command: devConfig.command || command,
253
- frameworkPort: devConfig.targetPort || frameworkPort,
254
- dist: devConfig.publish || dist,
255
- framework,
256
- env,
257
- pollingStrategies,
258
- }
279
+ const frameworkSettings = getSettingsFromFramework(await getFramework(devConfig.framework, { projectDir }))
280
+ return mergeSettings({ devConfig, frameworkSettings })
259
281
  }
260
282
 
261
283
  /**
@@ -285,15 +307,7 @@ const detectServerSettings = async (devConfig, options, projectDir) => {
285
307
  settings = await handleStaticServer({ options, devConfig, projectDir })
286
308
  } else {
287
309
  validateFrameworkConfig({ devConfig })
288
- const { command, frameworkPort, dist, framework, env, pollingStrategies = [] } = frameworkSettings || {}
289
- settings = {
290
- command: devConfig.command || command,
291
- frameworkPort: devConfig.targetPort || frameworkPort,
292
- dist: devConfig.publish || dist || getDefaultDist(),
293
- framework,
294
- env,
295
- pollingStrategies,
296
- }
310
+ settings = await mergeSettings({ devConfig, frameworkSettings })
297
311
  }
298
312
  } else if (devConfig.framework === '#custom') {
299
313
  validateFrameworkConfig({ devConfig })