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/src/utils/run-build.mjs
CHANGED
|
@@ -12,13 +12,8 @@ import { INTERNAL_FUNCTIONS_FOLDER } from './functions/index.mjs'
|
|
|
12
12
|
|
|
13
13
|
const netlifyBuildPromise = import('@netlify/build')
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* directory and returns the path to its new location.
|
|
18
|
-
* @param {object} config
|
|
19
|
-
* @param {string} config.configPath
|
|
20
|
-
* @param {string} config.siteRoot
|
|
21
|
-
*/
|
|
15
|
+
// Copies `netlify.toml`, if one is defined, into the `.netlify` internal
|
|
16
|
+
// directory and returns the path to its new location.
|
|
22
17
|
const copyConfig = async ({ configPath, siteRoot }) => {
|
|
23
18
|
const newConfigPath = path.resolve(siteRoot, getPathInProject(['netlify.toml']))
|
|
24
19
|
|
|
@@ -31,9 +26,6 @@ const copyConfig = async ({ configPath, siteRoot }) => {
|
|
|
31
26
|
return newConfigPath
|
|
32
27
|
}
|
|
33
28
|
|
|
34
|
-
/**
|
|
35
|
-
* @param {string} basePath
|
|
36
|
-
*/
|
|
37
29
|
const cleanInternalDirectory = async (basePath) => {
|
|
38
30
|
const ops = [INTERNAL_FUNCTIONS_FOLDER, INTERNAL_EDGE_FUNCTIONS_FOLDER, 'netlify.toml'].map((name) => {
|
|
39
31
|
const fullPath = path.resolve(basePath, getPathInProject([name]))
|
|
@@ -44,21 +36,6 @@ const cleanInternalDirectory = async (basePath) => {
|
|
|
44
36
|
await Promise.all(ops)
|
|
45
37
|
}
|
|
46
38
|
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* @param {object} config
|
|
50
|
-
* @param {*} config.cachedConfig
|
|
51
|
-
* @param {object} config.options
|
|
52
|
-
* @param {string} config.options.configPath
|
|
53
|
-
* @param {*} config.options.context
|
|
54
|
-
* @param {string=} config.options.cwd
|
|
55
|
-
* @param {boolean} config.options.debug
|
|
56
|
-
* @param {boolean} config.options.dry
|
|
57
|
-
* @param {boolean} config.options.offline
|
|
58
|
-
* @param {boolean} config.options.quiet
|
|
59
|
-
* @param {boolean} config.options.saveConfig
|
|
60
|
-
* @returns
|
|
61
|
-
*/
|
|
62
39
|
const getBuildOptions = ({
|
|
63
40
|
cachedConfig,
|
|
64
41
|
options: { configPath, context, cwd = process.cwd(), debug, dry, offline, quiet, saveConfig },
|
|
@@ -79,18 +56,7 @@ const getBuildOptions = ({
|
|
|
79
56
|
saveConfig,
|
|
80
57
|
})
|
|
81
58
|
|
|
82
|
-
|
|
83
|
-
*
|
|
84
|
-
* @param {object} config
|
|
85
|
-
* @param {*} config.cachedConfig
|
|
86
|
-
* @param {NodeJS.ProcessEnv} config.env
|
|
87
|
-
* @param {*} config.options
|
|
88
|
-
* @param {import('./types.js').ServerSettings} config.settings
|
|
89
|
-
* @param {*} config.site
|
|
90
|
-
* @param {'build' | 'dev'} config.timeline
|
|
91
|
-
* @returns
|
|
92
|
-
*/
|
|
93
|
-
export const runNetlifyBuild = async ({ cachedConfig, env, options, settings, site, timeline = 'build' }) => {
|
|
59
|
+
const runNetlifyBuild = async ({ cachedConfig, env, options, settings, site, timeline = 'build' }) => {
|
|
94
60
|
const { default: buildSite, startDev } = await netlifyBuildPromise
|
|
95
61
|
const sharedOptions = getBuildOptions({
|
|
96
62
|
cachedConfig,
|
|
@@ -152,19 +118,13 @@ export const runNetlifyBuild = async ({ cachedConfig, env, options, settings, si
|
|
|
152
118
|
// Run Netlify Build using the `startDev` entry point.
|
|
153
119
|
const { error: startDevError, success } = await startDev(devCommand, startDevOptions)
|
|
154
120
|
|
|
155
|
-
if (!success
|
|
121
|
+
if (!success) {
|
|
156
122
|
error(`Could not start local development server\n\n${startDevError.message}\n\n${startDevError.stack}`)
|
|
157
123
|
}
|
|
158
124
|
|
|
159
125
|
return {}
|
|
160
126
|
}
|
|
161
127
|
|
|
162
|
-
/**
|
|
163
|
-
* @param {Omit<Parameters<typeof runNetlifyBuild>[0], 'timeline'>} options
|
|
164
|
-
*/
|
|
165
128
|
export const runDevTimeline = (options) => runNetlifyBuild({ ...options, timeline: 'dev' })
|
|
166
129
|
|
|
167
|
-
/**
|
|
168
|
-
* @param {Omit<Parameters<typeof runNetlifyBuild>[0], 'timeline'>} options
|
|
169
|
-
*/
|
|
170
130
|
export const runBuildTimeline = (options) => runNetlifyBuild({ ...options, timeline: 'build' })
|
package/src/utils/shell.mjs
CHANGED
|
@@ -48,11 +48,7 @@ export const runCommand = (command, env = {}, spinner = null) => {
|
|
|
48
48
|
preferLocal: true,
|
|
49
49
|
// we use reject=false to avoid rejecting synchronously when the command doesn't exist
|
|
50
50
|
reject: false,
|
|
51
|
-
env
|
|
52
|
-
// we want always colorful terminal outputs
|
|
53
|
-
FORCE_COLOR: 'true',
|
|
54
|
-
...env,
|
|
55
|
-
},
|
|
51
|
+
env,
|
|
56
52
|
// windowsHide needs to be false for child process to terminate properly on Windows
|
|
57
53
|
windowsHide: false,
|
|
58
54
|
})
|
|
@@ -104,13 +100,6 @@ export const runCommand = (command, env = {}, spinner = null) => {
|
|
|
104
100
|
return commandProcess
|
|
105
101
|
}
|
|
106
102
|
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
* @param {object} config
|
|
110
|
-
* @param {string} config.command
|
|
111
|
-
* @param {*} config.error
|
|
112
|
-
* @returns
|
|
113
|
-
*/
|
|
114
103
|
const isNonExistingCommandError = ({ command, error: commandError }) => {
|
|
115
104
|
// `ENOENT` is only returned for non Windows systems
|
|
116
105
|
// See https://github.com/sindresorhus/execa/pull/447
|
|
@@ -119,7 +108,7 @@ const isNonExistingCommandError = ({ command, error: commandError }) => {
|
|
|
119
108
|
}
|
|
120
109
|
|
|
121
110
|
// if the command is a package manager we let it report the error
|
|
122
|
-
if (['yarn', 'npm'
|
|
111
|
+
if (['yarn', 'npm'].includes(command)) {
|
|
123
112
|
return false
|
|
124
113
|
}
|
|
125
114
|
|
|
@@ -6,10 +6,6 @@ import Fastify from 'fastify'
|
|
|
6
6
|
|
|
7
7
|
import { log, NETLIFYDEVLOG } from './command-helpers.mjs'
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @param {object} config
|
|
11
|
-
* @param {import('./types.js').ServerSettings} config.settings
|
|
12
|
-
*/
|
|
13
9
|
export const startStaticServer = async ({ settings }) => {
|
|
14
10
|
const server = Fastify()
|
|
15
11
|
const rootPath = path.resolve(settings.dist)
|