(serverless, options)
| 46 | */ |
| 47 | class AwsDev { |
| 48 | constructor(serverless, options) { |
| 49 | this.serverless = serverless |
| 50 | this.options = options || {} |
| 51 | this.provider = this.serverless.getProvider('aws') |
| 52 | this.originalFunctionConfigs = {} |
| 53 | |
| 54 | Object.assign(this, validate) |
| 55 | |
| 56 | this.commands = { |
| 57 | 'dev-build': { |
| 58 | groupName: 'main', |
| 59 | options: {}, |
| 60 | usage: 'Runs Dev Mode invocation', |
| 61 | lifecycleEvents: ['build'], |
| 62 | serviceDependencyMode: 'required', |
| 63 | hasAwsExtension: true, |
| 64 | type: 'entrypoint', |
| 65 | }, |
| 66 | } |
| 67 | this.hooks = {} |
| 68 | /** |
| 69 | * We need to pack and deploy the dev mode shim only when running the dev command. |
| 70 | * Since hooks are registered for all plugins regardless of the command, we need to |
| 71 | * make sure we only overwrite the default packaging behavior in the case of dev mode |
| 72 | */ |
| 73 | if (this.serverless.processedInput.commands.includes('dev')) { |
| 74 | this.hooks['before:package:createDeploymentArtifacts'] = async () => |
| 75 | await this.pack() |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * I haven't put too much thought into the hooks we want to expose, but this is good enough for now. |
| 80 | */ |
| 81 | this.hooks['dev:dev'] = async () => await this.dev() |
| 82 | this.hooks['dev-build:build'] = async () => {} |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Validate the --mode option value |
nothing calls this directly
no test coverage detected