netlify-cli 8.9.7-rc.0 → 8.9.10

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/bin/run CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- /* eslint-disable promise/prefer-await-to-then,promise/prefer-await-to-callbacks,eslint-comments/disable-enable-pair */
3
2
  const process = require('process')
4
3
 
5
4
  const updateNotifier = require('update-notifier')
@@ -18,23 +17,13 @@ if (require.main === module) {
18
17
  pkg,
19
18
  updateCheckInterval: UPDATE_CHECK_INTERVAL,
20
19
  }).notify()
21
- } catch (error) {
20
+ } catch (error_) {
22
21
  console.log('Error checking for updates:')
23
- console.log(error)
22
+ console.log(error_)
24
23
  }
25
24
 
26
- /** @type {Error} */
27
- let caughtError
28
-
29
25
  const program = createMainCommand()
30
26
 
31
- program.parseAsync(process.argv).catch((error) => {
32
- caughtError = error
33
- })
34
-
35
- // long running commands like dev server cannot be caught by a post action hook
36
- // they are running on the main command
37
- process.on('exit', () => {
38
- program.onEnd(caughtError)
39
- })
27
+ // eslint-disable-next-line promise/prefer-await-to-then
28
+ program.parseAsync(process.argv).catch((error_) => program.onEnd(error_))
40
29
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "8.9.7-rc.0",
3
+ "version": "8.9.10",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "8.9.7-rc.0",
9
+ "version": "8.9.10",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
@@ -17,7 +17,7 @@
17
17
  "@netlify/plugin-edge-handlers": "^3.0.4",
18
18
  "@netlify/plugins-list": "^6.3.0",
19
19
  "@netlify/routing-local-proxy": "^0.34.1",
20
- "@netlify/zip-it-and-ship-it": "^5.4.0",
20
+ "@netlify/zip-it-and-ship-it": "^5.4.1",
21
21
  "@octokit/rest": "^18.0.0",
22
22
  "@sindresorhus/slugify": "^1.1.0",
23
23
  "ansi-escapes": "^5.0.0",
@@ -134,6 +134,7 @@
134
134
  "mock-fs": "^5.1.2",
135
135
  "mock-require": "^3.0.3",
136
136
  "p-timeout": "^4.0.0",
137
+ "proxyquire": "^2.1.3",
137
138
  "seedrandom": "^3.0.5",
138
139
  "serialize-javascript": "^6.0.0",
139
140
  "sinon": "^12.0.0",
@@ -3162,9 +3163,9 @@
3162
3163
  }
3163
3164
  },
3164
3165
  "node_modules/@netlify/zip-it-and-ship-it": {
3165
- "version": "5.4.0",
3166
- "resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-5.4.0.tgz",
3167
- "integrity": "sha512-JVUr7S6GTHnPpwtD+g/+qzhKvhXwXoHGeisaHt1YYARRRd+XdvwFYo8yY2JzT7hM26uz99tpKwzDSfcL+WR1rQ==",
3166
+ "version": "5.4.1",
3167
+ "resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-5.4.1.tgz",
3168
+ "integrity": "sha512-ArusY1DrK+neNs1EF8vHbBHCBP4PI9fFVQxH1Zcuz0rvF9Q1vCiG2g8nL6JsJTW4eUibvy96BGD22egOvxpxtA==",
3168
3169
  "dependencies": {
3169
3170
  "@babel/parser": "^7.15.7",
3170
3171
  "@netlify/esbuild": "^0.13.6",
@@ -3183,7 +3184,6 @@
3183
3184
  "is-builtin-module": "^3.1.0",
3184
3185
  "junk": "^3.1.0",
3185
3186
  "locate-path": "^6.0.0",
3186
- "make-dir": "^3.1.0",
3187
3187
  "merge-options": "^3.0.4",
3188
3188
  "minimatch": "^3.0.4",
3189
3189
  "p-map": "^4.0.0",
@@ -10433,6 +10433,19 @@
10433
10433
  "node": ">=6"
10434
10434
  }
10435
10435
  },
