mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
refactor(CLI): Refactor flow into IIFE
This commit is contained in:
parent
eecd9285d5
commit
32013dc9bb
@ -358,8 +358,11 @@ const processSpanPromise = (async () => {
|
||||
serverless.invokedInstance.invocationId = serverless.invocationId;
|
||||
serverless = serverless.invokedInstance;
|
||||
}
|
||||
if (configuration) {
|
||||
if (configuration.plugins && providerName) {
|
||||
|
||||
// IIFE for maintanance convenience
|
||||
await (async () => {
|
||||
if (!configuration || !providerName) return;
|
||||
if (configuration.plugins) {
|
||||
// TODO: Remove "serverless.pluginManager.externalPlugins" check with next major
|
||||
if (serverless.pluginManager.externalPlugins) {
|
||||
if (serverless.pluginManager.externalPlugins.size) {
|
||||
@ -383,22 +386,22 @@ const processSpanPromise = (async () => {
|
||||
variablesMeta = null;
|
||||
}
|
||||
}
|
||||
if (isHelpRequest) return;
|
||||
if (!_.get(variablesMeta, 'size')) return;
|
||||
|
||||
if (!isHelpRequest && _.get(variablesMeta, 'size')) {
|
||||
if (commandSchema) {
|
||||
resolverConfiguration.options = filterSupportedOptions(options, {
|
||||
commandSchema,
|
||||
providerName,
|
||||
});
|
||||
}
|
||||
resolverConfiguration.sources.sls = require('../lib/configuration/variables/sources/instance-dependent/get-sls')(
|
||||
serverless
|
||||
);
|
||||
resolverConfiguration.fulfilledSources.add('opt').add('sls');
|
||||
await resolveVariables(resolverConfiguration);
|
||||
eventuallyReportVariableResolutionErrors(configurationPath, configuration, variablesMeta);
|
||||
if (commandSchema) {
|
||||
resolverConfiguration.options = filterSupportedOptions(options, {
|
||||
commandSchema,
|
||||
providerName,
|
||||
});
|
||||
}
|
||||
}
|
||||
resolverConfiguration.sources.sls = require('../lib/configuration/variables/sources/instance-dependent/get-sls')(
|
||||
serverless
|
||||
);
|
||||
resolverConfiguration.fulfilledSources.add('opt').add('sls');
|
||||
await resolveVariables(resolverConfiguration);
|
||||
eventuallyReportVariableResolutionErrors(configurationPath, configuration, variablesMeta);
|
||||
})();
|
||||
|
||||
if (isHelpRequest && serverless.pluginManager.externalPlugins) {
|
||||
require('../lib/cli/render-help')(serverless.pluginManager.externalPlugins);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user