@netlify/config 18.2.6-rc-rc → 18.2.6
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.js +5 -0
- package/lib/api/build_settings.js +20 -33
- package/lib/api/client.js +10 -13
- package/lib/api/site_info.js +48 -56
- package/lib/base.js +10 -18
- package/lib/bin/flags.js +134 -142
- package/lib/bin/main.js +49 -63
- package/lib/build_dir.js +11 -15
- package/lib/cached_config.js +14 -17
- package/lib/case.js +16 -35
- package/lib/context.js +62 -84
- package/lib/default.js +18 -22
- package/lib/env/envelope.js +23 -23
- package/lib/env/git.js +18 -18
- package/lib/env/main.js +127 -179
- package/lib/error.js +19 -27
- package/lib/events.js +18 -19
- package/lib/files.js +63 -87
- package/lib/functions_config.js +36 -52
- package/lib/headers.js +17 -27
- package/lib/inline_config.js +6 -7
- package/lib/log/cleanup.js +54 -82
- package/lib/log/logger.js +25 -36
- package/lib/log/main.js +31 -40
- package/lib/log/messages.js +56 -95
- package/lib/log/options.js +24 -38
- package/lib/log/serialize.js +3 -4
- package/lib/log/theme.js +10 -11
- package/lib/main.js +188 -263
- package/lib/merge.js +25 -35
- package/lib/merge_normalize.js +17 -24
- package/lib/mutations/apply.js +53 -65
- package/lib/mutations/config_prop_name.js +6 -8
- package/lib/mutations/update.js +79 -98
- package/lib/normalize.js +24 -28
- package/lib/options/base.js +39 -51
- package/lib/options/branch.js +23 -26
- package/lib/options/feature_flags.js +7 -10
- package/lib/options/main.js +76 -96
- package/lib/options/repository_root.js +11 -16
- package/lib/origin.js +22 -29
- package/lib/parse.js +42 -55
- package/lib/path.js +29 -40
- package/lib/redirects.js +16 -26
- package/lib/simplify.js +66 -92
- package/lib/utils/group.js +5 -6
- package/lib/utils/remove_falsy.js +9 -13
- package/lib/utils/set.js +19 -25
- package/lib/utils/toml.js +13 -16
- package/lib/validate/context.js +24 -43
- package/lib/validate/example.js +20 -27
- package/lib/validate/helpers.js +17 -23
- package/lib/validate/identical.js +8 -12
- package/lib/validate/main.js +83 -127
- package/lib/validate/validations.js +243 -257
- package/package.json +14 -8
package/bin.js
ADDED
|
@@ -1,41 +1,28 @@
|
|
|
1
|
-
import { removeFalsy } from '../utils/remove_falsy.js'
|
|
2
|
-
|
|
1
|
+
import { removeFalsy } from '../utils/remove_falsy.js';
|
|
3
2
|
// Netlify UI build settings are used as default configuration values in
|
|
4
3
|
// production. In local builds, we retrieve them with `getSite` (`siteInfo`)
|
|
5
4
|
// instead.
|
|
6
5
|
// This also includes UI-installed plugins.
|
|
7
|
-
export const addBuildSettings = function ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return { defaultConfig, baseRelDir }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const defaultConfigA = getDefaultConfig(buildSettings, defaultConfig, plugins)
|
|
17
|
-
const baseRelDirA = getBaseRelDir(buildSettings, baseRelDir)
|
|
18
|
-
return { defaultConfig: defaultConfigA, baseRelDir: baseRelDirA }
|
|
19
|
-
}
|
|
20
|
-
|
|
6
|
+
export const addBuildSettings = function ({ defaultConfig, baseRelDir, siteInfo: { build_settings: buildSettings, plugins }, }) {
|
|
7
|
+
if (buildSettings === undefined) {
|
|
8
|
+
return { defaultConfig, baseRelDir };
|
|
9
|
+
}
|
|
10
|
+
const defaultConfigA = getDefaultConfig(buildSettings, defaultConfig, plugins);
|
|
11
|
+
const baseRelDirA = getBaseRelDir(buildSettings, baseRelDir);
|
|
12
|
+
return { defaultConfig: defaultConfigA, baseRelDir: baseRelDirA };
|
|
13
|
+
};
|
|
21
14
|
// From the `getSite` API response to the corresponding configuration properties
|
|
22
|
-
const getDefaultConfig = function (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const uiPluginsA = uiPlugins.map(normalizeUiPlugin)
|
|
30
|
-
const pluginsA = [...uiPluginsA, ...plugins]
|
|
31
|
-
return { ...defaultConfig, build: { ...siteBuild, ...build }, plugins: pluginsA, ...functions }
|
|
32
|
-
}
|
|
33
|
-
|
|
15
|
+
const getDefaultConfig = function ({ cmd: command, dir: publish, functions_dir: functionsDirectory, base }, { build, plugins = [], ...defaultConfig }, uiPlugins = []) {
|
|
16
|
+
const siteBuild = removeFalsy({ command, publish, base });
|
|
17
|
+
const functions = functionsDirectory ? { functionsDirectory, functionsDirectoryOrigin: 'ui' } : {};
|
|
18
|
+
const uiPluginsA = uiPlugins.map(normalizeUiPlugin);
|
|
19
|
+
const pluginsA = [...uiPluginsA, ...plugins];
|
|
20
|
+
return { ...defaultConfig, build: { ...siteBuild, ...build }, plugins: pluginsA, ...functions };
|
|
21
|
+
};
|
|
34
22
|
// Make sure we know which fields we are picking from the API
|
|
35
23
|
const normalizeUiPlugin = function ({ package: packageName, inputs, pinned_version: pinnedVersion }) {
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
24
|
+
return { package: packageName, inputs, pinned_version: pinnedVersion };
|
|
25
|
+
};
|
|
39
26
|
const getBaseRelDir = function ({ base_rel_dir: siteBaseRelDir }, baseRelDir = siteBaseRelDir) {
|
|
40
|
-
|
|
41
|
-
}
|
|
27
|
+
return Boolean(baseRelDir);
|
|
28
|
+
};
|
package/lib/api/client.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { NetlifyAPI } from 'netlify'
|
|
2
|
-
|
|
3
|
-
import { removeUndefined } from '../utils/remove_falsy.js'
|
|
4
|
-
|
|
1
|
+
import { NetlifyAPI } from 'netlify';
|
|
2
|
+
import { removeUndefined } from '../utils/remove_falsy.js';
|
|
5
3
|
// Retrieve Netlify API client, if an access token was passed
|
|
6
4
|
export const getApiClient = function ({ token, offline, testOpts = {}, host, scheme, pathPrefix }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
5
|
+
if (!token || offline) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
// TODO: find less intrusive way to mock HTTP requests
|
|
9
|
+
const parameters = removeUndefined({ scheme: testOpts.scheme || scheme, host: testOpts.host || host, pathPrefix });
|
|
10
|
+
const api = new NetlifyAPI(token, parameters);
|
|
11
|
+
return api;
|
|
12
|
+
};
|
package/lib/api/site_info.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { getEnvelope } from '../env/envelope.js'
|
|
2
|
-
import { throwUserError } from '../error.js'
|
|
3
|
-
import { ERROR_CALL_TO_ACTION } from '../log/messages.js'
|
|
4
|
-
|
|
1
|
+
import { getEnvelope } from '../env/envelope.js';
|
|
2
|
+
import { throwUserError } from '../error.js';
|
|
3
|
+
import { ERROR_CALL_TO_ACTION } from '../log/messages.js';
|
|
5
4
|
// Retrieve Netlify Site information, if available.
|
|
6
5
|
// Used to retrieve local build environment variables and UI build settings.
|
|
7
6
|
// This is not used in production builds since the buildbot passes this
|
|
@@ -9,59 +8,52 @@ import { ERROR_CALL_TO_ACTION } from '../log/messages.js'
|
|
|
9
8
|
// Requires knowing the `siteId` and having the access `token`.
|
|
10
9
|
// Silently ignore API errors. For example the network connection might be down,
|
|
11
10
|
// but local builds should still work regardless.
|
|
12
|
-
// eslint-disable-next-line complexity
|
|
13
11
|
export const getSiteInfo = async function ({ api, siteId, mode, testOpts: { env: testEnv = true } = {} }) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return { siteInfo, accounts, addons }
|
|
32
|
-
}
|
|
33
|
-
|
|
12
|
+
if (api === undefined || mode === 'buildbot' || !testEnv) {
|
|
13
|
+
const siteInfo = siteId === undefined ? {} : { id: siteId };
|
|
14
|
+
return { siteInfo, accounts: [], addons: [] };
|
|
15
|
+
}
|
|
16
|
+
const [siteInfo, accounts, addons] = await Promise.all([
|
|
17
|
+
getSite(api, siteId),
|
|
18
|
+
getAccounts(api),
|
|
19
|
+
getAddons(api, siteId),
|
|
20
|
+
]);
|
|
21
|
+
if (siteInfo.use_envelope) {
|
|
22
|
+
const envelope = await getEnvelope({ api, accountId: siteInfo.account_slug, siteId });
|
|
23
|
+
siteInfo.build_settings.env = envelope;
|
|
24
|
+
}
|
|
25
|
+
return { siteInfo, accounts, addons };
|
|
26
|
+
};
|
|
34
27
|
const getSite = async function (api, siteId) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
28
|
+
if (siteId === undefined) {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const site = await api.getSite({ siteId });
|
|
33
|
+
return { ...site, id: siteId };
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throwUserError(`Failed retrieving site data for site ${siteId}: ${error.message}. ${ERROR_CALL_TO_ACTION}`);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
47
39
|
const getAccounts = async function (api) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
40
|
+
try {
|
|
41
|
+
const accounts = await api.listAccountsForUser();
|
|
42
|
+
return Array.isArray(accounts) ? accounts : [];
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
throwUserError(`Failed retrieving user account: ${error.message}. ${ERROR_CALL_TO_ACTION}`);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
56
48
|
const getAddons = async function (api, siteId) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
49
|
+
if (siteId === undefined) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const addons = await api.listServiceInstancesForSite({ siteId });
|
|
54
|
+
return Array.isArray(addons) ? addons : [];
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throwUserError(`Failed retrieving addons for site ${siteId}: ${error.message}. ${ERROR_CALL_TO_ACTION}`);
|
|
58
|
+
}
|
|
59
|
+
};
|
package/lib/base.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { resolvePath } from './files.js'
|
|
2
|
-
|
|
1
|
+
import { resolvePath } from './files.js';
|
|
3
2
|
// Retrieve the first `base` directory used to load the first config file.
|
|
4
|
-
export const getInitialBase = function ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
inlineConfig: { build: { base: initialBase = defaultBase } = {} },
|
|
8
|
-
}) {
|
|
9
|
-
return resolveBase(repositoryRoot, initialBase)
|
|
10
|
-
}
|
|
11
|
-
|
|
3
|
+
export const getInitialBase = function ({ repositoryRoot, defaultConfig: { build: { base: defaultBase } = {} }, inlineConfig: { build: { base: initialBase = defaultBase } = {} }, }) {
|
|
4
|
+
return resolveBase(repositoryRoot, initialBase);
|
|
5
|
+
};
|
|
12
6
|
// Two config files can be used:
|
|
13
7
|
// - The first one, using the `config` property or doing a default lookup
|
|
14
8
|
// of `netlify.toml`
|
|
@@ -21,14 +15,12 @@ export const getInitialBase = function ({
|
|
|
21
15
|
// If the second file has a `base` property, it is ignored, i.e. it is not
|
|
22
16
|
// recursive.
|
|
23
17
|
export const getBase = function (base, repositoryRoot, config) {
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
18
|
+
return base === undefined ? resolveBase(repositoryRoot, config.build.base) : base;
|
|
19
|
+
};
|
|
27
20
|
const resolveBase = function (repositoryRoot, base) {
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
21
|
+
return resolvePath(repositoryRoot, repositoryRoot, base, 'build.base');
|
|
22
|
+
};
|
|
31
23
|
// Also `config.build.base`.
|
|
32
24
|
export const addBase = function (config, base) {
|
|
33
|
-
|
|
34
|
-
}
|
|
25
|
+
return { ...config, build: { ...config.build, base } };
|
|
26
|
+
};
|
package/lib/bin/flags.js
CHANGED
|
@@ -1,181 +1,173 @@
|
|
|
1
|
-
import process from 'process'
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { normalizeCliFeatureFlags } from '../options/feature_flags.js'
|
|
8
|
-
|
|
1
|
+
import process from 'process';
|
|
2
|
+
import filterObj from 'filter-obj';
|
|
3
|
+
import yargs from 'yargs';
|
|
4
|
+
import { hideBin } from 'yargs/helpers';
|
|
5
|
+
import { normalizeCliFeatureFlags } from '../options/feature_flags.js';
|
|
9
6
|
// Parse CLI flags
|
|
10
7
|
export const parseFlags = function () {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
8
|
+
const { featureFlags: cliFeatureFlags = '', ...flags } = yargs(hideBin(process.argv))
|
|
9
|
+
.options(FLAGS)
|
|
10
|
+
.usage(USAGE)
|
|
11
|
+
.parse();
|
|
12
|
+
const featureFlags = normalizeCliFeatureFlags(cliFeatureFlags);
|
|
13
|
+
const flagsA = { ...flags, featureFlags };
|
|
14
|
+
const flagsB = filterObj(flagsA, isUserFlag);
|
|
15
|
+
return flagsB;
|
|
16
|
+
};
|
|
21
17
|
const jsonParse = function (value) {
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
18
|
+
return value === undefined ? undefined : JSON.parse(value);
|
|
19
|
+
};
|
|
25
20
|
// List of CLI flags
|
|
26
21
|
const FLAGS = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
config: {
|
|
23
|
+
string: true,
|
|
24
|
+
describe: `Path to the configuration file.
|
|
30
25
|
Defaults to any netlify.toml in the git repository root directory or the base directory`,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
},
|
|
27
|
+
defaultConfig: {
|
|
28
|
+
string: true,
|
|
29
|
+
describe: `JSON configuration object containing default values.
|
|
35
30
|
Each configuration default value is used unless overriden through the main configuration file.
|
|
36
31
|
Default: none.`,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
coerce: jsonParse,
|
|
33
|
+
hidden: true,
|
|
34
|
+
},
|
|
35
|
+
cachedConfig: {
|
|
36
|
+
string: true,
|
|
37
|
+
describe: `JSON configuration object returned by @netlify/config when --output=/ is used
|
|
43
38
|
or when using @netlify/config programmatically.
|
|
44
39
|
This is done as a performance optimization to cache the configuration loading logic.
|
|
45
40
|
Default: none.`,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
coerce: jsonParse,
|
|
42
|
+
hidden: true,
|
|
43
|
+
},
|
|
44
|
+
cachedConfigPath: {
|
|
45
|
+
string: true,
|
|
46
|
+
describe: `File path to the JSON configuration object returned by @netlify/config
|
|
52
47
|
when --output=/path is used.
|
|
53
48
|
This is done as a performance optimization to cache the configuration loading logic.
|
|
54
49
|
Default: none.`,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
hidden: true,
|
|
51
|
+
},
|
|
52
|
+
inlineConfig: {
|
|
53
|
+
string: true,
|
|
54
|
+
describe: `JSON configuration object overriding the configuration file and other settings.
|
|
60
55
|
Default: none.`,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
coerce: jsonParse,
|
|
57
|
+
hidden: true,
|
|
58
|
+
},
|
|
59
|
+
configMutations: {
|
|
60
|
+
array: true,
|
|
61
|
+
describe: `Array of changes to apply to the configuration.
|
|
67
62
|
Each change must be an object with three properties:
|
|
68
63
|
- "keys": array of keys targetting the property to change
|
|
69
64
|
- "value": new value of that property
|
|
70
65
|
- "event": build event when this change was applied, e.g. "onPreBuild"
|
|
71
66
|
Default: empty array.`,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
coerce: jsonParse,
|
|
68
|
+
hidden: true,
|
|
69
|
+
},
|
|
70
|
+
cwd: {
|
|
71
|
+
string: true,
|
|
72
|
+
describe: `Current directory. Used to retrieve the configuration file.
|
|
78
73
|
Default: current directory`,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
},
|
|
75
|
+
repositoryRoot: {
|
|
76
|
+
string: true,
|
|
77
|
+
describe: `Git repository root directory. Used to retrieve the configuration file.
|
|
83
78
|
Default: automatically guessed`,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
},
|
|
80
|
+
output: {
|
|
81
|
+
string: true,
|
|
82
|
+
describe: `Where to output the JSON result.
|
|
88
83
|
Default: "-" (stdout)`,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
},
|
|
85
|
+
stable: {
|
|
86
|
+
boolean: true,
|
|
87
|
+
describe: `Sort keys printed in the output.
|
|
93
88
|
Default: false`,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
89
|
+
default: false,
|
|
90
|
+
},
|
|
91
|
+
token: {
|
|
92
|
+
string: true,
|
|
93
|
+
describe: `Netlify API token for authentication.
|
|
99
94
|
The NETLIFY_AUTH_TOKEN environment variable can be used as well.`,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
95
|
+
},
|
|
96
|
+
host: {
|
|
97
|
+
string: true,
|
|
98
|
+
describe: `Host of the Netlify API.`,
|
|
99
|
+
hidden: true,
|
|
100
|
+
},
|
|
101
|
+
scheme: {
|
|
102
|
+
string: true,
|
|
103
|
+
describe: `Scheme/protocol of the Netlify API.`,
|
|
104
|
+
hidden: true,
|
|
105
|
+
},
|
|
106
|
+
pathPrefix: {
|
|
107
|
+
string: true,
|
|
108
|
+
describe: `Base path prefix of the Netlify API.`,
|
|
109
|
+
hidden: true,
|
|
110
|
+
},
|
|
111
|
+
siteId: {
|
|
112
|
+
string: true,
|
|
113
|
+
describe: `Netlify Site ID.`,
|
|
114
|
+
},
|
|
115
|
+
context: {
|
|
116
|
+
string: true,
|
|
117
|
+
describe: `Build context.
|
|
123
118
|
Default: 'production'`,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
},
|
|
120
|
+
branch: {
|
|
121
|
+
string: true,
|
|
122
|
+
describe: `Repository branch.
|
|
128
123
|
Default: automatically guessed`,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
},
|
|
125
|
+
baseRelDir: {
|
|
126
|
+
boolean: true,
|
|
127
|
+
describe: `Feature flag meant for backward compatibility.
|
|
133
128
|
When enabled, if the 'build.base' configuration property is defined, it is used
|
|
134
129
|
to try to retrieve a second configuration file and discard the first one.
|
|
135
130
|
Default: true`,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
131
|
+
hidden: true,
|
|
132
|
+
},
|
|
133
|
+
mode: {
|
|
134
|
+
string: true,
|
|
135
|
+
describe: `Environment in which this is loaded. Can be:
|
|
141
136
|
- 'buildbot': within Netlify Buildbot
|
|
142
137
|
- 'cli': within Netlify CLI
|
|
143
138
|
- 'require': through import('@netlify/config')`,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
139
|
+
hidden: true,
|
|
140
|
+
},
|
|
141
|
+
debug: {
|
|
142
|
+
boolean: true,
|
|
143
|
+
describe: 'Print debugging information',
|
|
144
|
+
hidden: true,
|
|
145
|
+
},
|
|
146
|
+
testOpts: {
|
|
147
|
+
describe: 'Options for testing only',
|
|
148
|
+
hidden: true,
|
|
149
|
+
},
|
|
150
|
+
featureFlags: {
|
|
151
|
+
describe: 'Comma-separated list of feature flags to enable unreleased features',
|
|
152
|
+
hidden: true,
|
|
153
|
+
},
|
|
154
|
+
offline: {
|
|
155
|
+
boolean: true,
|
|
156
|
+
describe: `Do not send requests to the Netlify API to retrieve site settings.
|
|
162
157
|
Default: false`,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
158
|
+
},
|
|
159
|
+
buffer: {
|
|
160
|
+
boolean: true,
|
|
161
|
+
describe: 'Buffer output instead of streaming it',
|
|
162
|
+
hidden: true,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
171
165
|
const USAGE = `netlify-config [OPTIONS...]
|
|
172
166
|
|
|
173
167
|
Retrieve and resolve the Netlify configuration.
|
|
174
|
-
The result is printed as a JSON object on stdout
|
|
175
|
-
|
|
168
|
+
The result is printed as a JSON object on stdout.`;
|
|
176
169
|
// Remove `yargs`-specific options, shortcuts, dash-cased and aliases
|
|
177
170
|
const isUserFlag = function (key, value) {
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const INTERNAL_KEYS = new Set(['help', 'version', '_', '$0'])
|
|
171
|
+
return value !== undefined && !INTERNAL_KEYS.has(key) && key.length !== 1 && !key.includes('-');
|
|
172
|
+
};
|
|
173
|
+
const INTERNAL_KEYS = new Set(['help', 'version', '_', '$0']);
|