netlify-cli 8.9.5 → 8.9.8

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.9.5",
4
+ "version": "8.9.8",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
@@ -43,8 +43,6 @@
43
43
  },
44
44
  "scripts": {
45
45
  "prepare": "husky install node_modules/@netlify/eslint-config-node/.husky/",
46
- "prepublishOnly": "run-s prepublishOnly:*",
47
- "prepublishOnly:test": "run-local \"npm test\"",
48
46
  "start": "node ./bin/run",
49
47
  "test": "run-s format test:dev",
50
48
  "format": "run-s format:check-fix:*",
@@ -65,6 +63,7 @@
65
63
  "test:dev:ava": "ava --verbose",
66
64
  "test:ci:ava": "c8 -r json ava",
67
65
  "test:affected": "node ./tools/affected-test.js",
66
+ "e2e": "node ./tools/e2e/run.js",
68
67
  "docs": "node ./site/scripts/docs.js",
69
68
  "watch": "c8 --reporter=lcov ava --watch",
70
69
  "site:build": "run-s site:build:*",
@@ -77,7 +76,7 @@
77
76
  "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\""
78
77
  },
79
78
  "dependencies": {
80
- "@netlify/build": "^26.1.3",
79
+ "@netlify/build": "^26.1.4",
81
80
  "@netlify/config": "^17.0.3",
82
81
  "@netlify/framework-info": "^8.0.2",
83
82
  "@netlify/local-functions-proxy": "^1.1.1",
@@ -183,7 +182,7 @@
183
182
  },
184
183
  "devDependencies": {
185
184
  "@babel/preset-react": "^7.12.13",
186
- "@netlify/eslint-config-node": "^4.1.4",
185
+ "@netlify/eslint-config-node": "^4.1.5",
187
186
  "ava": "^3.15.0",
188
187
  "c8": "^7.11.0",
189
188
  "eslint-plugin-sort-destructure-keys": "^1.3.5",
@@ -206,7 +205,8 @@
206
205
  "temp-dir": "^2.0.0",
207
206
  "tomlify-j0.4": "^3.0.0",
208
207
  "tree-kill": "^1.2.2",
209
- "typescript": "^4.4.4"
208
+ "typescript": "^4.4.4",
209
+ "verdaccio": "^5.4.0"
210
210
  },
211
211
  "ava": {
212
212
  "files": [
@@ -470,7 +470,11 @@ class BaseCommand extends Command {
470
470
  return await resolveConfig({
471
471
  config: options.config,
472
472
  cwd,
473
- context: options.context || this.name(),
473
+ context:
474
+ options.context ||
475
+ process.env.CONTEXT ||
476
+ // Dev commands have a default context of `dev`, otherwise we let netlify/config handle default behavior
477
+ (['dev', 'dev:exec', 'dev:trace'].includes(this.name()) ? 'dev' : undefined),
474
478
  debug: this.opts().debug,
475
479
  siteId: options.siteId || (typeof options.site === 'string' && options.site) || state.get('siteId'),
476
480
  token,
@@ -2,7 +2,7 @@
2
2
  const { existsSync, mkdirSync, writeFileSync } = require('fs')
3
3
  const { dirname } = require('path')
4
4
 
5
- const { sortOptions } = require('../../utils')
5
+ const { sortOptions, warn } = require('../../utils')
6
6
 
7
7
  const { AUTOCOMPLETION_FILE } = require('./constants')
8
8
 
@@ -12,25 +12,33 @@ const { AUTOCOMPLETION_FILE } = require('./constants')
12
12
  * @returns {void}
13
13
  */
14
14
  const createAutocompletion = (program) => {
15
- const autocomplete = program.commands.reduce(
16
- (prev, cmd) => ({
17
- ...prev,
18
- [cmd.name()]: {
19
- name: cmd.name(),
20
- description: cmd.description().split('\n')[0],
21
- options: cmd.options
22
- .filter((option) => !option.hidden)
23
- .sort(sortOptions)
24
- .map((opt) => ({ name: `--${opt.name()}`, description: opt.description })),
25
- },
26
- }),
27
- {},
28
- )
15
+ try {
16
+ const autocomplete = program.commands.reduce(
17
+ (prev, cmd) => ({
18
+ ...prev,
19
+ [cmd.name()]: {
20
+ name: cmd.name(),
21
+ description: cmd.description().split('\n')[0],
22
+ options: cmd.options
23
+ .filter((option) => !option.hidden)
24
+ .sort(sortOptions)
25
+ .map((opt) => ({ name: `--${opt.name()}`, description: opt.description })),
26
+ },
27
+ }),
28
+ {},
29
+ )
29
30
 
30
- if (!existsSync(dirname(AUTOCOMPLETION_FILE))) {
31
- mkdirSync(dirname(AUTOCOMPLETION_FILE), { recursive: true })
31
+ if (!existsSync(dirname(AUTOCOMPLETION_FILE))) {
32
+ mkdirSync(dirname(AUTOCOMPLETION_FILE), { recursive: true })
33
+ }
34
+ writeFileSync(AUTOCOMPLETION_FILE, JSON.stringify(autocomplete), 'utf-8')
35
+ } catch (error_) {
36
+ // Sometimes it can happen that the autocomplete generation in the postinstall script lacks permissions
37
+ // to write files to the home directory of the user. Therefore just warn with the error and don't break install.
38
+ if (error_ instanceof Error) {
39
+ warn(`could not create autocompletion.\n${error_.message}`)
40
+ }
32
41
  }
33
- writeFileSync(AUTOCOMPLETION_FILE, JSON.stringify(autocomplete), 'utf-8')
34
42
  }
35
43
 
36
44
  module.exports = { createAutocompletion }