create-aws-project 1.2.1

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.
Files changed (181) hide show
  1. package/README.md +118 -0
  2. package/dist/__tests__/generator/replace-tokens.spec.d.ts +1 -0
  3. package/dist/__tests__/generator/replace-tokens.spec.js +281 -0
  4. package/dist/__tests__/generator.spec.d.ts +1 -0
  5. package/dist/__tests__/generator.spec.js +162 -0
  6. package/dist/__tests__/validation/project-name.spec.d.ts +1 -0
  7. package/dist/__tests__/validation/project-name.spec.js +57 -0
  8. package/dist/__tests__/wizard.spec.d.ts +1 -0
  9. package/dist/__tests__/wizard.spec.js +232 -0
  10. package/dist/aws/iam.d.ts +75 -0
  11. package/dist/aws/iam.js +264 -0
  12. package/dist/aws/organizations.d.ts +79 -0
  13. package/dist/aws/organizations.js +168 -0
  14. package/dist/cli.d.ts +4 -0
  15. package/dist/cli.js +206 -0
  16. package/dist/commands/setup-github.d.ts +4 -0
  17. package/dist/commands/setup-github.js +185 -0
  18. package/dist/generator/copy-file.d.ts +15 -0
  19. package/dist/generator/copy-file.js +56 -0
  20. package/dist/generator/generate-project.d.ts +14 -0
  21. package/dist/generator/generate-project.js +81 -0
  22. package/dist/generator/index.d.ts +4 -0
  23. package/dist/generator/index.js +3 -0
  24. package/dist/generator/replace-tokens.d.ts +29 -0
  25. package/dist/generator/replace-tokens.js +68 -0
  26. package/dist/github/secrets.d.ts +109 -0
  27. package/dist/github/secrets.js +275 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.js +6 -0
  30. package/dist/prompts/auth.d.ts +3 -0
  31. package/dist/prompts/auth.js +23 -0
  32. package/dist/prompts/aws-config.d.ts +2 -0
  33. package/dist/prompts/aws-config.js +14 -0
  34. package/dist/prompts/features.d.ts +2 -0
  35. package/dist/prompts/features.js +10 -0
  36. package/dist/prompts/github-setup.d.ts +53 -0
  37. package/dist/prompts/github-setup.js +208 -0
  38. package/dist/prompts/org-structure.d.ts +9 -0
  39. package/dist/prompts/org-structure.js +93 -0
  40. package/dist/prompts/platforms.d.ts +2 -0
  41. package/dist/prompts/platforms.js +12 -0
  42. package/dist/prompts/project-name.d.ts +2 -0
  43. package/dist/prompts/project-name.js +8 -0
  44. package/dist/prompts/theme.d.ts +2 -0
  45. package/dist/prompts/theme.js +14 -0
  46. package/dist/templates/index.d.ts +4 -0
  47. package/dist/templates/index.js +2 -0
  48. package/dist/templates/manifest.d.ts +11 -0
  49. package/dist/templates/manifest.js +99 -0
  50. package/dist/templates/tokens.d.ts +39 -0
  51. package/dist/templates/tokens.js +37 -0
  52. package/dist/templates/types.d.ts +52 -0
  53. package/dist/templates/types.js +1 -0
  54. package/dist/types.d.ts +27 -0
  55. package/dist/types.js +1 -0
  56. package/dist/validation/project-name.d.ts +1 -0
  57. package/dist/validation/project-name.js +12 -0
  58. package/dist/wizard.d.ts +2 -0
  59. package/dist/wizard.js +81 -0
  60. package/package.json +68 -0
  61. package/templates/.github/actions/build-and-test/action.yml +24 -0
  62. package/templates/.github/actions/deploy-cdk/action.yml +46 -0
  63. package/templates/.github/actions/deploy-web/action.yml +72 -0
  64. package/templates/.github/actions/setup/action.yml +29 -0
  65. package/templates/.github/pull_request_template.md +15 -0
  66. package/templates/.github/workflows/deploy-dev.yml +80 -0
  67. package/templates/.github/workflows/deploy-prod.yml +67 -0
  68. package/templates/.github/workflows/deploy-stage.yml +77 -0
  69. package/templates/.github/workflows/pull-request.yml +72 -0
  70. package/templates/.vscode/extensions.json +7 -0
  71. package/templates/.vscode/settings.json +67 -0
  72. package/templates/apps/api/.eslintrc.json +18 -0
  73. package/templates/apps/api/cdk/app.ts +93 -0
  74. package/templates/apps/api/cdk/auth/cognito-stack.ts +164 -0
  75. package/templates/apps/api/cdk/cdk.json +73 -0
  76. package/templates/apps/api/cdk/deployment-user-stack.ts +187 -0
  77. package/templates/apps/api/cdk/org-stack.ts +67 -0
  78. package/templates/apps/api/cdk/static-stack.ts +361 -0
  79. package/templates/apps/api/cdk/tsconfig.json +39 -0
  80. package/templates/apps/api/cdk/user-stack.ts +255 -0
  81. package/templates/apps/api/jest.config.ts +38 -0
  82. package/templates/apps/api/lambdas.yml +84 -0
  83. package/templates/apps/api/project.json.template +58 -0
  84. package/templates/apps/api/src/__tests__/setup.ts +10 -0
  85. package/templates/apps/api/src/handlers/users/create-user.ts +52 -0
  86. package/templates/apps/api/src/handlers/users/delete-user.ts +45 -0
  87. package/templates/apps/api/src/handlers/users/get-me.ts +72 -0
  88. package/templates/apps/api/src/handlers/users/get-user.ts +45 -0
  89. package/templates/apps/api/src/handlers/users/get-users.ts +23 -0
  90. package/templates/apps/api/src/handlers/users/index.ts +17 -0
  91. package/templates/apps/api/src/handlers/users/update-user.ts +72 -0
  92. package/templates/apps/api/src/lib/dynamo/dynamo-model.ts +504 -0
  93. package/templates/apps/api/src/lib/dynamo/index.ts +12 -0
  94. package/templates/apps/api/src/lib/dynamo/utils.ts +39 -0
  95. package/templates/apps/api/src/middleware/auth0-auth.ts +97 -0
  96. package/templates/apps/api/src/middleware/cognito-auth.ts +90 -0
  97. package/templates/apps/api/src/models/UserModel.ts +109 -0
  98. package/templates/apps/api/src/schemas/user.schema.ts +44 -0
  99. package/templates/apps/api/src/services/user-service.ts +108 -0
  100. package/templates/apps/api/src/utils/auth-context.ts +60 -0
  101. package/templates/apps/api/src/utils/common/helpers.ts +26 -0
  102. package/templates/apps/api/src/utils/lambda-handler.ts +148 -0
  103. package/templates/apps/api/src/utils/response.ts +52 -0
  104. package/templates/apps/api/src/utils/validator.ts +75 -0
  105. package/templates/apps/api/tsconfig.app.json +15 -0
  106. package/templates/apps/api/tsconfig.json +19 -0
  107. package/templates/apps/api/tsconfig.spec.json +17 -0
  108. package/templates/apps/mobile/.env.example +5 -0
  109. package/templates/apps/mobile/.eslintrc.json +33 -0
  110. package/templates/apps/mobile/app.json +33 -0
  111. package/templates/apps/mobile/assets/.gitkeep +0 -0
  112. package/templates/apps/mobile/babel.config.js +19 -0
  113. package/templates/apps/mobile/index.js +7 -0
  114. package/templates/apps/mobile/jest.config.ts +22 -0
  115. package/templates/apps/mobile/metro.config.js +35 -0
  116. package/templates/apps/mobile/package.json +22 -0
  117. package/templates/apps/mobile/project.json.template +64 -0
  118. package/templates/apps/mobile/src/App.tsx +367 -0
  119. package/templates/apps/mobile/src/__tests__/App.spec.tsx +46 -0
  120. package/templates/apps/mobile/src/__tests__/store/user-store.spec.ts +156 -0
  121. package/templates/apps/mobile/src/config/api.ts +16 -0
  122. package/templates/apps/mobile/src/store/user-store.ts +56 -0
  123. package/templates/apps/mobile/src/test-setup.ts +10 -0
  124. package/templates/apps/mobile/tsconfig.json +22 -0
  125. package/templates/apps/web/.env.example +13 -0
  126. package/templates/apps/web/.eslintrc.json +26 -0
  127. package/templates/apps/web/index.html +13 -0
  128. package/templates/apps/web/jest.config.ts +24 -0
  129. package/templates/apps/web/package.json +15 -0
  130. package/templates/apps/web/project.json.template +66 -0
  131. package/templates/apps/web/src/App.tsx +352 -0
  132. package/templates/apps/web/src/__mocks__/config/api.ts +41 -0
  133. package/templates/apps/web/src/__tests__/App.spec.tsx +240 -0
  134. package/templates/apps/web/src/__tests__/store/user-store.spec.ts +185 -0
  135. package/templates/apps/web/src/auth/auth0-provider.tsx +103 -0
  136. package/templates/apps/web/src/auth/cognito-provider.tsx +143 -0
  137. package/templates/apps/web/src/auth/index.ts +7 -0
  138. package/templates/apps/web/src/auth/use-auth.ts +16 -0
  139. package/templates/apps/web/src/config/amplify-config.ts +31 -0
  140. package/templates/apps/web/src/config/api.ts +38 -0
  141. package/templates/apps/web/src/config/auth0-config.ts +17 -0
  142. package/templates/apps/web/src/main.tsx +41 -0
  143. package/templates/apps/web/src/store/user-store.ts +56 -0
  144. package/templates/apps/web/src/styles.css +165 -0
  145. package/templates/apps/web/src/test-setup.ts +1 -0
  146. package/templates/apps/web/src/theme/index.ts +30 -0
  147. package/templates/apps/web/src/vite-env.d.ts +19 -0
  148. package/templates/apps/web/tsconfig.app.json +24 -0
  149. package/templates/apps/web/tsconfig.json +22 -0
  150. package/templates/apps/web/tsconfig.spec.json +28 -0
  151. package/templates/apps/web/vite.config.ts +87 -0
  152. package/templates/manifest.json +28 -0
  153. package/templates/packages/api-client/.eslintrc.json +18 -0
  154. package/templates/packages/api-client/jest.config.ts +13 -0
  155. package/templates/packages/api-client/package.json +8 -0
  156. package/templates/packages/api-client/project.json.template +34 -0
  157. package/templates/packages/api-client/src/__tests__/api-client.spec.ts +408 -0
  158. package/templates/packages/api-client/src/api-client.ts +201 -0
  159. package/templates/packages/api-client/src/config.ts +193 -0
  160. package/templates/packages/api-client/src/index.ts +9 -0
  161. package/templates/packages/api-client/tsconfig.json +22 -0
  162. package/templates/packages/api-client/tsconfig.lib.json +11 -0
  163. package/templates/packages/api-client/tsconfig.spec.json +14 -0
  164. package/templates/packages/common-types/.eslintrc.json +18 -0
  165. package/templates/packages/common-types/package.json +6 -0
  166. package/templates/packages/common-types/project.json.template +26 -0
  167. package/templates/packages/common-types/src/api.types.ts +24 -0
  168. package/templates/packages/common-types/src/auth.types.ts +36 -0
  169. package/templates/packages/common-types/src/common.types.ts +46 -0
  170. package/templates/packages/common-types/src/index.ts +19 -0
  171. package/templates/packages/common-types/src/lambda.types.ts +39 -0
  172. package/templates/packages/common-types/src/user.types.ts +31 -0
  173. package/templates/packages/common-types/tsconfig.json +19 -0
  174. package/templates/packages/common-types/tsconfig.lib.json +11 -0
  175. package/templates/root/.editorconfig +23 -0
  176. package/templates/root/.nvmrc +1 -0
  177. package/templates/root/eslint.config.js +61 -0
  178. package/templates/root/jest.preset.js +16 -0
  179. package/templates/root/nx.json +29 -0
  180. package/templates/root/package.json +131 -0
  181. package/templates/root/tsconfig.base.json +29 -0
