Skip to content

Commit

Permalink
refactor: replace after:package:initialize by `'before:package:crea…
Browse files Browse the repository at this point in the history
…teDeploymentArtifacts`
  • Loading branch information
juanjoDiaz committed Feb 19, 2021
1 parent 8ef605d commit c46f7b8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ end

WarmUp plugin uses 3 lifecycles hooks:

* `warmup:addWamers:addWamers`: This is where the warmers are added to the service. It runs `after:package:initialize`.
* `warmup:addWamers:addWamers`: This is where the warmers are added to the service. It runs `before:package:createDeploymentArtifacts`.
* `warmup:cleanupTempDir:cleanup`: This is where the warmers' temp folders are removed. It runs `after:package:createDeploymentArtifacts`.
* `warmup:prewarm:start`: This is where the warmers are invoked. It runs `after:deploy:deploy` or when running the command `serverless warmup prewarm`.
* `warmup:prewarm:end`: This is after the warmers are invoked.
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class WarmUp {
};

this.hooks = {
'after:package:initialize': () => this.serverless.pluginManager.spawn('warmup:addWamers'),
'before:package:createDeploymentArtifacts': () => this.serverless.pluginManager.spawn('warmup:addWamers'),
'after:package:createDeploymentArtifacts': () => this.serverless.pluginManager.spawn('warmup:cleanupTempDir'),
'after:deploy:deploy': () => this.serverless.pluginManager.spawn('warmup:prewarm'),
'before:warmup:addWamers:addWamers': this.configPlugin.bind(this),
Expand Down
2 changes: 1 addition & 1 deletion test/hook.warmupAddWamersAddWamers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Serverless warmup plugin warmup:warmers:addWamers:addWamers hook', ()
});
const plugin = new WarmUp(serverless, {});

await plugin.hooks['after:package:initialize']();
await plugin.hooks['before:package:createDeploymentArtifacts']();

expect(serverless.pluginManager.spawn).toHaveBeenCalledTimes(1);
expect(serverless.pluginManager.spawn).toHaveBeenCalledWith('warmup:addWamers');
Expand Down

0 comments on commit c46f7b8

Please sign in to comment.