From b425d2a56836a22bc5a0413ff93b159a305904dc Mon Sep 17 00:00:00 2001 From: Gowri Date: Fri, 29 Sep 2023 14:00:47 +0930 Subject: [PATCH 1/6] DO-1530: remove unused test and code clean up --- package.json | 2 +- .../cloudfront-security-headers/lib/index.ts | 4 +++- .../cdk-cloudfront-security-headers.test.ts | 17 ----------------- 3 files changed, 4 insertions(+), 19 deletions(-) delete mode 100644 packages/cloudfront-security-headers/test/cdk-cloudfront-security-headers.test.ts diff --git a/package.json b/package.json index c0870056..6bf4089c 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "homepage": "https://github.com/aligent/aws-cdk-constructs#readme", "scripts": { "build": "tsc", - "prepublish": "tsc", + "prepublish": "npm run build", "lint": "eslint --ignore-path .eslintignore --ext .ts .", "lint:check": "npm run lint", "lint:fix": "npm run lint --fix", diff --git a/packages/cloudfront-security-headers/lib/index.ts b/packages/cloudfront-security-headers/lib/index.ts index 3df24046..91e32fdf 100644 --- a/packages/cloudfront-security-headers/lib/index.ts +++ b/packages/cloudfront-security-headers/lib/index.ts @@ -19,7 +19,9 @@ export class SecurityHeaderFunction extends Construct { ) { super(scope, id); - const defineOptions: any = {}; + const defineOptions: { + __CONTENT_SECURITY_POLICY__?: string + } = {}; if (props?.contentSecurityPolicy) { defineOptions.__CONTENT_SECURITY_POLICY__ = JSON.stringify( diff --git a/packages/cloudfront-security-headers/test/cdk-cloudfront-security-headers.test.ts b/packages/cloudfront-security-headers/test/cdk-cloudfront-security-headers.test.ts deleted file mode 100644 index f862c662..00000000 --- a/packages/cloudfront-security-headers/test/cdk-cloudfront-security-headers.test.ts +++ /dev/null @@ -1,17 +0,0 @@ -// import { expect as expectCDK, countResources } from "@aws-cdk/assert"; -// import * as cdk from "aws-cdk-lib"; -// import { SecurityHeaderFunction } from "../lib/index"; - -/* - * Example test - */ -// test("Lambda Function Created", () => { -// const app = new cdk.App(); -// const stack = new cdk.Stack(app, "TestStack", { -// env: { region: "us-east-1" }, -// }); -// // WHEN -// new SecurityHeaderFunction(stack, "MyTestConstruct"); -// // THEN -// expectCDK(stack).to(countResources("AWS::Lambda::Function", 1)); -// }); From b98751d4c1aaafad2981d94582da54c53eddd030 Mon Sep 17 00:00:00 2001 From: Gowri Date: Fri, 29 Sep 2023 14:14:12 +0930 Subject: [PATCH 2/6] DO-1530: run formatter --- packages/cloudfront-security-headers/lib/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cloudfront-security-headers/lib/index.ts b/packages/cloudfront-security-headers/lib/index.ts index 91e32fdf..d5f33bdb 100644 --- a/packages/cloudfront-security-headers/lib/index.ts +++ b/packages/cloudfront-security-headers/lib/index.ts @@ -20,7 +20,7 @@ export class SecurityHeaderFunction extends Construct { super(scope, id); const defineOptions: { - __CONTENT_SECURITY_POLICY__?: string + __CONTENT_SECURITY_POLICY__?: string; } = {}; if (props?.contentSecurityPolicy) { From 880525bfce445ad2517440bfd4e1b885c503af27 Mon Sep 17 00:00:00 2001 From: Gowri Date: Thu, 5 Oct 2023 14:37:35 +1030 Subject: [PATCH 3/6] DO-1530: add @aligent/esbuild to package.json --- packages/basic-auth/package.json | 3 ++- packages/cloudfront-security-headers/package.json | 3 ++- packages/geoip-redirect/package.json | 3 ++- packages/prerender-proxy/package.json | 7 ++++--- packages/static-hosting/package.json | 3 ++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/basic-auth/package.json b/packages/basic-auth/package.json index 66d6a454..37b793a2 100644 --- a/packages/basic-auth/package.json +++ b/packages/basic-auth/package.json @@ -24,7 +24,8 @@ "jest": "^29.7.0", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", - "typescript": "~5.2.2" + "typescript": "~5.2.2", + "@aligent/esbuild": "^2.0" }, "dependencies": { "aws-cdk-lib": "2.97.0", diff --git a/packages/cloudfront-security-headers/package.json b/packages/cloudfront-security-headers/package.json index 21b3d112..28e7e043 100644 --- a/packages/cloudfront-security-headers/package.json +++ b/packages/cloudfront-security-headers/package.json @@ -18,7 +18,8 @@ "jest": "^29.7.0", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", - "typescript": "~5.2.2" + "typescript": "~5.2.2", + "@aligent/esbuild": "^2.0" }, "dependencies": { "aws-cdk-lib": "2.97.0", diff --git a/packages/geoip-redirect/package.json b/packages/geoip-redirect/package.json index 2da8c69f..7f660354 100644 --- a/packages/geoip-redirect/package.json +++ b/packages/geoip-redirect/package.json @@ -24,7 +24,8 @@ "jest": "^29.7.0", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", - "typescript": "~5.2.2" + "typescript": "~5.2.2", + "@aligent/esbuild": "^2.0" }, "dependencies": { "aws-cdk-lib": "2.97.0", diff --git a/packages/prerender-proxy/package.json b/packages/prerender-proxy/package.json index 4725ac32..f14312a6 100644 --- a/packages/prerender-proxy/package.json +++ b/packages/prerender-proxy/package.json @@ -4,8 +4,8 @@ "description": "Cloudfront Lambda@Edge constructs for integrating with prerender.io", "main": "index.js", "scripts": { - "build": "tsc && cd ./lib/handlers && npm ci", - "prepublish": "tsc && cd ./lib/handlers && npm ci" + "build": "tsc", + "prepublish": "tsc" }, "repository": { "type": "git", @@ -24,7 +24,8 @@ "jest": "^29.7.0", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", - "typescript": "~5.2.2" + "typescript": "~5.2.2", + "@aligent/esbuild": "^2.0" }, "dependencies": { "aws-cdk-lib": "2.97.0", diff --git a/packages/static-hosting/package.json b/packages/static-hosting/package.json index 1420065d..7e4f67d5 100644 --- a/packages/static-hosting/package.json +++ b/packages/static-hosting/package.json @@ -21,7 +21,8 @@ "jest": "^29.7.0", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", - "typescript": "~5.2.2" + "typescript": "~5.2.2", + "@aligent/esbuild": "^2.0" }, "dependencies": { "aws-cdk-lib": "2.97.0", From 366226a58db8ad60d6cf1dd778b4fe1c1ed8b913 Mon Sep 17 00:00:00 2001 From: Gowri Date: Thu, 5 Oct 2023 14:46:51 +1030 Subject: [PATCH 4/6] DO-1530: remove skip lib check and include DOM lib --- packages/esbuild/tsconfig.json | 5 ++++- tsconfig.json | 7 +------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/esbuild/tsconfig.json b/packages/esbuild/tsconfig.json index 4082f16a..99bd998d 100644 --- a/packages/esbuild/tsconfig.json +++ b/packages/esbuild/tsconfig.json @@ -1,3 +1,6 @@ { - "extends": "../../tsconfig.json" + "extends": "../../tsconfig.json", + "compilerOptions": { + "skipLibCheck": true + } } diff --git a/tsconfig.json b/tsconfig.json index 4119ec45..f2309643 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "ES2018", "module": "commonjs", - "lib": ["es2018"], + "lib": ["es2018", "DOM"], "declaration": true, "strict": true, "noImplicitAny": true, @@ -19,11 +19,6 @@ "strictPropertyInitialization": false, "typeRoots": ["./node_modules/@types"], "types": ["node", "jest"], - - // https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826 - // Ideally this should only be specified in packages/esbuild/tsconfig.json, however it doesn't seem to be - // loading that config file during build. - "skipLibCheck": true }, "exclude": ["**/node_modules", "cdk.out", "**/handlers/**"] } From 093b5a726dce457fc6ed4abea767520298f9e762 Mon Sep 17 00:00:00 2001 From: Gowri Date: Thu, 5 Oct 2023 15:20:38 +1030 Subject: [PATCH 5/6] DO-1530: run formatter --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index f2309643..e3441a84 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,7 @@ "experimentalDecorators": true, "strictPropertyInitialization": false, "typeRoots": ["./node_modules/@types"], - "types": ["node", "jest"], + "types": ["node", "jest"] }, "exclude": ["**/node_modules", "cdk.out", "**/handlers/**"] } From c2b0ce9fd7bad7b54ff6ea3d3c2f4c70df714679 Mon Sep 17 00:00:00 2001 From: Gowri Date: Tue, 17 Oct 2023 14:07:09 +1030 Subject: [PATCH 6/6] DO-1530: remove prepublish script --- packages/basic-auth/package.json | 3 +-- packages/cloudfront-security-headers/package.json | 1 - packages/esbuild/package.json | 3 +-- packages/geoip-redirect/package.json | 3 +-- packages/graphql-mesh-server/package.json | 3 +-- packages/lambda-at-edge-handlers/package.json | 1 - packages/prerender-fargate/package.json | 3 +-- packages/prerender-proxy/package.json | 3 +-- packages/rabbitmq/package.json | 3 +-- packages/shared-vpc/package.json | 3 +-- packages/static-hosting/package.json | 3 +-- packages/waf/package.json | 3 +-- 12 files changed, 10 insertions(+), 22 deletions(-) diff --git a/packages/basic-auth/package.json b/packages/basic-auth/package.json index 37b793a2..a04a5708 100644 --- a/packages/basic-auth/package.json +++ b/packages/basic-auth/package.json @@ -4,8 +4,7 @@ "description": "A Cloudfront Lambda@Edge stack for performing basic auth protection", "main": "index.js", "scripts": { - "build": "tsc && cd ./lib/handlers && npm ci", - "prepublish": "tsc && cd ./lib/handlers && npm ci" + "build": "tsc && cd ./lib/handlers && npm ci" }, "repository": { "type": "git", diff --git a/packages/cloudfront-security-headers/package.json b/packages/cloudfront-security-headers/package.json index 28e7e043..5b866b0b 100644 --- a/packages/cloudfront-security-headers/package.json +++ b/packages/cloudfront-security-headers/package.json @@ -6,7 +6,6 @@ "types": "lib/index.d.ts", "scripts": { "build": "tsc && cd ./lib/handlers && npm ci", - "prepublish": "tsc && cd ./lib/handlers && npm ci", "watch": "tsc -w", "test": "jest" }, diff --git a/packages/esbuild/package.json b/packages/esbuild/package.json index 913393a4..889265d2 100644 --- a/packages/esbuild/package.json +++ b/packages/esbuild/package.json @@ -5,8 +5,7 @@ "main": "index.js", "license": "GPL-3.0-only", "scripts": { - "build": "tsc", - "prepublish": "tsc" + "build": "tsc" }, "devDependencies": { "@types/jest": "^29.5.5", diff --git a/packages/geoip-redirect/package.json b/packages/geoip-redirect/package.json index 7f660354..004b873d 100644 --- a/packages/geoip-redirect/package.json +++ b/packages/geoip-redirect/package.json @@ -4,8 +4,7 @@ "description": "A Cloudfront Lambda@Edge stack for performing redirection based on CloudFront-Viewer-Country", "main": "index.js", "scripts": { - "build": "tsc && cd ./lib/handlers && npm ci", - "prepublish": "tsc && cd ./lib/handlers && npm ci" + "build": "tsc && cd ./lib/handlers && npm ci" }, "repository": { "type": "git", diff --git a/packages/graphql-mesh-server/package.json b/packages/graphql-mesh-server/package.json index df512e91..2377029c 100644 --- a/packages/graphql-mesh-server/package.json +++ b/packages/graphql-mesh-server/package.json @@ -4,8 +4,7 @@ "description": "A construct to host Graphql Mesh in Fargate", "main": "index.js", "scripts": { - "build": "tsc", - "prepublish": "tsc" + "build": "tsc" }, "repository": { "type": "git", diff --git a/packages/lambda-at-edge-handlers/package.json b/packages/lambda-at-edge-handlers/package.json index aba08db8..087c22d1 100644 --- a/packages/lambda-at-edge-handlers/package.json +++ b/packages/lambda-at-edge-handlers/package.json @@ -5,7 +5,6 @@ "main": "index.js", "scripts": { "build": "tsc", - "prepublish": "tsc", "watch": "tsc -w", "test": "echo \"No test specified\" && exit 0" }, diff --git a/packages/prerender-fargate/package.json b/packages/prerender-fargate/package.json index 64543be1..d3544625 100644 --- a/packages/prerender-fargate/package.json +++ b/packages/prerender-fargate/package.json @@ -4,8 +4,7 @@ "description": "A construct to host Prerender in Fargate", "main": "index.js", "scripts": { - "build": "tsc", - "prepublish": "tsc" + "build": "tsc" }, "repository": { "type": "git", diff --git a/packages/prerender-proxy/package.json b/packages/prerender-proxy/package.json index f14312a6..0990f017 100644 --- a/packages/prerender-proxy/package.json +++ b/packages/prerender-proxy/package.json @@ -4,8 +4,7 @@ "description": "Cloudfront Lambda@Edge constructs for integrating with prerender.io", "main": "index.js", "scripts": { - "build": "tsc", - "prepublish": "tsc" + "build": "tsc" }, "repository": { "type": "git", diff --git a/packages/rabbitmq/package.json b/packages/rabbitmq/package.json index 0b47cdd5..66b4772d 100644 --- a/packages/rabbitmq/package.json +++ b/packages/rabbitmq/package.json @@ -10,8 +10,7 @@ }, "types": "index.d.ts", "scripts": { - "build": "tsc", - "prepublish": "tsc" + "build": "tsc" }, "devDependencies": { "@types/jest": "^29.5.5", diff --git a/packages/shared-vpc/package.json b/packages/shared-vpc/package.json index 36738100..41279b9d 100644 --- a/packages/shared-vpc/package.json +++ b/packages/shared-vpc/package.json @@ -3,8 +3,7 @@ "version": "2.0.0", "main": "index.js", "scripts": { - "build": "tsc", - "prepublish": "tsc" + "build": "tsc" }, "devDependencies": { "@types/jest": "^29.5.5", diff --git a/packages/static-hosting/package.json b/packages/static-hosting/package.json index 7e4f67d5..bcef5366 100644 --- a/packages/static-hosting/package.json +++ b/packages/static-hosting/package.json @@ -10,8 +10,7 @@ }, "types": "index.d.ts", "scripts": { - "build": "tsc", - "prepublish": "tsc" + "build": "tsc" }, "devDependencies": { "@types/jest": "^29.5.5", diff --git a/packages/waf/package.json b/packages/waf/package.json index fe511827..4ab8df1f 100644 --- a/packages/waf/package.json +++ b/packages/waf/package.json @@ -10,8 +10,7 @@ }, "types": "index.d.ts", "scripts": { - "build": "tsc", - "prepublish": "tsc" + "build": "tsc" }, "devDependencies": { "@types/jest": "^29.5.5",