serverless-plugin-env-stage-config 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +11 -14
- package/package.json +9 -17
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const cloudformationSchema = require('@serverless/utils/cloudformation-schema')
|
|
|
6
6
|
const developmentStages = new Set([
|
|
7
7
|
'local',
|
|
8
8
|
'development',
|
|
9
|
-
'dev'
|
|
9
|
+
'dev',
|
|
10
10
|
])
|
|
11
11
|
|
|
12
12
|
class EnvStageConfigServerlessPlugin {
|
|
@@ -17,19 +17,16 @@ class EnvStageConfigServerlessPlugin {
|
|
|
17
17
|
|
|
18
18
|
this.configurationVariablesSources = {
|
|
19
19
|
esc: {
|
|
20
|
-
resolve: this.resolveConfigVariable.bind(this)
|
|
21
|
-
}
|
|
20
|
+
resolve: this.resolveConfigVariable.bind(this),
|
|
21
|
+
},
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (!developmentStages.has(this.stage)) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
schema: cloudformationSchema
|
|
31
|
-
}
|
|
32
|
-
)
|
|
25
|
+
const stageConfigYaml = readFileSync(path.join(this.serverless.serviceDir, `serverless.env.${this.stage}.yml`))
|
|
26
|
+
|
|
27
|
+
this.stageVariables = yaml.load(stageConfigYaml, {
|
|
28
|
+
schema: cloudformationSchema,
|
|
29
|
+
})
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
|
|
@@ -37,19 +34,19 @@ class EnvStageConfigServerlessPlugin {
|
|
|
37
34
|
if (this.stageVariables) {
|
|
38
35
|
if (address in this.stageVariables) {
|
|
39
36
|
return {
|
|
40
|
-
value: this.stageVariables[address]
|
|
37
|
+
value: this.stageVariables[address],
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
|
|
44
41
|
this.serverless.cli.log(
|
|
45
42
|
`env-stage-config: WARNING: the ${address} variable is not defined in serverless.env.${this.stage}.yml, defaulting to \${env:${address}, null}.`,
|
|
46
43
|
null,
|
|
47
|
-
{color: 'orange'}
|
|
44
|
+
{color: 'orange'},
|
|
48
45
|
)
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
return {
|
|
52
|
-
value: `\${env:${address}, null}
|
|
49
|
+
value: `\${env:${address}, null}`,
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "serverless-plugin-env-stage-config",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"author": "Bertrand Marron <bertrand.marron@gmail.com>",
|
|
5
5
|
"description": "Serverless plugin to define environment variables files for stages",
|
|
6
6
|
"main": "index.js",
|
|
@@ -24,26 +24,18 @@
|
|
|
24
24
|
"js-yaml": "^4.1.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@semantic-release
|
|
28
|
-
"semantic-release": "^
|
|
29
|
-
"xo": "^0.
|
|
27
|
+
"@bizon/semantic-release-config": "^1.0.1",
|
|
28
|
+
"semantic-release": "^18.0.0",
|
|
29
|
+
"xo": "^0.47.0"
|
|
30
30
|
},
|
|
31
31
|
"xo": {
|
|
32
32
|
"semicolon": false,
|
|
33
|
-
"space": 2
|
|
33
|
+
"space": 2,
|
|
34
|
+
"rules": {
|
|
35
|
+
"unicorn/prefer-module": "off"
|
|
36
|
+
}
|
|
34
37
|
},
|
|
35
38
|
"release": {
|
|
36
|
-
"
|
|
37
|
-
"@semantic-release/commit-analyzer",
|
|
38
|
-
"@semantic-release/release-notes-generator",
|
|
39
|
-
"@semantic-release/github",
|
|
40
|
-
"@semantic-release/npm",
|
|
41
|
-
[
|
|
42
|
-
"@semantic-release/git",
|
|
43
|
-
{
|
|
44
|
-
"message": "chore(release): ${nextRelease.gitTag}"
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
]
|
|
39
|
+
"extends": "@bizon/semantic-release-config"
|
|
48
40
|
}
|
|
49
41
|
}
|