MCPcopy Index your code
hub / github.com/serverless/serverless / constructor

Method constructor

packages/serverless/lib/plugins/deploy.js:5–44  ·  view source on GitHub ↗
(serverless, options)

Source from the content-addressed store, hash-verified

3
4class Deploy {
5 constructor(serverless, options) {
6 this.serverless = serverless
7 this.options = options || {}
8 this.commands = {
9 deploy: {
10 ...cliCommandsSchema.get('deploy'),
11 commands: {
12 function: {
13 ...cliCommandsSchema.get('deploy function'),
14 },
15 list: {
16 ...cliCommandsSchema.get('deploy list'),
17
18 commands: {
19 functions: {
20 ...cliCommandsSchema.get('deploy list functions'),
21 },
22 },
23 },
24 },
25 },
26 }
27
28 this.hooks = {
29 'before:deploy:deploy': async () => {
30 const provider = this.serverless.service.provider.name
31 if (!this.serverless.getProvider(provider)) {
32 const errorMessage = `The specified provider "${provider}" does not exist.`
33 throw new ServerlessError(errorMessage, 'INVALID_PROVIDER')
34 }
35
36 if (!this.options.package && !this.serverless.service.package.path) {
37 await this.serverless.pluginManager.spawn('package')
38 }
39 },
40 'after:deploy:deploy': async () => {
41 return true
42 },
43 }
44 }
45}
46
47export default Deploy

Callers

nothing calls this directly

Calls 3

spawnMethod · 0.80
getMethod · 0.45
getProviderMethod · 0.45

Tested by

no test coverage detected