@gradientedge/cdk-utils 5.3.0 → 5.4.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.
@@ -20,10 +20,10 @@
20
20
  "brace-expansion@^1.1.7": "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd",
21
21
  "concat-map@0.0.1": "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b",
22
22
  "fs.realpath@^1.0.0": "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f",
23
- "glob@^7.1.3": "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023",
23
+ "glob@^7.1.3": "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b",
24
24
  "inflight@^1.0.4": "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9",
25
25
  "inherits@2": "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c",
26
- "minimatch@^3.0.4": "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b",
26
+ "minimatch@^3.1.1": "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b",
27
27
  "mkdirp@^1.0.4": "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e",
28
28
  "once@^1.3.0": "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1",
29
29
  "path-is-absolute@^1.0.0": "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f",
@@ -70,4 +70,12 @@ export declare class S3Manager {
70
70
  * @param {boolean} prune
71
71
  */
72
72
  doBucketDeployment(id: string, scope: common.CommonConstruct, siteBucket: s3.IBucket, distribution: cloudfront.IDistribution, sources: s3deploy.ISource[], prefix: string, prune?: boolean): void;
73
+ /**
74
+ *
75
+ * @param {string} id scoped id of the resource
76
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
77
+ * @param {s3.IBucket} bucket bucket to create the folders in
78
+ * @param {string[]} folders list of folder names to be created in the bucket
79
+ */
80
+ createBucketFolders(id: string, scope: common.CommonConstruct, bucket: s3.IBucket, folders: string[]): void;
73
81
  }
@@ -202,5 +202,25 @@ class S3Manager {
202
202
  sources: sources,
203
203
  });
204
204
  }
205
+ /**
206
+ *
207
+ * @param {string} id scoped id of the resource
208
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
209
+ * @param {s3.IBucket} bucket bucket to create the folders in
210
+ * @param {string[]} folders list of folder names to be created in the bucket
211
+ */
212
+ createBucketFolders(id, scope, bucket, folders) {
213
+ if (!folders || folders.length == 0) {
214
+ throw `Folder unspecified for ${id}`;
215
+ }
216
+ folders.forEach(folder => {
217
+ new s3deploy.BucketDeployment(scope, `${id}-${folder}`, {
218
+ destinationBucket: bucket,
219
+ destinationKeyPrefix: folder,
220
+ sources: [s3deploy.Source.data('README.md', `This is the ${folder} folder for ${id}`)],
221
+ prune: false,
222
+ });
223
+ });
224
+ }
205
225
  }
206
226
  exports.S3Manager = S3Manager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -46,29 +46,29 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@types/lodash": "^4.14.182",
49
- "@types/node": "^17.0.33",
49
+ "@types/node": "^17.0.35",
50
50
  "app-root-path": "^3.0.0",
51
- "aws-cdk-lib": "^2.24.1",
52
- "aws-sdk": "^2.1134.0",
53
- "constructs": "^10.1.7",
51
+ "aws-cdk-lib": "^2.25.0",
52
+ "aws-sdk": "^2.1141.0",
53
+ "constructs": "^10.1.16",
54
54
  "lodash": "^4.17.21",
55
55
  "moment": "^2.29.3",
56
56
  "nconf": "^0.12.0",
57
57
  "pluralize": "^8.0.0",
58
- "ts-node": "^10.7.0"
58
+ "ts-node": "^10.8.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@babel/plugin-proposal-class-properties": "^7.16.7",
61
+ "@babel/plugin-proposal-class-properties": "^7.17.12",
62
62
  "@types/jest": "^27.5.1",
63
- "@typescript-eslint/eslint-plugin": "^5.23.0",
64
- "@typescript-eslint/parser": "^5.23.0",
63
+ "@typescript-eslint/eslint-plugin": "^5.26.0",
64
+ "@typescript-eslint/parser": "^5.26.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.15.0",
71
+ "eslint": "^8.16.0",
72
72
  "eslint-config-prettier": "^8.5.0",
73
73
  "eslint-plugin-import": "^2.26.0",
74
74
  "husky": "^8.0.1",
@@ -83,12 +83,12 @@
83
83
  "prettier-plugin-organize-imports": "^2.3.4",
84
84
  "rimraf": "^3.0.2",
85
85
  "semantic-release": "^19.0.2",
86
- "ts-jest": "^28.0.2",
87
- "ts-node": "^10.7.0",
86
+ "ts-jest": "^28.0.3",
87
+ "ts-node": "^10.8.0",
88
88
  "typescript": "4.6.4"
89
89
  },
90
90
  "optionalDependencies": {
91
- "@babel/core": "^7.17.10",
91
+ "@babel/core": "^7.18.0",
92
92
  "prop-types": "^15.8.1",
93
93
  "react": "^18.1.0",
94
94
  "react-dom": "^18.1.0"
@@ -200,4 +200,26 @@ export class S3Manager {
200
200
  sources: sources,
201
201
  })
202
202
  }
203
+
204
+ /**
205
+ *
206
+ * @param {string} id scoped id of the resource
207
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
208
+ * @param {s3.IBucket} bucket bucket to create the folders in
209
+ * @param {string[]} folders list of folder names to be created in the bucket
210
+ */
211
+ public createBucketFolders(id: string, scope: common.CommonConstruct, bucket: s3.IBucket, folders: string[]) {
212
+ if (!folders || folders.length == 0) {
213
+ throw `Folder unspecified for ${id}`
214
+ }
215
+
216
+ folders.forEach(folder => {
217
+ new s3deploy.BucketDeployment(scope, `${id}-${folder}`, {
218
+ destinationBucket: bucket,
219
+ destinationKeyPrefix: folder,
220
+ sources: [s3deploy.Source.data('README.md', `This is the ${folder} folder for ${id}`)],
221
+ prune: false,
222
+ })
223
+ })
224
+ }
203
225
  }