@sitblueprint/website-construct 0.1.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/.github/workflows/prettier.yml +18 -0
- package/.github/workflows/test.yaml +24 -0
- package/README.md +45 -0
- package/cdk.context.json +3 -0
- package/jest.config.js +8 -0
- package/package.json +46 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Run Tests
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
pull_request:
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- name: Checkout repository
|
|
10
|
+
uses: actions/checkout@v4
|
|
11
|
+
|
|
12
|
+
- name: Set up Node.js
|
|
13
|
+
uses: actions/setup-node@v4
|
|
14
|
+
with:
|
|
15
|
+
node-version: "20"
|
|
16
|
+
cache: "npm"
|
|
17
|
+
|
|
18
|
+
- name: Install dependencies
|
|
19
|
+
run: npm ci
|
|
20
|
+
|
|
21
|
+
- name: Run Jest tests
|
|
22
|
+
env:
|
|
23
|
+
CI: true
|
|
24
|
+
run: npm test
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Website CDK Construct
|
|
2
|
+
|
|
3
|
+
A reusable [AWS CDK](https://docs.aws.amazon.com/cdk/) construct to deploy a website via S3 and CloudFont.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- CDN caching via CloudFont
|
|
8
|
+
- Deployment via S3
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
npm install website-construct
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
export class MyWebsiteStack extends cdk.Stack {
|
|
20
|
+
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
|
|
21
|
+
super(scope, id, props);
|
|
22
|
+
|
|
23
|
+
new WebsiteConstruct(this, "MyWebsite", {
|
|
24
|
+
bucketName: "my-static-site-bucket",
|
|
25
|
+
indexFile: "index.html",
|
|
26
|
+
errorFile: "error.html",
|
|
27
|
+
notFoundResponsePagePath: "/404.html",
|
|
28
|
+
domainConfig: {
|
|
29
|
+
domainName: "example.com",
|
|
30
|
+
subdomainName: "www",
|
|
31
|
+
certificateArn: "arn:aws:acm:us-east-1:123456789012:certificate/abc123",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Development
|
|
39
|
+
|
|
40
|
+
- Build: `npm run build`
|
|
41
|
+
- Test: `npm run test`
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
package/cdk.context.json
ADDED
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sitblueprint/website-construct",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A reusable AWS CDK construct for deploying static websites with optional custom domain support.",
|
|
5
|
+
"author": "Miguel Merlin <mmerlin@stevens.edu>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/stevensblueprint/website-construct"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"aws",
|
|
16
|
+
"cdk",
|
|
17
|
+
"construct",
|
|
18
|
+
"s3",
|
|
19
|
+
"cloudfront",
|
|
20
|
+
"route53",
|
|
21
|
+
"static-website"
|
|
22
|
+
],
|
|
23
|
+
"main": "lib/index.js",
|
|
24
|
+
"types": "lib/index.d.ts",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"watch": "tsc -w",
|
|
28
|
+
"test": "jest",
|
|
29
|
+
"format:check": "prettier --check .",
|
|
30
|
+
"format:write": "prettier --write ."
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/jest": "^29.5.14",
|
|
34
|
+
"@types/node": "22.7.9",
|
|
35
|
+
"aws-cdk-lib": "2.208.0",
|
|
36
|
+
"constructs": "^10.0.0",
|
|
37
|
+
"jest": "^29.7.0",
|
|
38
|
+
"prettier": "^3.6.2",
|
|
39
|
+
"ts-jest": "^29.2.5",
|
|
40
|
+
"typescript": "~5.6.3"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"aws-cdk-lib": "2.208.0",
|
|
44
|
+
"constructs": "^10.0.0"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"lib": ["es2022"],
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noImplicitAny": true,
|
|
10
|
+
"strictNullChecks": true,
|
|
11
|
+
"noImplicitThis": true,
|
|
12
|
+
"alwaysStrict": true,
|
|
13
|
+
"noUnusedLocals": false,
|
|
14
|
+
"noUnusedParameters": false,
|
|
15
|
+
"noImplicitReturns": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": false,
|
|
17
|
+
"inlineSourceMap": true,
|
|
18
|
+
"inlineSources": true,
|
|
19
|
+
"experimentalDecorators": true,
|
|
20
|
+
"strictPropertyInitialization": false,
|
|
21
|
+
"typeRoots": ["./node_modules/@types"]
|
|
22
|
+
},
|
|
23
|
+
"exclude": ["node_modules", "cdk.out"]
|
|
24
|
+
}
|