Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use provider.getStackName method to get stackname #16

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ export default class StackOutputPlugin {
}

get stackName () {
return util.format('%s-%s',
this.serverless.service.getServiceName(),
this.serverless.getProvider('aws').getStage()
)
return this.serverless.getProvider('aws').naming.getStackName()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen this same behavior, too. Out of curiosity, why not just read directly from the property (e.g. this.serverless.getProvider('aws').stackName) and declare that in the typings file?

This this value be populated if the stackName property is not set in serverless.yml? It's possible that we need to fall back to the defaulted value here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nm; It looks like it is fine even if stackName is not specified in serverless.yml

}

private hasConfig (key: string) {
Expand Down
17 changes: 10 additions & 7 deletions vendor/serverless.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ declare namespace Serverless {
region: string | null
noDeploy?: boolean
}

namespace Provider {
class Aws {
constructor(serverless: Serverless, options: Serverless.Options)

getProviderName: () => string
getRegion: () => string
getServerlessDeploymentBucketName: () => string
getStage: () => string
naming: {
getStackName: () => string
}

request: (service: string, method: string, data: {}, stage: string, region: string) => Promise<any>
}
Expand All @@ -22,24 +25,24 @@ declare namespace Serverless {
declare interface Serverless {
init(): Promise<any>
run(): Promise<any>

setProvider(name: string, provider: Serverless.Provider.Aws): null
getProvider(name: string): Serverless.Provider.Aws

getVersion(): string

cli: {
log(message: string): null
}

config: {
servicePath: string
}

service: {
getServiceName(): string
getAllFunctions(): string[]

custom: {
output: OutputConfig
}
Expand Down