@gradientedge/cdk-utils 5.7.0 → 5.8.0
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/dist/src/lib/common/stack.js +14 -6
- package/package.json +15 -15
- package/src/lib/common/stack.ts +8 -6
|
@@ -82,8 +82,10 @@ class CommonStack extends cdk.Stack {
|
|
|
82
82
|
*/
|
|
83
83
|
determineExtraContexts() {
|
|
84
84
|
const extraContexts = this.node.tryGetContext('extraContexts');
|
|
85
|
+
const debug = this.node.tryGetContext('debug');
|
|
85
86
|
if (!extraContexts) {
|
|
86
|
-
|
|
87
|
+
if (debug)
|
|
88
|
+
console.debug(`No additional contexts provided. Using default context properties from cdk.json`);
|
|
87
89
|
return;
|
|
88
90
|
}
|
|
89
91
|
extraContexts.forEach((context) => {
|
|
@@ -93,7 +95,8 @@ class CommonStack extends cdk.Stack {
|
|
|
93
95
|
throw `Extra context properties unavailable in path:${extraContextPath}`;
|
|
94
96
|
/* read the extra properties */
|
|
95
97
|
const extraContextPropsBuffer = fs.readFileSync(extraContextPath);
|
|
96
|
-
|
|
98
|
+
if (debug)
|
|
99
|
+
console.debug(`Adding additional contexts provided in ${extraContextPath}`);
|
|
97
100
|
/* parse as JSON properties */
|
|
98
101
|
const extraContextProps = JSON.parse(extraContextPropsBuffer);
|
|
99
102
|
/* set each of the property into the cdk node context */
|
|
@@ -111,18 +114,23 @@ class CommonStack extends cdk.Stack {
|
|
|
111
114
|
const stage = this.node.tryGetContext('stage');
|
|
112
115
|
const stageContextPath = this.node.tryGetContext('stageContextPath') || 'cdkEnv';
|
|
113
116
|
const stageContextFilePath = `${appRoot.path}/${stageContextPath}/${stage}.json`;
|
|
117
|
+
const debug = this.node.tryGetContext('debug');
|
|
114
118
|
if ((0, utils_1.isDevStage)(stage)) {
|
|
115
|
-
|
|
119
|
+
if (debug)
|
|
120
|
+
console.debug(`Development stage. Using default stage context properties`);
|
|
116
121
|
}
|
|
117
122
|
/* alert default context usage when extra stage config is missing */
|
|
118
123
|
if (!fs.existsSync(stageContextFilePath)) {
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
if (debug)
|
|
125
|
+
console.debug(`Stage specific context properties unavailable in path:${stageContextFilePath}`);
|
|
126
|
+
if (debug)
|
|
127
|
+
console.debug(`Using default stage context properties for ${stage} stage`);
|
|
121
128
|
return;
|
|
122
129
|
}
|
|
123
130
|
/* read the extra properties */
|
|
124
131
|
const stageContextPropsBuffer = fs.readFileSync(stageContextFilePath);
|
|
125
|
-
|
|
132
|
+
if (debug)
|
|
133
|
+
console.debug(`Adding additional stage contexts provided in ${stageContextFilePath}`);
|
|
126
134
|
/* parse as JSON properties */
|
|
127
135
|
const stageContextProps = JSON.parse(stageContextPropsBuffer);
|
|
128
136
|
/* set each of the property into the cdk node context */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@types/lodash": "^4.14.182",
|
|
49
|
-
"@types/node": "^
|
|
49
|
+
"@types/node": "^18.0.0",
|
|
50
50
|
"app-root-path": "^3.0.0",
|
|
51
|
-
"aws-cdk-lib": "^2.
|
|
52
|
-
"aws-sdk": "^2.
|
|
53
|
-
"constructs": "^10.1.
|
|
51
|
+
"aws-cdk-lib": "^2.28.1",
|
|
52
|
+
"aws-sdk": "^2.1158.0",
|
|
53
|
+
"constructs": "^10.1.42",
|
|
54
54
|
"lodash": "^4.17.21",
|
|
55
55
|
"moment": "^2.29.3",
|
|
56
56
|
"nconf": "^0.12.0",
|
|
@@ -59,16 +59,16 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@babel/plugin-proposal-class-properties": "^7.17.12",
|
|
62
|
-
"@types/jest": "^28.1.
|
|
63
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
64
|
-
"@typescript-eslint/parser": "^5.
|
|
62
|
+
"@types/jest": "^28.1.2",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
|
64
|
+
"@typescript-eslint/parser": "^5.29.0",
|
|
65
65
|
"aws-cdk": "*",
|
|
66
66
|
"babel-eslint": "^10.1.0",
|
|
67
67
|
"better-docs": "^2.7.2",
|
|
68
68
|
"codecov": "^3.8.3",
|
|
69
69
|
"commitizen": "^4.2.4",
|
|
70
70
|
"dotenv": "^16.0.1",
|
|
71
|
-
"eslint": "^8.
|
|
71
|
+
"eslint": "^8.18.0",
|
|
72
72
|
"eslint-config-prettier": "^8.5.0",
|
|
73
73
|
"eslint-plugin-import": "^2.26.0",
|
|
74
74
|
"husky": "^8.0.1",
|
|
@@ -78,20 +78,20 @@
|
|
|
78
78
|
"jsdoc": "^3.6.10",
|
|
79
79
|
"jsdoc-babel": "^0.5.0",
|
|
80
80
|
"jsdoc-mermaid": "^1.0.0",
|
|
81
|
-
"lerna": "^5.1.
|
|
82
|
-
"prettier": "^2.7.
|
|
83
|
-
"prettier-plugin-organize-imports": "^
|
|
81
|
+
"lerna": "^5.1.4",
|
|
82
|
+
"prettier": "^2.7.1",
|
|
83
|
+
"prettier-plugin-organize-imports": "^3.0.0",
|
|
84
84
|
"rimraf": "^3.0.2",
|
|
85
85
|
"semantic-release": "^19.0.3",
|
|
86
86
|
"ts-jest": "^28.0.5",
|
|
87
87
|
"ts-node": "^10.8.1",
|
|
88
|
-
"typescript": "4.7.
|
|
88
|
+
"typescript": "4.7.4"
|
|
89
89
|
},
|
|
90
90
|
"optionalDependencies": {
|
|
91
91
|
"@babel/core": "^7.18.5",
|
|
92
92
|
"prop-types": "^15.8.1",
|
|
93
|
-
"react": "^
|
|
94
|
-
"react-dom": "^
|
|
93
|
+
"react": "^17.0.2",
|
|
94
|
+
"react-dom": "^17.0.2"
|
|
95
95
|
},
|
|
96
96
|
"config": {
|
|
97
97
|
"commitizen": {
|
package/src/lib/common/stack.ts
CHANGED
|
@@ -66,9 +66,10 @@ export class CommonStack extends cdk.Stack {
|
|
|
66
66
|
*/
|
|
67
67
|
protected determineExtraContexts() {
|
|
68
68
|
const extraContexts = this.node.tryGetContext('extraContexts')
|
|
69
|
+
const debug = this.node.tryGetContext('debug')
|
|
69
70
|
|
|
70
71
|
if (!extraContexts) {
|
|
71
|
-
console.
|
|
72
|
+
if (debug) console.debug(`No additional contexts provided. Using default context properties from cdk.json`)
|
|
72
73
|
return
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -80,7 +81,7 @@ export class CommonStack extends cdk.Stack {
|
|
|
80
81
|
|
|
81
82
|
/* read the extra properties */
|
|
82
83
|
const extraContextPropsBuffer = fs.readFileSync(extraContextPath)
|
|
83
|
-
console.
|
|
84
|
+
if (debug) console.debug(`Adding additional contexts provided in ${extraContextPath}`)
|
|
84
85
|
|
|
85
86
|
/* parse as JSON properties */
|
|
86
87
|
const extraContextProps = JSON.parse(extraContextPropsBuffer)
|
|
@@ -101,21 +102,22 @@ export class CommonStack extends cdk.Stack {
|
|
|
101
102
|
const stage = this.node.tryGetContext('stage')
|
|
102
103
|
const stageContextPath = this.node.tryGetContext('stageContextPath') || 'cdkEnv'
|
|
103
104
|
const stageContextFilePath = `${appRoot.path}/${stageContextPath}/${stage}.json`
|
|
105
|
+
const debug = this.node.tryGetContext('debug')
|
|
104
106
|
|
|
105
107
|
if (isDevStage(stage)) {
|
|
106
|
-
console.
|
|
108
|
+
if (debug) console.debug(`Development stage. Using default stage context properties`)
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
/* alert default context usage when extra stage config is missing */
|
|
110
112
|
if (!fs.existsSync(stageContextFilePath)) {
|
|
111
|
-
console.
|
|
112
|
-
console.
|
|
113
|
+
if (debug) console.debug(`Stage specific context properties unavailable in path:${stageContextFilePath}`)
|
|
114
|
+
if (debug) console.debug(`Using default stage context properties for ${stage} stage`)
|
|
113
115
|
return
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
/* read the extra properties */
|
|
117
119
|
const stageContextPropsBuffer = fs.readFileSync(stageContextFilePath)
|
|
118
|
-
console.
|
|
120
|
+
if (debug) console.debug(`Adding additional stage contexts provided in ${stageContextFilePath}`)
|
|
119
121
|
|
|
120
122
|
/* parse as JSON properties */
|
|
121
123
|
const stageContextProps = JSON.parse(stageContextPropsBuffer)
|