netlify-cli 9.6.12 → 9.8.1
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 +19 -19
- package/package.json +3 -3
- package/src/commands/deploy/deploy.js +6 -1
- package/src/commands/dev/dev-exec.js +2 -2
- package/src/commands/dev/dev.js +1 -1
- package/src/commands/functions/functions-create.js +14 -2
- package/src/commands/functions/functions-serve.js +1 -1
- package/src/lib/functions/config.js +2 -1
- package/src/utils/deploy/deploy-site.js +2 -0
- package/src/utils/deploy/hash-fns.js +6 -1
- package/src/utils/dev.js +2 -2
- package/src/utils/dot-env.js +8 -5
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.1",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "netlify-cli",
|
|
9
|
-
"version": "9.
|
|
9
|
+
"version": "9.8.1",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@netlify/build": "^26.3.
|
|
14
|
-
"@netlify/config": "^17.0.
|
|
13
|
+
"@netlify/build": "^26.3.6",
|
|
14
|
+
"@netlify/config": "^17.0.13",
|
|
15
15
|
"@netlify/framework-info": "^9.0.2",
|
|
16
16
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
17
17
|
"@netlify/plugin-edge-handlers": "^3.0.6",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"path-key": "^3.1.1",
|
|
100
100
|
"prettyjson": "^1.2.1",
|
|
101
101
|
"pump": "^3.0.0",
|
|
102
|
-
"raw-body": "^2.
|
|
102
|
+
"raw-body": "^2.4.1",
|
|
103
103
|
"read-pkg-up": "^7.0.1",
|
|
104
104
|
"semver": "^7.3.5",
|
|
105
105
|
"source-map-support": "^0.5.19",
|
|
@@ -2358,9 +2358,9 @@
|
|
|
2358
2358
|
}
|
|
2359
2359
|
},
|
|
2360
2360
|
"node_modules/@netlify/build": {
|
|
2361
|
-
"version": "26.3.
|
|
2362
|
-
"resolved": "https://registry.npmjs.org/@netlify/build/-/build-26.3.
|
|
2363
|
-
"integrity": "sha512-
|
|
2361
|
+
"version": "26.3.6",
|
|
2362
|
+
"resolved": "https://registry.npmjs.org/@netlify/build/-/build-26.3.6.tgz",
|
|
2363
|
+
"integrity": "sha512-1jfduo2SfD/CpoAShEa1dIfy0LOPkTuXEiqkMW7mE7/YLnvUhkxKrBrxwVsPjH36uUgzUpTa/WFp7pwCpffWaw==",
|
|
2364
2364
|
"dependencies": {
|
|
2365
2365
|
"@bugsnag/js": "^7.0.0",
|
|
2366
2366
|
"@netlify/cache-utils": "^4.0.0",
|
|
@@ -2368,7 +2368,7 @@
|
|
|
2368
2368
|
"@netlify/functions-utils": "^4.0.0",
|
|
2369
2369
|
"@netlify/git-utils": "^4.0.0",
|
|
2370
2370
|
"@netlify/plugin-edge-handlers": "^3.0.6",
|
|
2371
|
-
"@netlify/plugins-list": "^6.
|
|
2371
|
+
"@netlify/plugins-list": "^6.13.1",
|
|
2372
2372
|
"@netlify/run-utils": "^4.0.0",
|
|
2373
2373
|
"@netlify/zip-it-and-ship-it": "5.8.0",
|
|
2374
2374
|
"@sindresorhus/slugify": "^2.0.0",
|
|
@@ -3110,9 +3110,9 @@
|
|
|
3110
3110
|
}
|
|
3111
3111
|
},
|
|
3112
3112
|
"node_modules/@netlify/config": {
|
|
3113
|
-
"version": "17.0.
|
|
3114
|
-
"resolved": "https://registry.npmjs.org/@netlify/config/-/config-17.0.
|
|
3115
|
-
"integrity": "sha512-
|
|
3113
|
+
"version": "17.0.13",
|
|
3114
|
+
"resolved": "https://registry.npmjs.org/@netlify/config/-/config-17.0.13.tgz",
|
|
3115
|
+
"integrity": "sha512-Qx2r+t0wA0/f7CxWdMgoqIWYSZgiFeSZOw41a2AJiWIEAPHmpes4YtmThSu3oSG3qUjAfKcon8gqL/4K5IG0/Q==",
|
|
3116
3116
|
"dependencies": {
|
|
3117
3117
|
"chalk": "^5.0.0",
|
|
3118
3118
|
"cron-parser": "^4.1.0",
|
|
@@ -26132,9 +26132,9 @@
|
|
|
26132
26132
|
}
|
|
26133
26133
|
},
|
|
26134
26134
|
"@netlify/build": {
|
|
26135
|
-
"version": "26.3.
|
|
26136
|
-
"resolved": "https://registry.npmjs.org/@netlify/build/-/build-26.3.
|
|
26137
|
-
"integrity": "sha512-
|
|
26135
|
+
"version": "26.3.6",
|
|
26136
|
+
"resolved": "https://registry.npmjs.org/@netlify/build/-/build-26.3.6.tgz",
|
|
26137
|
+
"integrity": "sha512-1jfduo2SfD/CpoAShEa1dIfy0LOPkTuXEiqkMW7mE7/YLnvUhkxKrBrxwVsPjH36uUgzUpTa/WFp7pwCpffWaw==",
|
|
26138
26138
|
"requires": {
|
|
26139
26139
|
"@bugsnag/js": "^7.0.0",
|
|
26140
26140
|
"@netlify/cache-utils": "^4.0.0",
|
|
@@ -26142,7 +26142,7 @@
|
|
|
26142
26142
|
"@netlify/functions-utils": "^4.0.0",
|
|
26143
26143
|
"@netlify/git-utils": "^4.0.0",
|
|
26144
26144
|
"@netlify/plugin-edge-handlers": "^3.0.6",
|
|
26145
|
-
"@netlify/plugins-list": "^6.
|
|
26145
|
+
"@netlify/plugins-list": "^6.13.1",
|
|
26146
26146
|
"@netlify/run-utils": "^4.0.0",
|
|
26147
26147
|
"@netlify/zip-it-and-ship-it": "5.8.0",
|
|
26148
26148
|
"@sindresorhus/slugify": "^2.0.0",
|
|
@@ -26597,9 +26597,9 @@
|
|
|
26597
26597
|
}
|
|
26598
26598
|
},
|
|
26599
26599
|
"@netlify/config": {
|
|
26600
|
-
"version": "17.0.
|
|
26601
|
-
"resolved": "https://registry.npmjs.org/@netlify/config/-/config-17.0.
|
|
26602
|
-
"integrity": "sha512-
|
|
26600
|
+
"version": "17.0.13",
|
|
26601
|
+
"resolved": "https://registry.npmjs.org/@netlify/config/-/config-17.0.13.tgz",
|
|
26602
|
+
"integrity": "sha512-Qx2r+t0wA0/f7CxWdMgoqIWYSZgiFeSZOw41a2AJiWIEAPHmpes4YtmThSu3oSG3qUjAfKcon8gqL/4K5IG0/Q==",
|
|
26603
26603
|
"requires": {
|
|
26604
26604
|
"chalk": "^5.0.0",
|
|
26605
26605
|
"cron-parser": "^4.1.0",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.8.1",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Abraham Schilling <AbrahamSchilling@gmail.com> (https://gitlab.com/n4bb12)",
|
|
@@ -200,8 +200,8 @@
|
|
|
200
200
|
"prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!site/package-lock.json\" \"!.github/**/*.md\""
|
|
201
201
|
},
|
|
202
202
|
"dependencies": {
|
|
203
|
-
"@netlify/build": "^26.3.
|
|
204
|
-
"@netlify/config": "^17.0.
|
|
203
|
+
"@netlify/build": "^26.3.6",
|
|
204
|
+
"@netlify/config": "^17.0.13",
|
|
205
205
|
"@netlify/framework-info": "^9.0.2",
|
|
206
206
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
207
207
|
"@netlify/plugin-edge-handlers": "^3.0.6",
|
|
@@ -529,7 +529,12 @@ const deploy = async (options, command) => {
|
|
|
529
529
|
deployFolder,
|
|
530
530
|
functionsFolder,
|
|
531
531
|
})
|
|
532
|
-
const
|
|
532
|
+
const siteEnv = get(siteData, 'build_settings.env')
|
|
533
|
+
const functionsConfig = normalizeFunctionsConfig({
|
|
534
|
+
functionsConfig: config.functions,
|
|
535
|
+
projectRoot: site.root,
|
|
536
|
+
siteEnv,
|
|
537
|
+
})
|
|
533
538
|
|
|
534
539
|
const redirectsPath = `${deployFolder}/_redirects`
|
|
535
540
|
const { restoreConfig, updateConfig } = await netlifyConfigPromise
|
|
@@ -8,8 +8,8 @@ const { injectEnvVariables } = require('../../utils')
|
|
|
8
8
|
* @param {import('../base-command').BaseCommand} command
|
|
9
9
|
*/
|
|
10
10
|
const devExec = async (cmd, options, command) => {
|
|
11
|
-
const { cachedConfig, site } = command.netlify
|
|
12
|
-
await injectEnvVariables({ env: cachedConfig.env, site })
|
|
11
|
+
const { cachedConfig, config, site } = command.netlify
|
|
12
|
+
await injectEnvVariables({ devConfig: { ...config.dev }, env: cachedConfig.env, site })
|
|
13
13
|
|
|
14
14
|
await execa(cmd, command.args.slice(1), {
|
|
15
15
|
stdio: 'inherit',
|
package/src/commands/dev/dev.js
CHANGED
|
@@ -326,7 +326,7 @@ const dev = async (options, command) => {
|
|
|
326
326
|
)
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
await injectEnvVariables({ env: command.netlify.cachedConfig.env, site })
|
|
329
|
+
await injectEnvVariables({ devConfig, env: command.netlify.cachedConfig.env, site })
|
|
330
330
|
|
|
331
331
|
const { addonsUrls, capabilities, siteUrl, timeouts } = await getSiteInformation({
|
|
332
332
|
// inherited from base command --offline
|
|
@@ -477,8 +477,14 @@ const createFunctionAddon = async function ({ addonName, addons, api, siteData,
|
|
|
477
477
|
* @param {(command: import('../base-command').BaseCommand) => any} config.onComplete
|
|
478
478
|
*/
|
|
479
479
|
const handleOnComplete = async ({ command, onComplete }) => {
|
|
480
|
+
const { config } = command.netlify
|
|
481
|
+
|
|
480
482
|
if (onComplete) {
|
|
481
|
-
await injectEnvVariables({
|
|
483
|
+
await injectEnvVariables({
|
|
484
|
+
devConfig: { ...config.dev },
|
|
485
|
+
env: command.netlify.cachedConfig.env,
|
|
486
|
+
site: command.netlify.site,
|
|
487
|
+
})
|
|
482
488
|
await onComplete.call(command)
|
|
483
489
|
}
|
|
484
490
|
}
|
|
@@ -491,6 +497,8 @@ const handleOnComplete = async ({ command, onComplete }) => {
|
|
|
491
497
|
* @param {string} config.fnPath
|
|
492
498
|
*/
|
|
493
499
|
const handleAddonDidInstall = async ({ addonCreated, addonDidInstall, command, fnPath }) => {
|
|
500
|
+
const { config } = command.netlify
|
|
501
|
+
|
|
494
502
|
if (!addonCreated || !addonDidInstall) {
|
|
495
503
|
return
|
|
496
504
|
}
|
|
@@ -508,7 +516,11 @@ const handleAddonDidInstall = async ({ addonCreated, addonDidInstall, command, f
|
|
|
508
516
|
return
|
|
509
517
|
}
|
|
510
518
|
|
|
511
|
-
await injectEnvVariables({
|
|
519
|
+
await injectEnvVariables({
|
|
520
|
+
devConfig: { ...config.dev },
|
|
521
|
+
env: command.netlify.cachedConfig.env,
|
|
522
|
+
site: command.netlify.site,
|
|
523
|
+
})
|
|
512
524
|
addonDidInstall(fnPath)
|
|
513
525
|
}
|
|
514
526
|
|
|
@@ -17,7 +17,7 @@ const functionsServe = async (options, command) => {
|
|
|
17
17
|
|
|
18
18
|
const functionsDir = getFunctionsDir({ options, config }, join('netlify', 'functions'))
|
|
19
19
|
|
|
20
|
-
await injectEnvVariables({ env: command.netlify.cachedConfig.env, site })
|
|
20
|
+
await injectEnvVariables({ devConfig: { ...config.dev }, env: command.netlify.cachedConfig.env, site })
|
|
21
21
|
|
|
22
22
|
const { capabilities, siteUrl, timeouts } = await getSiteInformation({
|
|
23
23
|
offline: options.offline,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The function configuration keys returned by @netlify/config are not an exact
|
|
2
2
|
// match to the properties that @netlify/zip-it-and-ship-it expects. We do that
|
|
3
3
|
// translation here.
|
|
4
|
-
const normalizeFunctionsConfig = ({ functionsConfig = {}, projectRoot }) =>
|
|
4
|
+
const normalizeFunctionsConfig = ({ functionsConfig = {}, projectRoot, siteEnv = {} }) =>
|
|
5
5
|
Object.entries(functionsConfig).reduce(
|
|
6
6
|
(result, [pattern, config]) => ({
|
|
7
7
|
...result,
|
|
@@ -11,6 +11,7 @@ const normalizeFunctionsConfig = ({ functionsConfig = {}, projectRoot }) =>
|
|
|
11
11
|
includedFilesBasePath: projectRoot,
|
|
12
12
|
ignoredNodeModules: config.ignored_node_modules,
|
|
13
13
|
nodeBundler: config.node_bundler === 'esbuild' ? 'esbuild_zisi' : config.node_bundler,
|
|
14
|
+
nodeVersion: siteEnv.AWS_LAMBDA_JS_RUNTIME,
|
|
14
15
|
processDynamicNodeImports: true,
|
|
15
16
|
schedule: config.schedule,
|
|
16
17
|
zipGo: true,
|
|
@@ -37,6 +37,7 @@ const deploySite = async (
|
|
|
37
37
|
maxRetry = DEFAULT_MAX_RETRY,
|
|
38
38
|
// API calls this the 'title'
|
|
39
39
|
message: title,
|
|
40
|
+
siteEnv,
|
|
40
41
|
skipFunctionsCache,
|
|
41
42
|
statusCb = () => {
|
|
42
43
|
/* default to noop */
|
|
@@ -65,6 +66,7 @@ const deploySite = async (
|
|
|
65
66
|
rootDir,
|
|
66
67
|
manifestPath,
|
|
67
68
|
skipFunctionsCache,
|
|
69
|
+
siteEnv,
|
|
68
70
|
}),
|
|
69
71
|
])
|
|
70
72
|
const filesCount = Object.keys(files).length
|
|
@@ -61,7 +61,12 @@ const getFunctionZips = async ({
|
|
|
61
61
|
})
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
const featureFlags = {
|
|
65
|
+
zisi_detect_esm: true,
|
|
66
|
+
zisi_pure_esm: true,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return await zipIt.zipFunctions(directories, tmpDir, { basePath: rootDir, config: functionsConfig, featureFlags })
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
const hashFns = async (
|
package/src/utils/dev.js
CHANGED
|
@@ -139,9 +139,9 @@ const getEnvSourceName = (source) => {
|
|
|
139
139
|
|
|
140
140
|
// Takes a set of environment variables in the format provided by @netlify/config, augments it with variables from both
|
|
141
141
|
// dot-env files and the process itself, and injects into `process.env`.
|
|
142
|
-
const injectEnvVariables = async ({ env, site }) => {
|
|
142
|
+
const injectEnvVariables = async ({ devConfig, env, site }) => {
|
|
143
143
|
const environment = new Map(Object.entries(env))
|
|
144
|
-
const dotEnvFiles = await loadDotEnvFiles({ projectDir: site.root })
|
|
144
|
+
const dotEnvFiles = await loadDotEnvFiles({ envFiles: devConfig.envFiles, projectDir: site.root })
|
|
145
145
|
|
|
146
146
|
dotEnvFiles.forEach(({ env: fileEnv, file }) => {
|
|
147
147
|
Object.keys(fileEnv).forEach((key) => {
|
package/src/utils/dot-env.js
CHANGED
|
@@ -8,8 +8,8 @@ const { isFileAsync } = require('../lib/fs')
|
|
|
8
8
|
|
|
9
9
|
const { warn } = require('./command-helpers')
|
|
10
10
|
|
|
11
|
-
const loadDotEnvFiles = async function ({ projectDir }) {
|
|
12
|
-
const response = await tryLoadDotEnvFiles({ projectDir })
|
|
11
|
+
const loadDotEnvFiles = async function ({ envFiles, projectDir }) {
|
|
12
|
+
const response = await tryLoadDotEnvFiles({ projectDir, dotenvFiles: envFiles })
|
|
13
13
|
|
|
14
14
|
const filesWithWarning = response.filter((el) => el.warning)
|
|
15
15
|
filesWithWarning.forEach((el) => {
|
|
@@ -19,8 +19,10 @@ const loadDotEnvFiles = async function ({ projectDir }) {
|
|
|
19
19
|
return response.filter((el) => el.file && el.env)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
// in the user configuration, the order is highest to lowest
|
|
23
|
+
const defaultEnvFiles = ['.env.development', '.env']
|
|
24
|
+
|
|
25
|
+
const tryLoadDotEnvFiles = async ({ projectDir, dotenvFiles = defaultEnvFiles }) => {
|
|
24
26
|
const results = await Promise.all(
|
|
25
27
|
dotenvFiles.map(async (file) => {
|
|
26
28
|
const filepath = path.resolve(projectDir, file)
|
|
@@ -40,7 +42,8 @@ const tryLoadDotEnvFiles = async ({ projectDir }) => {
|
|
|
40
42
|
}),
|
|
41
43
|
)
|
|
42
44
|
|
|
43
|
-
return
|
|
45
|
+
// we return in order of lowest to highest priority
|
|
46
|
+
return results.filter(Boolean).reverse()
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
module.exports = { loadDotEnvFiles, tryLoadDotEnvFiles }
|