Expose the envName as a programmatic and CLI option.
This commit is contained in:
@@ -103,7 +103,7 @@ class OptionManager {
|
||||
init(inputOpts: {}) {
|
||||
const args = validate("arguments", inputOpts);
|
||||
|
||||
const envName = getEnv();
|
||||
const { envName = getEnv() } = args;
|
||||
|
||||
const configChain = buildConfigChain(args, envName);
|
||||
if (!configChain) return null;
|
||||
@@ -133,6 +133,7 @@ class OptionManager {
|
||||
.filter(plugins => plugins.length > 0)
|
||||
.map(plugins => ({ plugins }));
|
||||
opts.passPerPreset = opts.presets.length > 0;
|
||||
opts.envName = envName;
|
||||
|
||||
return {
|
||||
options: opts,
|
||||
|
||||
@@ -28,6 +28,10 @@ const ROOT_VALIDATORS: ValidatorSet = {
|
||||
>),
|
||||
code: (assertBoolean: Validator<$PropertyType<ValidatedOptions, "code">>),
|
||||
ast: (assertBoolean: Validator<$PropertyType<ValidatedOptions, "ast">>),
|
||||
|
||||
envName: (assertString: Validator<
|
||||
$PropertyType<ValidatedOptions, "envName">,
|
||||
>),
|
||||
};
|
||||
|
||||
const NONPRESET_VALIDATORS: ValidatorSet = {
|
||||
@@ -130,6 +134,7 @@ export type ValidatedOptions = {
|
||||
code?: boolean,
|
||||
ast?: boolean,
|
||||
inputSourceMap?: RootInputSourceMapOption,
|
||||
envName?: string,
|
||||
|
||||
extends?: string,
|
||||
env?: EnvSet<ValidatedOptions>,
|
||||
|
||||
Reference in New Issue
Block a user