10436
+ "node_modules/fill-keys": {
10437
+ "version": "1.0.2",
10438
+ "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz",
10439
+ "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=",
10440
+ "dev": true,
10441
+ "dependencies": {
10442
+ "is-object": "~1.0.1",
10443
+ "merge-descriptors": "~1.0.0"
10444
+ },
10445
+ "engines": {
10446
+ "node": ">=0.10.0"
10447
+ }
10448
+ },
10436
10449
  "node_modules/fill-range": {
10437
10450
  "version": "7.0.1",
10438
10451
  "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -14855,6 +14868,12 @@
14855
14868
  "node": ">=6.0"
14856
14869
  }
14857
14870
  },
14871
+ "node_modules/module-not-found-error": {
14872
+ "version": "1.0.1",
14873
+ "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz",
14874
+ "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=",
14875
+ "dev": true
14876
+ },
14858
14877
  "node_modules/moize": {
14859
14878
  "version": "6.1.0",
14860
14879
  "resolved": "https://registry.npmjs.org/moize/-/moize-6.1.0.tgz",
@@ -17489,6 +17508,34 @@
17489
17508
  "node": ">= 0.10"
17490
17509
  }
17491
17510
  },
17511
+ "node_modules/proxyquire": {
17512
+ "version": "2.1.3",
17513
+ "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz",
17514
+ "integrity": "sha512-BQWfCqYM+QINd+yawJz23tbBM40VIGXOdDw3X344KcclI/gtBbdWF6SlQ4nK/bYhF9d27KYug9WzljHC6B9Ysg==",
17515
+ "dev": true,
17516
+ "dependencies": {
17517
+ "fill-keys": "^1.0.2",
17518
+ "module-not-found-error": "^1.0.1",
17519
+ "resolve": "^1.11.1"
17520
+ }
17521
+ },
17522
+ "node_modules/proxyquire/node_modules/resolve": {
17523
+ "version": "1.21.0",
17524
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz",
17525
+ "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==",
17526
+ "dev": true,
17527
+ "dependencies": {
17528
+ "is-core-module": "^2.8.0",
17529
+ "path-parse": "^1.0.7",
17530
+ "supports-preserve-symlinks-flag": "^1.0.0"
17531
+ },
17532
+ "bin": {
17533
+ "resolve": "bin/resolve"
17534
+ },
17535
+ "funding": {
17536
+ "url": "https://github.com/sponsors/ljharb"
17537
+ }
17538
+ },
17492
17539
  "node_modules/ps-list": {
17493
17540
  "version": "7.2.0",
17494
17541
  "resolved": "https://registry.npmjs.org/ps-list/-/ps-list-7.2.0.tgz",
@@ -24182,9 +24229,9 @@
24182
24229
  }
24183
24230
  },
24184
24231
  "@netlify/zip-it-and-ship-it": {
24185
- "version": "5.4.0",
24186
- "resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-5.4.0.tgz",
24187
- "integrity": "sha512-JVUr7S6GTHnPpwtD+g/+qzhKvhXwXoHGeisaHt1YYARRRd+XdvwFYo8yY2JzT7hM26uz99tpKwzDSfcL+WR1rQ==",
24232
+ "version": "5.4.1",
24233
+ "resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-5.4.1.tgz",
24234
+ "integrity": "sha512-ArusY1DrK+neNs1EF8vHbBHCBP4PI9fFVQxH1Zcuz0rvF9Q1vCiG2g8nL6JsJTW4eUibvy96BGD22egOvxpxtA==",
24188
24235
  "requires": {
24189
24236
  "@babel/parser": "^7.15.7",
24190
24237
  "@netlify/esbuild": "^0.13.6",
@@ -24203,7 +24250,6 @@
24203
24250
  "is-builtin-module": "^3.1.0",
24204
24251
  "junk": "^3.1.0",
24205
24252
  "locate-path": "^6.0.0",
24206
- "make-dir": "^3.1.0",
24207
24253
  "merge-options": "^3.0.4",
24208
24254
  "minimatch": "^3.0.4",
24209
24255
  "p-map": "^4.0.0",
@@ -29794,6 +29840,16 @@
29794
29840
  "trim-repeated": "^1.0.0"
29795
29841
  }
29796
29842
  },
29843
+ "fill-keys": {
29844
+ "version": "1.0.2",
29845
+ "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz",
29846
+ "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=",
29847
+ "dev": true,
29848
+ "requires": {
29849
+ "is-object": "~1.0.1",
29850
+ "merge-descriptors": "~1.0.0"
29851
+ }
29852
+ },
29797
29853
  "fill-range": {
29798
29854
  "version": "7.0.1",
29799
29855
  "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -33100,6 +33156,12 @@
33100
33156
  "node-source-walk": "^4.0.0"
33101
33157
  }
