netlify-cli 15.8.1-rc.1 → 15.9.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/npm-shrinkwrap.json +425 -310
- package/package.json +7 -6
- package/src/commands/base-command.mjs +4 -31
- package/src/commands/dev/dev.mjs +13 -12
- package/src/commands/serve/serve.mjs +1 -1
- package/src/functions-templates/javascript/auth-fetch/package-lock.json +6 -6
- package/src/functions-templates/javascript/google-analytics/package-lock.json +6 -6
- package/src/lib/spinner.mjs +1 -1
- package/src/utils/command-helpers.mjs +3 -10
- package/src/utils/detect-server-settings.mjs +132 -124
- package/src/utils/framework-server.mjs +2 -2
- package/src/utils/init/config-github.mjs +2 -2
- package/src/utils/init/config-manual.mjs +7 -24
- package/src/utils/init/frameworks.mjs +15 -11
- package/src/utils/init/utils.mjs +5 -6
- package/src/utils/proxy.mjs +0 -4
- package/src/utils/run-build.mjs +4 -44
- package/src/utils/shell.mjs +2 -13
- package/src/utils/static-server.mjs +0 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.9.0",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -44,10 +44,11 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@bugsnag/js": "7.20.2",
|
|
46
46
|
"@fastify/static": "6.10.2",
|
|
47
|
-
"@netlify/build": "29.
|
|
47
|
+
"@netlify/build": "29.16.1",
|
|
48
48
|
"@netlify/build-info": "7.4.1",
|
|
49
|
-
"@netlify/config": "20.
|
|
50
|
-
"@netlify/edge-bundler": "8.16.
|
|
49
|
+
"@netlify/config": "20.6.0",
|
|
50
|
+
"@netlify/edge-bundler": "8.16.4",
|
|
51
|
+
"@netlify/framework-info": "9.8.10",
|
|
51
52
|
"@netlify/local-functions-proxy": "1.1.1",
|
|
52
53
|
"@netlify/serverless-functions-api": "1.5.1",
|
|
53
54
|
"@netlify/zip-it-and-ship-it": "9.13.0",
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
"log-update": "5.0.1",
|
|
115
116
|
"minimist": "1.2.8",
|
|
116
117
|
"multiparty": "4.2.3",
|
|
117
|
-
"netlify": "13.1.
|
|
118
|
+
"netlify": "13.1.10",
|
|
118
119
|
"netlify-headers-parser": "7.1.2",
|
|
119
120
|
"netlify-redirect-parser": "14.1.3",
|
|
120
121
|
"netlify-redirector": "0.4.0",
|
|
@@ -132,7 +133,7 @@
|
|
|
132
133
|
"pump": "3.0.0",
|
|
133
134
|
"raw-body": "2.5.2",
|
|
134
135
|
"read-pkg-up": "9.1.0",
|
|
135
|
-
"semver": "7.5.
|
|
136
|
+
"semver": "7.5.4",
|
|
136
137
|
"source-map-support": "0.5.21",
|
|
137
138
|
"strip-ansi-control-characters": "2.0.0",
|
|
138
139
|
"tabtab": "3.0.2",
|
|
@@ -8,7 +8,6 @@ import { NodeFS } from '@netlify/build-info/node'
|
|
|
8
8
|
import { resolveConfig } from '@netlify/config'
|
|
9
9
|
import { Command, Option } from 'commander'
|
|
10
10
|
import debug from 'debug'
|
|
11
|
-
import execa from 'execa'
|
|
12
11
|
import merge from 'lodash/merge.js'
|
|
13
12
|
import { NetlifyAPI } from 'netlify'
|
|
14
13
|
|
|
@@ -89,9 +88,6 @@ export default class BaseCommand extends Command {
|
|
|
89
88
|
/** @type {{ startTime: bigint, payload?: any}} */
|
|
90
89
|
analytics = { startTime: process.hrtime.bigint() }
|
|
91
90
|
|
|
92
|
-
/** @type {Project} */
|
|
93
|
-
project
|
|
94
|
-
|
|
95
91
|
/**
|
|
96
92
|
* IMPORTANT this function will be called for each command!
|
|
97
93
|
* Don't do anything expensive in there.
|
|
@@ -341,11 +337,6 @@ export default class BaseCommand extends Command {
|
|
|
341
337
|
}
|
|
342
338
|
}
|
|
343
339
|
|
|
344
|
-
/**
|
|
345
|
-
*
|
|
346
|
-
* @param {string|undefined} tokenFromFlag
|
|
347
|
-
* @returns
|
|
348
|
-
*/
|
|
349
340
|
async authenticate(tokenFromFlag) {
|
|
350
341
|
const [token] = await getToken(tokenFromFlag)
|
|
351
342
|
if (token) {
|
|
@@ -469,12 +460,10 @@ export default class BaseCommand extends Command {
|
|
|
469
460
|
|
|
470
461
|
const globalConfig = await getGlobalConfig()
|
|
471
462
|
|
|
472
|
-
// retrieve the repository root
|
|
473
|
-
const rootDir = await getRepositoryRoot()
|
|
474
463
|
// Get framework, add to analytics payload for every command, if a framework is set
|
|
475
464
|
const fs = new NodeFS()
|
|
476
|
-
|
|
477
|
-
const frameworks = await
|
|
465
|
+
const project = new Project(fs, buildDir)
|
|
466
|
+
const frameworks = await project.detectFrameworks()
|
|
478
467
|
|
|
479
468
|
const frameworkIDs = frameworks?.map((framework) => framework.id)
|
|
480
469
|
|
|
@@ -483,12 +472,10 @@ export default class BaseCommand extends Command {
|
|
|
483
472
|
}
|
|
484
473
|
|
|
485
474
|
this.setAnalyticsPayload({
|
|
486
|
-
packageManager:
|
|
487
|
-
buildSystem:
|
|
475
|
+
packageManager: project.packageManager?.name,
|
|
476
|
+
buildSystem: project.buildSystems.map(({ id }) => id),
|
|
488
477
|
})
|
|
489
478
|
|
|
490
|
-
actionCommand.project = this.project
|
|
491
|
-
|
|
492
479
|
actionCommand.netlify = {
|
|
493
480
|
// api methods
|
|
494
481
|
api,
|
|
@@ -581,17 +568,3 @@ export default class BaseCommand extends Command {
|
|
|
581
568
|
return 'dev'
|
|
582
569
|
}
|
|
583
570
|
}
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Retrieves the repository root through a git command.
|
|
587
|
-
* Returns undefined if not a git project.
|
|
588
|
-
* @returns {Promise<string|undefined>}
|
|
589
|
-
*/
|
|
590
|
-
async function getRepositoryRoot() {
|
|
591
|
-
try {
|
|
592
|
-
const res = await execa('git', ['rev-parse', '--show-toplevel'], { preferLocal: true })
|
|
593
|
-
return res.stdout
|
|
594
|
-
} catch {
|
|
595
|
-
// noop
|
|
596
|
-
}
|
|
597
|
-
}
|
package/src/commands/dev/dev.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { printBanner } from '../../utils/banner.mjs'
|
|
|
9
9
|
import {
|
|
10
10
|
BANG,
|
|
11
11
|
chalk,
|
|
12
|
+
exit,
|
|
12
13
|
log,
|
|
13
14
|
NETLIFYDEV,
|
|
14
15
|
NETLIFYDEVERR,
|
|
@@ -34,7 +35,7 @@ import { createDevExecCommand } from './dev-exec.mjs'
|
|
|
34
35
|
* @param {object} config
|
|
35
36
|
* @param {*} config.api
|
|
36
37
|
* @param {import('commander').OptionValues} config.options
|
|
37
|
-
* @param {
|
|
38
|
+
* @param {*} config.settings
|
|
38
39
|
* @param {*} config.site
|
|
39
40
|
* @param {*} config.state
|
|
40
41
|
* @returns
|
|
@@ -67,9 +68,6 @@ const handleLiveTunnel = async ({ api, options, settings, site, state }) => {
|
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
/**
|
|
71
|
-
* @param {string} args
|
|
72
|
-
*/
|
|
73
71
|
const validateShortFlagArgs = (args) => {
|
|
74
72
|
if (args.startsWith('=')) {
|
|
75
73
|
throw new Error(
|
|
@@ -96,7 +94,7 @@ const dev = async (options, command) => {
|
|
|
96
94
|
const { api, cachedConfig, config, repositoryRoot, site, siteInfo, state } = command.netlify
|
|
97
95
|
config.dev = { ...config.dev }
|
|
98
96
|
config.build = { ...config.build }
|
|
99
|
-
/** @type {import('./types
|
|
97
|
+
/** @type {import('./types').DevConfig} */
|
|
100
98
|
const devConfig = {
|
|
101
99
|
framework: '#auto',
|
|
102
100
|
...(config.functionsDirectory && { functions: config.functionsDirectory }),
|
|
@@ -126,17 +124,20 @@ const dev = async (options, command) => {
|
|
|
126
124
|
siteInfo,
|
|
127
125
|
})
|
|
128
126
|
|
|
129
|
-
/** @type {import('../../utils/types
|
|
130
|
-
let settings
|
|
127
|
+
/** @type {Partial<import('../../utils/types').ServerSettings>} */
|
|
128
|
+
let settings = {}
|
|
131
129
|
try {
|
|
132
|
-
settings = await detectServerSettings(devConfig, options,
|
|
130
|
+
settings = await detectServerSettings(devConfig, options, site.root, {
|
|
131
|
+
site: {
|
|
132
|
+
id: site.id,
|
|
133
|
+
url: siteUrl,
|
|
134
|
+
},
|
|
135
|
+
})
|
|
133
136
|
|
|
134
137
|
cachedConfig.config = getConfigWithPlugins(cachedConfig.config, settings)
|
|
135
138
|
} catch (error_) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
process.exit(1)
|
|
139
|
+
log(NETLIFYDEVERR, error_.message)
|
|
140
|
+
exit(1)
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
command.setAnalyticsPayload({ live: options.live })
|
|
@@ -72,7 +72,7 @@ const serve = async (options, command) => {
|
|
|
72
72
|
/** @type {Partial<import('../../utils/types').ServerSettings>} */
|
|
73
73
|
let settings = {}
|
|
74
74
|
try {
|
|
75
|
-
settings = await detectServerSettings(devConfig, options,
|
|
75
|
+
settings = await detectServerSettings(devConfig, options, site.root)
|
|
76
76
|
|
|
77
77
|
cachedConfig.config = getConfigWithPlugins(cachedConfig.config, settings)
|
|
78
78
|
} catch (error_) {
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"node_modules/node-fetch": {
|
|
16
|
-
"version": "2.6.
|
|
17
|
-
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.
|
|
18
|
-
"integrity": "sha512-
|
|
16
|
+
"version": "2.6.12",
|
|
17
|
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
|
|
18
|
+
"integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"whatwg-url": "^5.0.0"
|
|
21
21
|
},
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"node-fetch": {
|
|
56
|
-
"version": "2.6.
|
|
57
|
-
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.
|
|
58
|
-
"integrity": "sha512-
|
|
56
|
+
"version": "2.6.12",
|
|
57
|
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
|
|
58
|
+
"integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==",
|
|
59
59
|
"requires": {
|
|
60
60
|
"whatwg-url": "^5.0.0"
|
|
61
61
|
}
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"node_modules/node-fetch": {
|
|
20
|
-
"version": "2.6.
|
|
21
|
-
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.
|
|
22
|
-
"integrity": "sha512-
|
|
20
|
+
"version": "2.6.12",
|
|
21
|
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
|
|
22
|
+
"integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"whatwg-url": "^5.0.0"
|
|
25
25
|
},
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"node-fetch": {
|
|
68
|
-
"version": "2.6.
|
|
69
|
-
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.
|
|
70
|
-
"integrity": "sha512-
|
|
68
|
+
"version": "2.6.12",
|
|
69
|
+
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz",
|
|
70
|
+
"integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==",
|
|
71
71
|
"requires": {
|
|
72
72
|
"whatwg-url": "^5.0.0"
|
|
73
73
|
}
|
package/src/lib/spinner.mjs
CHANGED
|
@@ -17,7 +17,7 @@ export const startSpinner = ({ text }) =>
|
|
|
17
17
|
* Stops the spinner with the following text
|
|
18
18
|
* @param {object} config
|
|
19
19
|
* @param {ora.Ora} config.spinner
|
|
20
|
-
* @param {
|
|
20
|
+
* @param {object} [config.error]
|
|
21
21
|
* @param {string} [config.text]
|
|
22
22
|
* @returns {void}
|
|
23
23
|
*/
|
|
@@ -24,7 +24,7 @@ const argv = process.argv.slice(2)
|
|
|
24
24
|
* Chalk instance for CLI that can be initialized with no colors mode
|
|
25
25
|
* needed for json outputs where we don't want to have colors
|
|
26
26
|
* @param {boolean} noColors - disable chalk colors
|
|
27
|
-
* @return {
|
|
27
|
+
* @return {object} - default or custom chalk instance
|
|
28
28
|
*/
|
|
29
29
|
const safeChalk = function (noColors) {
|
|
30
30
|
if (noColors) {
|
|
@@ -174,19 +174,12 @@ export const warn = (message = '') => {
|
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
176
|
* throws an error or log it
|
|
177
|
-
* @param {
|
|
177
|
+
* @param {string|Error} message
|
|
178
178
|
* @param {object} [options]
|
|
179
179
|
* @param {boolean} [options.exit]
|
|
180
180
|
*/
|
|
181
181
|
export const error = (message = '', options = {}) => {
|
|
182
|
-
const err =
|
|
183
|
-
message instanceof Error
|
|
184
|
-
? message
|
|
185
|
-
: // eslint-disable-next-line unicorn/no-nested-ternary
|
|
186
|
-
typeof message === 'string'
|
|
187
|
-
? new Error(message)
|
|
188
|
-
: // eslint-disable-next-line no-inline-comments
|
|
189
|
-
/** @type {Error} */ ({ message, stack: undefined, name: 'Error' })
|
|
182
|
+
const err = message instanceof Error ? message : new Error(message)
|
|
190
183
|
|
|
191
184
|
if (options.exit === false) {
|
|
192
185
|
const bang = chalk.red(BANG)
|