Hook tracer plugin

When I first tried to make sense of Serverless hooks and how they relate to each other, the system made an impression of being overly complex and intertwined so I wrote a simple plugin that traces the hooks being invoked. It seems to me that the community may benefit from this plugin too, so here it is:

All you need to do is to add this plugin to your serverless.yml and the next time you run a command, it will show you the hooks that has been invoked in the process:

$ tail serverless.yml
plugins:
  - serverless-plugin-stackstorm
  - serverless-plugin-tracer

$ SLS_DEBUG=* sls package
Serverless: Load command run
Serverless: Load command config
...
Serverless: Invoke package
Serverless: Running hook before:package:cleanup of plugin Package.
Serverless: Running hook package:cleanup of plugin AwsPackage.
Serverless: Invoke aws:common:validate
Serverless: Running hook aws:common:validate:validate of plugin AwsCommon.
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Running hook aws:common:cleanupTempDir:cleanup of plugin AwsCommon.
Serverless: Running hook package:initialize of plugin AwsPackage.
Serverless: Running hook package:setupProviderConfiguration of plugin AwsPackage.
Serverless: Running hook before:package:createDeploymentArtifacts of plugin StackstormPlugin.
...
Serverless: Running hook package:createDeploymentArtifacts of plugin Package.
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Running hook before:package:compileFunctions of plugin AwsPackage.
Serverless: Running hook package:compileFunctions of plugin AwsCompileFunctions.
Serverless: Running hook package:compileEvents of plugin AwsCompileCognitoUserPoolEvents.
Serverless: Running hook package:finalize of plugin AwsPackage.
Serverless: Invoke aws:package:finalize
Serverless: Running hook aws:package:finalize:mergeCustomProviderResources of plugin AwsPackage.
Serverless: Running hook aws:package:finalize:saveServiceState of plugin AwsPackage.
Serverless: Invoke aws:common:moveArtifactsToPackage
Serverless: Running hook aws:common:moveArtifactsToPackage:move of plugin AwsCommon.
4 Likes