@@ -0,0 +1,27 @@
1
+ export type Feature = 'github-actions' | 'vscode-config';
2
+ export type BrandColor = 'blue' | 'purple' | 'teal' | 'green' | 'orange';
3
+ export type AuthProvider = 'cognito' | 'auth0' | 'none';
4
+ export type AuthFeature = 'social-login' | 'mfa';
5
+ export interface AuthConfig {
6
+ provider: AuthProvider;
7
+ features: AuthFeature[];
8
+ }
9
+ export interface OrgAccountConfig {
10
+ environment: string;
11
+ email: string;
12
+ accountId?: string;
13
+ }
14
+ export interface OrgConfig {
15
+ enabled: boolean;
16
+ organizationName: string;
17
+ accounts: OrgAccountConfig[];
18
+ }
19
+ export interface ProjectConfig {
20
+ projectName: string;
21
+ platforms: ('web' | 'mobile' | 'api')[];
22
+ awsRegion: string;
23
+ features: Feature[];
24
+ brandColor: BrandColor;
25
+ auth: AuthConfig;
26
+ org?: OrgConfig;
27
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function validateProjectName(name: string): true | string;
@@ -0,0 +1,12 @@
1
+ import validateNpmPackageName from 'validate-npm-package-name';
2
+ export function validateProjectName(name) {
3
+ if (!name.trim()) {
4
+ return 'Project name is required';
5
+ }
6
+ const validation = validateNpmPackageName(name);
7
+ if (!validation.validForNewPackages) {
8
+ const errors = [...(validation.errors || []), ...(validation.warnings || [])];
9
+ return errors[0] || 'Invalid package name';
10
+ }
11
+ return true;
12
+ }
@@ -0,0 +1,2 @@
1
+ import type { ProjectConfig } from './types.js';
2
+ export declare function runWizard(): Promise<ProjectConfig | null>;
package/dist/wizard.js ADDED
@@ -0,0 +1,81 @@
1
+ import prompts from 'prompts';
2
+ import pc from 'picocolors';
3
+ import { projectNamePrompt } from './prompts/project-name.js';
4
+ import { platformsPrompt } from './prompts/platforms.js';
5
+ import { authProviderPrompt, authFeaturesPrompt } from './prompts/auth.js';
6
+ import { featuresPrompt } from './prompts/features.js';
7
+ import { awsRegionPrompt } from './prompts/aws-config.js';
8
+ import { themePrompt } from './prompts/theme.js';
9
+ import { enableOrgPrompt, orgNamePrompt, orgEnvironmentsPrompt, devEmailPrompt, stageEmailPrompt, prodEmailPrompt, qaEmailPrompt, sandboxEmailPrompt, } from './prompts/org-structure.js';
10
+ export async function runWizard() {
11
+ const response = await prompts([
12
+ projectNamePrompt,
13
+ platformsPrompt,
14
+ authProviderPrompt,
15
+ authFeaturesPrompt,
16
+ featuresPrompt,
17
+ awsRegionPrompt,
18
+ enableOrgPrompt,
19
+ orgNamePrompt,
20
+ orgEnvironmentsPrompt,
21
+ devEmailPrompt,
22
+ stageEmailPrompt,
23
+ prodEmailPrompt,
24
+ qaEmailPrompt,
25
+ sandboxEmailPrompt,
26
+ themePrompt
27
+ ], {
28
+ onCancel: () => {
29
+ console.log(`\n${pc.red('✖')} Setup cancelled`);
30
+ process.exit(0);
31
+ }
32
+ });
33
+ // Validate all required fields present
34
+ if (!response.projectName || !response.platforms?.length || !response.awsRegion || !response.brandColor) {
35
+ return null;
36
+ }
37
+ // features defaults to empty array if all deselected
38
+ if (!response.features) {
39
+ response.features = [];
40
+ }
41
+ // Construct auth config with defaults
42
+ const auth = {
43
+ provider: response.authProvider || 'none',
44
+ features: response.authFeatures || [],
45
+ };
46
+ // Construct org config if enabled
47
+ let org;
48
+ if (response.enableOrg) {
49
+ const accounts = [];
50
+ const emailMap = {
51
+ dev: response.devEmail,
52
+ stage: response.stageEmail,
53
+ prod: response.prodEmail,
54
+ qa: response.qaEmail,
55
+ sandbox: response.sandboxEmail,
56
+ };
57
+ for (const env of response.orgEnvironments || []) {
58
+ const email = emailMap[env];
59
+ if (email) {
60
+ accounts.push({ environment: env, email });
61
+ }
62
+ }
63
+ org = {
64
+ enabled: true,
65
+ organizationName: response.orgName,
66
+ accounts,
67
+ };
68
+ }
69
+ const config = {
70
+ projectName: response.projectName,
71
+ platforms: response.platforms,
72
+ awsRegion: response.awsRegion,
73
+ features: response.features,
74
+ brandColor: response.brandColor,
75
+ auth,
76
+ };
77
+ if (org) {
78
+ config.org = org;
79
+ }
80
+ return config;
81
+ }
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "create-aws-project",
3
+ "version": "1.2.1",
4
+ "description": "CLI tool to scaffold AWS projects",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "bin": {
8
+ "create-aws-project": "./dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
13
+ "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
14
+ "test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
15
+ "lint": "eslint src --ext .ts",
16
+ "lint:fix": "eslint src --ext .ts --fix",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "engines": {
20
+ "node": ">=22.0.0"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "templates",
25
+ "README.md"
26
+ ],
27
+ "keywords": [
28
+ "aws",
29
+ "starter-kit",
30
+ "cli",
31
+ "scaffold",
32
+ "nx",
33
+ "monorepo"
34
+ ],
35
+ "license": "ISC",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/wickidcool/create-aws-project.git"
39
+ },
40
+ "author": "wickidcool",
41
+ "homepage": "https://github.com/wickidcool/create-aws-project#readme",
42
+ "bugs": {
43
+ "url": "https://github.com/wickidcool/create-aws-project/issues"
44
+ },
45
+ "dependencies": {
46
+ "@aws-sdk/client-iam": "^3.971.0",
47
+ "@aws-sdk/client-organizations": "^3.700.0",
48
+ "@aws-sdk/credential-providers": "^3.971.0",
49
+ "@octokit/rest": "^22.0.1",
50
+ "picocolors": "^1.1.1",
51
+ "prompts": "^2.4.2",
52
+ "tweetnacl": "^1.0.3",
53
+ "tweetnacl-util": "^0.15.1",
54
+ "validate-npm-package-name": "^7.0.2"
55
+ },
56
+ "devDependencies": {
57
+ "@types/jest": "^30.0.0",
58
+ "@types/node": "^24.10.1",
59
+ "@types/prompts": "^2.4.9",
60
+ "@types/validate-npm-package-name": "^4.0.2",
61
+ "@typescript-eslint/eslint-plugin": "^8.48.0",
62
+ "@typescript-eslint/parser": "^8.48.0",
63
+ "eslint": "^9.39.1",
64
+ "jest": "^30.2.0",
65
+ "ts-jest": "^29.4.5",
66
+ "typescript": "^5.9.3"
67
+ }
68
+ }
@@ -0,0 +1,24 @@
1
+ name: "Build and Test"
2
+ description: "Build the project and run unit tests"
3
+
4
+ inputs:
5
+ build-command:
6
+ description: "Build command to run"
7
+ required: false
8
+ default: "npm run build:all"
9
+ skip-tests:
10
+ description: "Skip running tests"
11
+ required: false
12
+ default: "false"
13
+
14
+ runs:
15
+ using: "composite"
16
+ steps:
17
+ - name: Build project
18
+ shell: bash
19
+ run: ${{ inputs.build-command }}
20
+
21
+ - name: Run unit tests
22
+ if: inputs.skip-tests != 'true'
23
+ shell: bash
24
+ run: npm run test
@@ -0,0 +1,46 @@
1
+ name: "Deploy CDK Stacks"
2
+ description: "Configure AWS credentials and deploy CDK stacks"
3
+
4
+ inputs:
5
+ aws-access-key-id:
6
+ description: "AWS Access Key ID"
7
+ required: true
8
+ aws-secret-access-key:
9
+ description: "AWS Secret Access Key"
10
+ required: true
11
+ aws-region:
12
+ description: "AWS Region"
13
+ required: false
14
+ default: "us-east-2"
15
+ environment:
16
+ description: "Deployment environment (dev, stage, prod)"
17
+ required: true
18
+
19
+ runs:
20
+ using: "composite"
21
+ steps:
22
+ - name: Configure AWS credentials
23
+ uses: aws-actions/configure-aws-credentials@v5
24
+ with:
25
+ aws-access-key-id: ${{ inputs.aws-access-key-id }}
26
+ aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
27
+ aws-region: ${{ inputs.aws-region }}
28
+
29
+ - name: Clean old CDK assets
30
+ shell: bash
31
+ run: |
32
+ CDK_ASSETS_BUCKET=$(aws s3api list-buckets --query 'Buckets[?contains(Name, `cdk-`) && contains(Name, `-assets-`)].Name' --output text | head -1)
33
+ if [ -n "$CDK_ASSETS_BUCKET" ]; then
34
+ echo "Cleaning CDK assets bucket: $CDK_ASSETS_BUCKET"
35
+ aws s3 rm s3://$CDK_ASSETS_BUCKET/ --recursive
36
+ else
37
+ echo "No CDK assets bucket found"
38
+ fi
39
+
40
+ - name: Deploy Main Stack
41
+ shell: bash
42
+ run: npm run cdk:deploy -- --require-approval never -c environment=${{ inputs.environment }}
43
+ env:
44
+ AWS_ACCESS_KEY_ID: ${{ inputs.aws-access-key-id }}
45
+ AWS_SECRET_ACCESS_KEY: ${{ inputs.aws-secret-access-key }}
46
+ AWS_REGION: ${{ inputs.aws-region }}
@@ -0,0 +1,72 @@
1
+ name: "Deploy Web App"
2
+ description: "Build and deploy web app to S3/CloudFront"
3
+
4
+ inputs:
5
+ aws-access-key-id:
6
+ description: "AWS Access Key ID"
7
+ required: true
8
+ aws-secret-access-key:
9
+ description: "AWS Secret Access Key"
10
+ required: true
11
+ aws-region:
12
+ description: "AWS Region"
13
+ required: false
14
+ default: "us-east-2"
15
+ environment:
16
+ description: "Deployment environment (dev, stage, prod)"
17
+ required: true
18
+
19
+ runs:
20
+ using: "composite"
21
+ steps:
22
+ - name: Configure AWS credentials
23
+ uses: aws-actions/configure-aws-credentials@v5
24
+ with:
25
+ aws-access-key-id: ${{ inputs.aws-access-key-id }}
26
+ aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
27
+ aws-region: ${{ inputs.aws-region }}
28
+
29
+ - name: Get deployed CloudFront ID and S3 bucket
30
+ id: get-aws-resources
31
+ shell: bash
32
+ run: |
33
+ ENVIRONMENT="${{ inputs.environment }}"
34
+
35
+ # Get S3 bucket name from CloudFormation export
36
+ S3_BUCKET_NAME=$(aws cloudformation list-exports --query "Exports[?Name=='${ENVIRONMENT}-web-bucket-name'].Value" --output text)
37
+
38
+ if [ -z "$S3_BUCKET_NAME" ] || [ "$S3_BUCKET_NAME" == "None" ]; then
39
+ echo "Error: Could not find web bucket export for environment: ${ENVIRONMENT}"
40
+ echo "Expected export name: ${ENVIRONMENT}-web-bucket-name"
41
+ exit 1
42
+ fi
43
+
44
+ echo "S3_BUCKET_NAME=$S3_BUCKET_NAME" >> $GITHUB_OUTPUT
45
+ echo "S3 Bucket: $S3_BUCKET_NAME"
46
+
47
+ # Get CloudFront distribution ID from CloudFormation export
48
+ CLOUDFRONT_ID=$(aws cloudformation list-exports --query "Exports[?Name=='${ENVIRONMENT}-distribution-id'].Value" --output text)
49
+
50
+ if [ -z "$CLOUDFRONT_ID" ] || [ "$CLOUDFRONT_ID" == "None" ]; then
51
+ echo "Error: Could not find CloudFront distribution export for environment: ${ENVIRONMENT}"
52
+ echo "Expected export name: ${ENVIRONMENT}-distribution-id"
53
+ exit 1
54
+ fi
55
+
56
+ echo "CLOUDFRONT_ID=$CLOUDFRONT_ID" >> $GITHUB_OUTPUT
57
+ echo "CloudFront ID: $CLOUDFRONT_ID"
58
+
59
+ - name: Build web app
60
+ shell: bash
61
+ run: npm run build:web
62
+
63
+ - name: Deploy to S3
64
+ shell: bash
65
+ run: aws s3 sync ./dist/apps/web/ s3://${{ steps.get-aws-resources.outputs.S3_BUCKET_NAME }}/ --delete
66
+
67
+ - name: Invalidate CloudFront Cache
68
+ shell: bash
69
+ run: |
70
+ aws cloudfront create-invalidation \
71
+ --distribution-id ${{ steps.get-aws-resources.outputs.CLOUDFRONT_ID }} \
72
+ --paths "/*"
@@ -0,0 +1,29 @@
1
+ name: "Setup Node.js Environment"
2
+ description: "Setup Node.js and install dependencies (requires checkout first)"
3
+
4
+ inputs:
5
+ node-version:
6
+ description: "Node.js version to use"
7
+ required: false
8
+ default: "22"
9
+ use-lfs:
10
+ description: "Whether to checkout LFS objects"
11
+ required: false
12
+ default: "false"
13
+
14
+ runs:
15
+ using: "composite"
16
+ steps:
17
+ - name: Checkout LFS objects
18
+ if: inputs.use-lfs == 'true'
19
+ shell: bash
20
+ run: git lfs checkout
21
+
22
+ - name: Setup Node.js
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: ${{ inputs.node-version }}
26
+
27
+ - name: Install dependencies
28
+ shell: bash
29
+ run: npm ci
@@ -0,0 +1,15 @@
1
+ <!-- PLEASE READ THE FOLLOWING INSTRUCTIONS -->
2
+
3
+ ### List of features
4
+ Format of information to be provided
5
+
6
+ **Proof of your testing, video or image link?**
7
+
8
+
9
+ ### Feature Pull Request Checklist
10
+
11
+ - [ ] have you rebase your `feature` with `main`?
12
+ - [ ] did you verify the latest commit of `main` exist in your `feature` branch after rebase?
13
+ - [ ] have you tested the `feature` as per the requirement?
14
+ - [ ] did you follow the proper naming conventions in your code?
15
+ - [ ] have you commented your code with proper explanation?
@@ -0,0 +1,80 @@
1
+ name: Deploy to Dev
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+ inputs:
9
+ target_branch:
10
+ description: "The release branch to run the script against"
11
+ required: true
12
+ default: "main"
13
+
14
+ jobs:
15
+ validate:
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Setup environment
23
+ uses: ./.github/actions/setup
24
+
25
+ - name: Run lint
26
+ shell: bash
27
+ run: npm run lint
28
+
29
+ test:
30
+ runs-on: ubuntu-latest
31
+
32
+ steps:
33
+ - name: Checkout code
34
+ uses: actions/checkout@v4
35
+ with:
36
+ lfs: true
37
+
38
+ - name: Setup environment
39
+ uses: ./.github/actions/setup
40
+ with:
41
+ use-lfs: "true"
42
+
43
+ - name: Build and test
44
+ uses: ./.github/actions/build-and-test
45
+
46
+ deploy-dev:
47
+ needs: [validate, test]
48
+ runs-on: ubuntu-latest
49
+ name: Deploy to DEV
50
+ environment: development
51
+
52
+ steps:
53
+ - name: Checkout code
54
+ uses: actions/checkout@v4
55
+ with:
56
+ lfs: true
57
+
58
+ - name: Setup environment
59
+ uses: ./.github/actions/setup
60
+ with:
61
+ use-lfs: "true"
62
+
63
+ - name: Build project
64
+ uses: ./.github/actions/build-and-test
65
+ with:
66
+ skip-tests: "true"
67
+
68
+ - name: Deploy to AWS
69
+ uses: ./.github/actions/deploy-cdk
70
+ with:
71
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
72
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
73
+ environment: development
74
+
75
+ - name: Deploy Web to AWS
76
+ uses: ./.github/actions/deploy-web
77
+ with:
78
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
79
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
80
+ environment: development
@@ -0,0 +1,67 @@
1
+ name: Release to Prod
2
+
3
+ on:
4
+ release:
5
+ types: [released]
6
+ workflow_dispatch:
7
+ inputs:
8
+ target_branch:
9
+ description: "The release branch to run the script against"
10
+ required: true
11
+ default: "main"
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+ with:
21
+ ref: ${{ inputs.target_branch }}
22
+ lfs: true
23
+
24
+ - name: Setup environment
25
+ uses: ./.github/actions/setup
26
+ with:
27
+ use-lfs: "true"
28
+
29
+ - name: Build and test
30
+ uses: ./.github/actions/build-and-test
31
+
32
+ deploy-prod:
33
+ needs: [test]
34
+ runs-on: ubuntu-latest
35
+ name: Deploy to PROD
36
+ environment: prod
37
+
38
+ steps:
39
+ - name: Checkout code
40
+ uses: actions/checkout@v4
41
+ with:
42
+ ref: ${{ inputs.target_branch }}
43
+ lfs: true
44
+
45
+ - name: Setup environment
46
+ uses: ./.github/actions/setup
47
+ with:
48
+ use-lfs: "true"
49
+
50
+ - name: Build project
51
+ uses: ./.github/actions/build-and-test
52
+ with:
53
+ skip-tests: "true"
54
+
55
+ - name: Deploy to AWS
56
+ uses: ./.github/actions/deploy-cdk
57
+ with:
58
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
59
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
60
+ environment: prod
61
+
62
+ - name: Deploy Web to AWS
63
+ uses: ./.github/actions/deploy-web
64
+ with:
65
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
66
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
67
+ environment: prod
@@ -0,0 +1,77 @@
1
+ name: Pre-Release to Stage
2
+
3
+ on:
4
+ release:
5
+ types: [prereleased]
6
+ workflow_dispatch:
7
+ inputs:
8
+ target_branch:
9
+ description: "The release branch to run the script against"
10
+ required: true
11
+ default: "main"
12
+
13
+ jobs:
14
+ validate:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+ with:
21
+ ref: ${{ inputs.target_branch }}
22
+ lfs: true
23
+
24
+ - name: Setup environment
25
+ uses: ./.github/actions/setup
26
+ with:
27
+ use-lfs: "true"
28
+
29
+ test:
30
+ runs-on: ubuntu-latest
31
+
32
+ steps:
33
+ - name: Checkout code
34
+ uses: actions/checkout@v4
35
+ with:
36
+ lfs: true
37
+
38
+ - name: Setup environment
39
+ uses: ./.github/actions/setup
40
+ with:
41
+ use-lfs: "true"
42
+
43
+ - name: Build and test
44
+ uses: ./.github/actions/build-and-test
45
+
46
+ deploy-stage:
47
+ needs: [validate, test]
48
+ runs-on: ubuntu-latest
49
+ name: Deploy to Stage
50
+ environment: stage
51
+
52
+ steps:
53
+ - name: Checkout code
54
+ uses: actions/checkout@v4
55
+
56
+ - name: Setup environment
57
+ uses: ./.github/actions/setup
58
+
59
+ - name: Build project
60
+ uses: ./.github/actions/build-and-test
61
+ with:
62
+ build-command: "npm run build:all"
63
+ skip-tests: "true"
64
+
65
+ - name: Deploy to AWS
66
+ uses: ./.github/actions/deploy-cdk
67
+ with:
68
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
69
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
70
+ environment: stage
71
+
72
+ - name: Deploy Web to AWS
73
+ uses: ./.github/actions/deploy-web
74
+ with:
75
+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
76
+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
77
+ environment: stage
@@ -0,0 +1,72 @@
1
+ name: Pull Request Checks
2
+
3
+ on:
4
+ pull_request:
5
+
6
+ jobs:
7
+ lint:
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - name: Checkout code
12
+ uses: actions/checkout@v4
13
+
14
+ - name: Setup environment
15
+ uses: ./.github/actions/setup
16
+
17
+ - name: Run lint
18
+ shell: bash
19
+ run: npm run lint
20
+
21
+ test:
22
+ runs-on: ubuntu-latest
23
+ env:
24
+ NODE_ENV: dev
25
+
26
+ steps:
27
+ - name: Checkout code
28
+ uses: actions/checkout@v4
29
+ with:
30
+ lfs: true
31
+
32
+ - name: Setup environment
33
+ uses: ./.github/actions/setup
34
+ with:
35
+ use-lfs: "true"
36
+
37
+ - name: Build and test
38
+ uses: ./.github/actions/build-and-test
39
+
40
+ - name: Run tests with coverage
41
+ run: npm run test:coverage
42
+ env:
43
+ NODE_OPTIONS: "--localstorage-file=/tmp/jest-localstorage"
44
+
45
+ - name: Coverage Report
46
+ uses: MishaKav/jest-coverage-comment@main
47
+ with:
48
+ github-token: ${{ secrets.GITHUB_TOKEN }}
49
+ coverage-summary-path: ./coverage/apps/web/coverage-summary.json
50
+ title: "Test Coverage Report"
51
+ summary-title: "Coverage Summary"
52
+ multiple-files: |
53
+ Web App, ./coverage/apps/web/coverage-summary.json
54
+ API, ./coverage/apps/api/coverage-summary.json
55
+ API Client, ./coverage/packages/api-client/coverage-summary.json
56
+ Mobile, ./coverage/apps/mobile/coverage-summary.json
57
+
58
+ build:
59
+ needs: [lint, test]
60
+ runs-on: ubuntu-latest
61
+
62
+ steps:
63
+ - name: Checkout code
64
+ uses: actions/checkout@v4
65
+
66
+ - name: Setup environment
67
+ uses: ./.github/actions/setup
68
+
69
+ - name: Build project
70
+ uses: ./.github/actions/build-and-test
71
+ with:
72
+ skip-tests: "true"