@sylvesterllc/aws-constructs 1.1.62 → 1.1.63

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.
@@ -16,38 +16,32 @@ jobs:
16
16
  id-token: write # for provenance (optional)
17
17
  steps:
18
18
  - uses: actions/checkout@v4
19
- - uses: pnpm/action-setup@v3
19
+ - name: Setup Bun
20
+ uses: oven-sh/setup-bun@v1
20
21
  with:
21
- version: 9
22
+ bun-version: latest
22
23
  - name: Setup Node
23
24
  uses: actions/setup-node@v4
24
25
  with:
25
- node-version: "22.x"
26
- cache: "pnpm"
26
+ node-version: "24.x"
27
+ # Note: actions/setup-node does not support bun caching
27
28
  - name: Configure .npmrc for npm registry
28
29
  run: |
29
30
  cat > ~/.npmrc << EOF
30
31
  //registry.npmjs.org/:_authToken=${{ secrets.NPM_REGISTRY_TOKEN }}
31
32
  registry=https://registry.npmjs.org/
32
33
  EOF
33
- - name: Install dependencies
34
- run: |
35
- if [ -f pnpm-lock.yaml ]; then
36
- echo "Found pnpm-lock.yaml; using --frozen-lockfile"
37
- pnpm install --frozen-lockfile
38
- else
39
- echo "No pnpm-lock.yaml present; performing regular install"
40
- pnpm install
41
- fi
34
+ - name: Install dependencies (bun)
35
+ run: bun install
42
36
  - name: Verify npm auth & scope
43
37
  run: |
44
38
  npm whoami || { echo 'Not authenticated'; exit 1; }
45
39
  npm ping
46
40
  echo "Publishing package version $(jq -r '.version' package.json)"
47
41
  - name: Run tests
48
- run: pnpm test -- --passWithNoTests
42
+ run: bun run test -- --passWithNoTests
49
43
  - name: Build
50
- run: pnpm build
44
+ run: bun run build
51
45
  - name: Guard against duplicate version
52
46
  run: |
53
47
  V=$(jq -r '.version' package.json)
@@ -0,0 +1,80 @@
1
+ import { App, Stack } from "aws-cdk-lib";
2
+ import { SpaCFRoute53 } from "../src/constructs/SpaCFRoute53";
3
+ import { SpaProps } from "../src/interfaces/SpaProps";
4
+ import { Template } from "aws-cdk-lib/assertions";
5
+
6
+ describe("SpaCFRoute53", () => {
7
+ const props: SpaProps = {
8
+ siteName: "testsite",
9
+ bucketName: "testsite-bucket-unique",
10
+ cloudfrontName: "testsite-cf",
11
+ domainName: "example.com",
12
+ fqdn: "spa.example.com",
13
+ };
14
+
15
+ it("provisions a private, versioned, encrypted S3 bucket with access logging", () => {
16
+ const app = new App();
17
+ const stack = new Stack(app, "TestStack");
18
+ new SpaCFRoute53(stack, "SpaCFRoute53", props);
19
+ const template = Template.fromStack(stack);
20
+ template.hasResourceProperties("AWS::S3::Bucket", {
21
+ BucketName: props.bucketName,
22
+ VersioningConfiguration: { Status: "Enabled" },
23
+ BucketEncryption: {
24
+ ServerSideEncryptionConfiguration: [
25
+ { ServerSideEncryptionByDefault: { SSEAlgorithm: "AES256" } },
26
+ ],
27
+ },
28
+ PublicAccessBlockConfiguration: {
29
+ BlockPublicAcls: true,
30
+ BlockPublicPolicy: true,
31
+ IgnorePublicAcls: true,
32
+ RestrictPublicBuckets: true,
33
+ },
34
+ });
35
+ });
36
+
37
+ it("provisions a logs bucket with 14-day retention", () => {
38
+ const app = new App();
39
+ const stack = new Stack(app, "TestStack");
40
+ new SpaCFRoute53(stack, "SpaCFRoute53", props);
41
+ const template = Template.fromStack(stack);
42
+ template.hasResourceProperties("AWS::S3::Bucket", {
43
+ LifecycleConfiguration: {
44
+ Rules: [{ Status: "Enabled", ExpirationInDays: 14 }],
45
+ },
46
+ });
47
+ });
48
+
49
+ it("provisions a CloudFront distribution with TLS 1.3, GET/HEAD only, and SPA error routing", () => {
50
+ const app = new App();
51
+ const stack = new Stack(app, "TestStack");
52
+ new SpaCFRoute53(stack, "SpaCFRoute53", props);
53
+ const template = Template.fromStack(stack);
54
+ template.hasResourceProperties("AWS::CloudFront::Distribution", {
55
+ DistributionConfig: {
56
+ Aliases: [props.fqdn],
57
+ DefaultRootObject: "index.html",
58
+ ViewerCertificate: {
59
+ MinimumProtocolVersion: "TLSv1.3_2021",
60
+ },
61
+ DefaultCacheBehavior: {
62
+ AllowedMethods: ["GET", "HEAD"],
63
+ ViewerProtocolPolicy: "redirect-to-https",
64
+ },
65
+ CustomErrorResponses: [
66
+ {
67
+ ErrorCode: 403,
68
+ ResponseCode: 200,
69
+ ResponsePagePath: "/index.html",
70
+ },
71
+ {
72
+ ErrorCode: 404,
73
+ ResponseCode: 200,
74
+ ResponsePagePath: "/index.html",
75
+ },
76
+ ],
77
+ },
78
+ });
79
+ });
80
+ });