Skip to content

Commit

Permalink
fix(CLI): Do not validate configuration with plugin .. commands
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Jul 14, 2021
1 parent be441cc commit 040036d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
19 changes: 10 additions & 9 deletions lib/Serverless.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,17 +425,18 @@ class Serverless {
}
}

// merge arrays after variables have been populated
// (https://github.com/serverless/serverless/issues/3511)
this.service.mergeArrays();
if (resolveCliInput().commands[0] !== 'plugin') {
// merge arrays after variables have been populated
// (https://github.com/serverless/serverless/issues/3511)
this.service.mergeArrays();

// populate function names after variables are loaded in case functions were externalized
// (https://github.com/serverless/serverless/issues/2997)
this.service.setFunctionNames(this.processedInput.options);

// If in context of service, validate the service configuration
if (this.serviceDir) this.service.validate();
// populate function names after variables are loaded in case functions were externalized
// (https://github.com/serverless/serverless/issues/2997)
this.service.setFunctionNames(this.processedInput.options);

// If in context of service, validate the service configuration
if (this.serviceDir) this.service.validate();
}
// trigger the plugin lifecycle when there's something which should be processed
await this.pluginManager.run(this.processedInput.commands);
}
Expand Down
8 changes: 5 additions & 3 deletions lib/classes/PluginManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,11 @@ class PluginManager {
* Called by the CLI to start a public command.
*/
async run(commandsArray) {
// first initialize hooks
for (const { hook } of this.getHooks(['initialize'])) {
await hook();
if (resolveCliInput().commands[0] !== 'plugin') {
// first initialize hooks
for (const { hook } of this.getHooks(['initialize'])) {
await hook();
}
}

let deferredBackendNotificationRequest;
Expand Down

0 comments on commit 040036d

Please sign in to comment.