33102
33158
  },
33159
+ "module-not-found-error": {
33160
+ "version": "1.0.1",
33161
+ "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz",
33162
+ "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=",
33163
+ "dev": true
33164
+ },
33103
33165
  "moize": {
33104
33166
  "version": "6.1.0",
33105
33167
  "resolved": "https://registry.npmjs.org/moize/-/moize-6.1.0.tgz",
@@ -35109,6 +35171,30 @@
35109
35171
  "ipaddr.js": "1.9.1"
35110
35172
  }
35111
35173
  },
35174
+ "proxyquire": {
35175
+ "version": "2.1.3",
35176
+ "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz",
35177
+ "integrity": "sha512-BQWfCqYM+QINd+yawJz23tbBM40VIGXOdDw3X344KcclI/gtBbdWF6SlQ4nK/bYhF9d27KYug9WzljHC6B9Ysg==",
35178
+ "dev": true,
35179
+ "requires": {
35180
+ "fill-keys": "^1.0.2",
35181
+ "module-not-found-error": "^1.0.1",
35182
+ "resolve": "^1.11.1"
35183
+ },
35184
+ "dependencies": {
35185
+ "resolve": {
35186
+ "version": "1.21.0",
35187
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz",
35188
+ "integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==",
35189
+ "dev": true,
35190
+ "requires": {
35191
+ "is-core-module": "^2.8.0",
35192
+ "path-parse": "^1.0.7",
35193
+ "supports-preserve-symlinks-flag": "^1.0.0"
35194
+ }
35195
+ }
35196
+ }
35197
+ },
35112
35198
  "ps-list": {
35113
35199
  "version": "7.2.0",
35114
35200
  "resolved": "https://registry.npmjs.org/ps-list/-/ps-list-7.2.0.tgz",
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.7-rc.0",
4
+ "version": "8.9.10",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
@@ -83,7 +83,7 @@
83
83
  "@netlify/plugin-edge-handlers": "^3.0.4",
84
84
  "@netlify/plugins-list": "^6.3.0",
85
85
  "@netlify/routing-local-proxy": "^0.34.1",
86
- "@netlify/zip-it-and-ship-it": "^5.4.0",
86
+ "@netlify/zip-it-and-ship-it": "^5.4.1",
87
87
  "@octokit/rest": "^18.0.0",
88
88
  "@sindresorhus/slugify": "^1.1.0",
89
89
  "ansi-escapes": "^5.0.0",
@@ -196,6 +196,7 @@
196
196
  "mock-fs": "^5.1.2",
197
197
  "mock-require": "^3.0.3",
198
198
  "p-timeout": "^4.0.0",
199
+ "proxyquire": "^2.1.3",
199
200
  "seedrandom": "^3.0.5",
200
201
  "serialize-javascript": "^6.0.0",
201
202
  "sinon": "^12.0.0",
@@ -303,12 +303,14 @@ class BaseCommand extends Command {
303
303
  debug(`${this.name()}:onEnd`)(`Status: ${status}`)
304
304
  debug(`${this.name()}:onEnd`)(`Duration: ${duration}ms`)
305
305
 
306
- await track('command', {
307
- ...payload,
308
- command: this.name(),
309
- duration,
310
- status,
311
- })
306
+ try {
307
+ await track('command', {
308
+ ...payload,
309
+ command: this.name(),
310
+ duration,
311
+ status,
312
+ })
313
+ } catch {}
312
314
 
313
315
  if (error_ !== undefined) {
314
316
  error(error_ instanceof Error ? error_ : format(error_), { exit: false })
@@ -4,10 +4,11 @@ const process = require('process')
4
4
 
5
5
  const { fetchLatest, fetchVersion, newerVersion, updateAvailable } = require('gh-release-fetch')
6
6
  const isExe = require('isexe')
7
+ const terminalLink = require('terminal-link')
7
8
 
8
9
  // cannot directly import from ../utils as it would create a circular dependency.
9
10
  // the file `src/utils/live-tunnel.js` depends on this file
10
- const { NETLIFYDEVWARN, log } = require('../utils/command-helpers')
11
+ const { NETLIFYDEVWARN, chalk, error, log } = require('../utils/command-helpers')
11
12
  const execa = require('../utils/execa')
12
13
 
13
14
  const isWindows = () => process.platform === 'win32'
@@ -62,27 +63,80 @@ const shouldFetchLatestVersion = async ({ binPath, execArgs, execName, latestVer
62
63
  latestVersion,
63
64
  })
64
65
  return outdated
65
- } catch (error) {
66
+ } catch (error_) {
66
67
  if (exists) {
67
68
  log(NETLIFYDEVWARN, `failed checking for new version of '${packageName}'. Using existing version`)
68
69
  return false
69
70
  }
70
- throw error
71
+ throw error_
71
72
  }
72
73
  }
73
74
 
75
+ const getArch = () => {
76
+ switch (process.arch) {
77
+ case 'x64':
78
+ return 'amd64'
79
+ case 'ia32':
80
+ return '386'
81
+ default:
82
+ return process.arch
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Tries to get the latest release from the github releases to download the binary.
88
+ * Is throwing an error if there is no binary that matches the system os or arch
89
+ * @param {object} config
90
+ * @param {string} config.destination
91
+ * @param {string} config.execName
92
+ * @param {string} config.destination
93
+ * @param {string} config.extension
94
+ * @param {string} config.packageName
95
+ * @param {string} [config.latestVersion ]
96
+ */
74
97
  const fetchLatestVersion = async ({ destination, execName, extension, latestVersion, packageName }) => {
75
98
  const win = isWindows()
99
+ const arch = getArch()
76
100
  const platform = win ? 'windows' : process.platform
101
+ const pkgName = `${execName}-${platform}-${arch}.${extension}`
102
+
77
103
  const release = {
78
104
  repository: getRepository({ packageName }),
79
- package: `${execName}-${platform}-amd64.${extension}`,
105
+ package: pkgName,
80
106
  destination,
81
107
  extract: true,
82
108
  }
83
109
 
84
110
  const options = getOptions()
85
- await (latestVersion ? fetchVersion({ ...release, version: latestVersion }, options) : fetchLatest(release, options))
111
+ const fetch = latestVersion
112
+ ? fetchVersion({ ...release, version: latestVersion }, options)
113
+ : fetchLatest(release, options)
114
+
115
+ try {
116
+ await fetch
117
+ } catch (error_) {
118
+ if (typeof error_ === 'object' && 'statusCode' in error_ && error_.statusCode === 404) {
119
+ const createIssueLink = new URL('https://github.com/netlify/cli/issues/new')
120
+ createIssueLink.searchParams.set('assignees', '')
121
+ createIssueLink.searchParams.set('labels', 'type: bug')
122
+ createIssueLink.searchParams.set('template', 'bug_report.md')
123
+ createIssueLink.searchParams.set(
124
+ 'title',
125
+ `${execName} is not supported on ${platform} with CPU architecture ${arch}`,
126
+ )
127
+
128
+ const issueLink = terminalLink('Create a new CLI issue', createIssueLink.href)
129
+
130
+ error(`The operating system ${chalk.cyan(platform)} with the CPU architecture ${chalk.cyan(
131
+ arch,
132
+ )} is currently not supported!
133
+
134
+ Please open up an issue on our CLI repository so that we can support it:
135
+ ${issueLink}`)
136
+ }
137
+
138
+ error(error_)
139
+ }
86
140
  }
87
141
 
88
- module.exports = { getExecName, shouldFetchLatestVersion, fetchLatestVersion }
142
+ module.exports = { getArch, getExecName, shouldFetchLatestVersion, fetchLatestVersion }
@@ -179,7 +179,7 @@ const error = (message = '', options = {}) => {
179
179
  if (process.env.DEBUG) {
180
180
  process.stderr.write(` ${bang} Warning: ${err.stack.split('\n').join(`\n ${bang} `)}`)
181
181
  } else {
182
- process.stderr.write(` ${bang} ${err.name}: ${err.message}\n`)
182
+ process.stderr.write(` ${bang} ${chalk.red(`${err.name}:`)} ${err.message}\n`)
183
183
  }
184
184
  } else {
185
185
  throw err