Skip to content

Commit 52eee66

Browse files
authored
Merge pull request #1 from 1stdibs/defnotrobbie/FI-1931
fix: FI-1931 update plugin
2 parents ea676e2 + 06f4bac commit 52eee66

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

index.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,29 @@ class AwsAlias {
3535
*/
3636
this._stage = this._provider.getStage();
3737
this._alias = this._options.alias || this._stage;
38+
39+
/**
40+
* (new) register custom variable source--preferred method to define
41+
* plugin variables
42+
* @see https://www.serverless.com/framework/docs/guides/plugins/custom-variables
43+
*/
44+
this.configurationVariablesSources = {
45+
awsAlias: {
46+
resolve: async ({ address }) =>
47+
address === 'alias' ? { value: this._alias } : null,
48+
},
49+
};
50+
51+
/**
52+
* register alias property with provider schema to maintain old
53+
* functionality while meeting new variable resolution standards
54+
*/
55+
this._serverless.configSchemaHandler.schema.properties.provider.properties.alias =
56+
{ type: 'string' };
57+
58+
/**
59+
* (old/bad) set alias property
60+
*/
3861
this._serverless.service.provider.alias = this._alias;
3962

4063
/**
@@ -86,12 +109,14 @@ class AwsAlias {
86109
alias: {
87110
usage: 'Name of the alias',
88111
shortcut: 'a',
89-
required: true
112+
required: true,
113+
type: 'string'
90114
},
91115
verbose: {
92116
usage: 'Enable verbose output',
93117
shortcut: 'v',
94-
required: false
118+
required: false,
119+
type: 'boolean'
95120
}
96121
}
97122
}

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
"eslint": "node node_modules/eslint/bin/eslint.js --ext .js lib"
1313
},
1414
"author": "Frank Schmid <[email protected]>",
15+
"contributors": [
16+
{
17+
"name": "Robbie Nichols",
18+
"email": "[email protected]"
19+
}
20+
],
1521
"nyc": {
1622
"exclude": [
1723
"test/**/*.*"
@@ -30,6 +36,9 @@
3036
"os": "^0.1.1",
3137
"semver": "^7.3.4"
3238
},
39+
"peerDependencies": {
40+
"serverless": "^2.72.3"
41+
},
3342
"devDependencies": {
3443
"chai": "^4.2.0",
3544
"chai-as-promised": "^7.1.1",

0 commit comments

Comments
 (0)