netlify-cli 6.9.4 → 6.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/npm-shrinkwrap.json +360 -322
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
- package/scripts/postinstall.js +1 -1
- package/src/commands/addons/auth.js +2 -2
- package/src/commands/addons/config.js +2 -3
- package/src/commands/addons/create.js +5 -5
- package/src/commands/addons/delete.js +4 -4
- package/src/commands/dev/exec.js +2 -2
- package/src/commands/dev/index.js +7 -7
- package/src/commands/functions/build.js +3 -3
- package/src/commands/functions/create.js +12 -17
- package/src/commands/functions/invoke.js +7 -6
- package/src/commands/functions/list.js +12 -12
- package/src/commands/functions/serve.js +2 -4
- package/src/commands/lm/info.js +1 -1
- package/src/commands/open/admin.js +10 -10
- package/src/commands/open/site.js +8 -8
- package/src/commands/sites/create.js +5 -5
- package/src/commands/sites/delete.js +11 -11
- package/src/functions-templates/js/stripe-charge/package-lock.json +13 -13
- package/src/functions-templates/js/stripe-subscription/package-lock.json +13 -13
- package/src/functions-templates/js/token-hider/package-lock.json +6 -6
- package/src/functions-templates/ts/hello-world/package-lock.json +7 -7
- package/src/lib/fs.js +1 -1
- package/src/lib/functions/runtimes/go/index.js +1 -1
- package/src/lib/functions/server.js +3 -4
- package/src/utils/addons/prepare.js +7 -7
- package/src/utils/command.js +1 -1
- package/src/utils/dev.js +6 -6
- package/src/utils/dot-env.js +5 -1
- package/src/utils/get-global-config.js +1 -1
- package/src/utils/init/config-github.js +1 -1
- package/src/utils/lm/install.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const chalk = require('chalk')
|
|
2
2
|
|
|
3
|
-
const { log } = require('../command-helpers')
|
|
3
|
+
const { log, error } = require('../command-helpers')
|
|
4
4
|
|
|
5
5
|
const ADDON_VALIDATION = {
|
|
6
6
|
EXISTS: 'EXISTS',
|
|
@@ -47,7 +47,7 @@ const validateCurrentAddon = ({ addon, validation, addonName, siteData, warn, ex
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const getAddonManifest = async ({ api, addonName
|
|
50
|
+
const getAddonManifest = async ({ api, addonName }) => {
|
|
51
51
|
let manifest
|
|
52
52
|
try {
|
|
53
53
|
manifest = await api.showServiceManifest({ addonName })
|
|
@@ -61,7 +61,7 @@ const getAddonManifest = async ({ api, addonName, error }) => {
|
|
|
61
61
|
return manifest
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
const getSiteData = async ({ api, siteId
|
|
64
|
+
const getSiteData = async ({ api, siteId }) => {
|
|
65
65
|
let siteData
|
|
66
66
|
try {
|
|
67
67
|
siteData = await api.getSite({ siteId })
|
|
@@ -71,7 +71,7 @@ const getSiteData = async ({ api, siteId, error }) => {
|
|
|
71
71
|
return siteData
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const getAddons = async ({ api, siteId
|
|
74
|
+
const getAddons = async ({ api, siteId }) => {
|
|
75
75
|
let addons
|
|
76
76
|
try {
|
|
77
77
|
addons = await api.listServiceInstancesForSite({ siteId })
|
|
@@ -82,7 +82,7 @@ const getAddons = async ({ api, siteId, error }) => {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
const prepareAddonCommand = async ({ context, addonName, validation }) => {
|
|
85
|
-
const { netlify, warn,
|
|
85
|
+
const { netlify, warn, exit } = context
|
|
86
86
|
const { api, site } = netlify
|
|
87
87
|
const siteId = site.id
|
|
88
88
|
if (!siteId) {
|
|
@@ -93,8 +93,8 @@ const prepareAddonCommand = async ({ context, addonName, validation }) => {
|
|
|
93
93
|
|
|
94
94
|
const [manifest, siteData, addons] = await Promise.all([
|
|
95
95
|
addonName ? getAddonManifest({ api, addonName, error }) : Promise.resolve(),
|
|
96
|
-
getSiteData({ api, siteId
|
|
97
|
-
getAddons({ api, siteId
|
|
96
|
+
getSiteData({ api, siteId }),
|
|
97
|
+
getAddons({ api, siteId }),
|
|
98
98
|
])
|
|
99
99
|
|
|
100
100
|
let addon
|
package/src/utils/command.js
CHANGED
package/src/utils/dev.js
CHANGED
|
@@ -8,7 +8,7 @@ const isEmpty = require('lodash/isEmpty')
|
|
|
8
8
|
|
|
9
9
|
const { supportsBackgroundFunctions } = require('../lib/account')
|
|
10
10
|
|
|
11
|
-
const { log } = require('./command-helpers')
|
|
11
|
+
const { log, warn } = require('./command-helpers')
|
|
12
12
|
const { loadDotEnvFiles } = require('./dot-env')
|
|
13
13
|
const { NETLIFYDEVLOG } = require('./logo')
|
|
14
14
|
|
|
@@ -73,7 +73,7 @@ const getAddonsInformation = ({ siteInfo, addons }) => {
|
|
|
73
73
|
return { urls, env }
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
const getSiteAccount = ({ siteInfo, accounts
|
|
76
|
+
const getSiteAccount = ({ siteInfo, accounts }) => {
|
|
77
77
|
const siteAccount = accounts.find((account) => account.slug === siteInfo.account_slug)
|
|
78
78
|
if (!siteAccount) {
|
|
79
79
|
warn(`Could not find account for site '${siteInfo.name}' with account slug '${siteInfo.account_slug}'`)
|
|
@@ -88,7 +88,7 @@ const SYNCHRONOUS_FUNCTION_TIMEOUT = 10
|
|
|
88
88
|
// default 15 minutes for background functions
|
|
89
89
|
const BACKGROUND_FUNCTION_TIMEOUT = 900
|
|
90
90
|
|
|
91
|
-
const getSiteInformation = async ({ flags = {}, api, site,
|
|
91
|
+
const getSiteInformation = async ({ flags = {}, api, site, error: failAndExit, siteInfo }) => {
|
|
92
92
|
if (site.id && !flags.offline) {
|
|
93
93
|
validateSiteInfo({ site, siteInfo, failAndExit })
|
|
94
94
|
const [accounts, addons] = await Promise.all([
|
|
@@ -97,7 +97,7 @@ const getSiteInformation = async ({ flags = {}, api, site, warn, error: failAndE
|
|
|
97
97
|
])
|
|
98
98
|
|
|
99
99
|
const { urls: addonsUrls } = getAddonsInformation({ siteInfo, addons })
|
|
100
|
-
const account = getSiteAccount({ siteInfo, accounts
|
|
100
|
+
const account = getSiteAccount({ siteInfo, accounts })
|
|
101
101
|
|
|
102
102
|
return {
|
|
103
103
|
addonsUrls,
|
|
@@ -132,9 +132,9 @@ const getEnvSourceName = (source) => {
|
|
|
132
132
|
|
|
133
133
|
// Takes a set of environment variables in the format provided by @netlify/config, augments it with variables from both
|
|
134
134
|
// dot-env files and the process itself, and injects into `process.env`.
|
|
135
|
-
const injectEnvVariables = async ({ env, site
|
|
135
|
+
const injectEnvVariables = async ({ env, site }) => {
|
|
136
136
|
const environment = new Map(Object.entries(env))
|
|
137
|
-
const dotEnvFiles = await loadDotEnvFiles({ projectDir: site.root
|
|
137
|
+
const dotEnvFiles = await loadDotEnvFiles({ projectDir: site.root })
|
|
138
138
|
|
|
139
139
|
dotEnvFiles.forEach(({ file, env: fileEnv }) => {
|
|
140
140
|
Object.keys(fileEnv).forEach((key) => {
|
package/src/utils/dot-env.js
CHANGED
|
@@ -4,7 +4,11 @@ const dotenv = require('dotenv')
|
|
|
4
4
|
|
|
5
5
|
const { isFileAsync, readFileAsync } = require('../lib/fs')
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const { warn: warn_ } = require('./command-helpers')
|
|
8
|
+
|
|
9
|
+
const loadDotEnvFiles = async function ({ projectDir, warnLog }) {
|
|
10
|
+
// a stub utility is used in tests
|
|
11
|
+
const warn = warnLog || warn_
|
|
8
12
|
const dotenvFiles = ['.env', '.env.development']
|
|
9
13
|
const results = await Promise.all(
|
|
10
14
|
dotenvFiles.map(async (file) => {
|
|
@@ -20,7 +20,7 @@ const getGlobalConfigOnce = async function () {
|
|
|
20
20
|
// Read legacy config if exists
|
|
21
21
|
try {
|
|
22
22
|
legacyConfig = JSON.parse(await readFileAsync(legacyPath))
|
|
23
|
-
} catch
|
|
23
|
+
} catch {}
|
|
24
24
|
// Use legacy config as default values
|
|
25
25
|
const defaults = { ...globalConfigDefaults, ...legacyConfig }
|
|
26
26
|
const configStore = new Configstore(null, defaults, { configPath })
|
|
@@ -84,7 +84,7 @@ const hookExists = async ({ deployHook, octokit, repoOwner, repoName }) => {
|
|
|
84
84
|
})
|
|
85
85
|
const exists = hooks.some((hook) => hook.config.url === deployHook)
|
|
86
86
|
return exists
|
|
87
|
-
} catch
|
|
87
|
+
} catch {
|
|
88
88
|
// we don't need to fail if listHooks errors out
|
|
89
89
|
return false
|
|
90
90
|
}
|