Skip to content

Commit

Permalink
chore: setup folder structure for cdk app, aws services and web app
Browse files Browse the repository at this point in the history
  • Loading branch information
elailai94 committed Oct 28, 2022
1 parent 50aee3f commit bc7c502
Show file tree
Hide file tree
Showing 67 changed files with 22,372 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
cdk.out
dist
node_modules
7 changes: 7 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"root": true,
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false
}
}
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# dependencies
node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*

# CDK
infrastructure/cdk.out

# React
webapp/public/config.json
webapp/build

# Yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
yarn-debug.log*
yarn-error.log*
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": false,
"printWidth": 110,
"tabWidth": 2,
"arrowParens": "avoid"
}
801 changes: 801 additions & 0 deletions .yarn/releases/yarn-3.2.4.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.2.4.cjs
File renamed without changes.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# CDK Document Management System

![Amazon AWS](https://img.shields.io/badge/Amazon_AWS-FF9900?style=for-the-badge&logo=amazonaws&logoColor=white)
![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: ["@babel/preset-env", "@babel/preset-react"],
targets: {
node: "current",
},
};
34 changes: 34 additions & 0 deletions infrastructure/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2020,
"project": "infrastructure/tsconfig.json",
"sourceType": "module"
},
"extends": [
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint"
],
"plugins": [
"@typescript-eslint"
],
"rules": {
"linebreak-style": "off"
},
"overrides": [
{
"files": ["**/*.ts"],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"import/prefer-default-export": "off",
"max-classes-per-file": "off",
"no-console": "off",
"no-new": "off"
}
}
]
}
8 changes: 8 additions & 0 deletions infrastructure/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.js
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
cdk.out
6 changes: 6 additions & 0 deletions infrastructure/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
14 changes: 14 additions & 0 deletions infrastructure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `cdk deploy` deploy this stack to your default AWS account/region
* `cdk diff` compare deployed stack with current state
* `cdk synth` emits the synthesized CloudFormation template
13 changes: 13 additions & 0 deletions infrastructure/bin/infrastructure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env node

import * as cdk from "aws-cdk-lib";

import { ApplicationStack } from "../lib/core";

const app = new cdk.App();
new ApplicationStack(app, "ApplicationStack", {
env: {
account: process.env.CDK_DEFAULT_ACCOUNT,
region: process.env.CDK_DEFAULT_REGION,
},
});
42 changes: 42 additions & 0 deletions infrastructure/cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"app": "npx ts-node --prefer-ts-exts bin/infrastructure.ts",
"watch": {
"include": [
"**"
],
"exclude": [
"README.md",
"cdk*.json",
"**/*.d.ts",
"**/*.js",
"tsconfig.json",
"package*.json",
"yarn.lock",
"node_modules",
"test"
]
},
"context": {
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
"@aws-cdk/core:stackRelativeExports": true,
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
"@aws-cdk/aws-lambda:recognizeVersionProps": true,
"@aws-cdk/aws-lambda:recognizeLayerVersion": true,
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true,
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
"@aws-cdk/core:checkSecretUsage": true,
"@aws-cdk/aws-iam:minimizePolicies": true,
"@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true,
"@aws-cdk/core:validateSnapshotRemovalPolicy": true,
"@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true,
"@aws-cdk/aws-s3:createDefaultLoggingPolicy": true,
"@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true,
"@aws-cdk/aws-apigateway:disableCloudWatchRole": true,
"@aws-cdk/core:enablePartitionLiterals": true,
"@aws-cdk/core:target-partitions": [
"aws",
"aws-cn"
]
}
}
8 changes: 8 additions & 0 deletions infrastructure/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
testEnvironment: "node",
roots: ["<rootDir>/test"],
testMatch: ["**/*.test.ts"],
transform: {
"^.+\\.tsx?$": "ts-jest"
}
};
12 changes: 12 additions & 0 deletions infrastructure/lib/core/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as cdk from "aws-cdk-lib";
import { Construct } from "constructs";

export class ApplicationStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

new cdk.CfnOutput(this, "TestOutput", {
value: "Hey, it worked!"
});
}
}
25 changes: 25 additions & 0 deletions infrastructure/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@cdk-document-management-system/infrastructure",
"version": "0.1.0",
"bin": "bin/infrastructure.js",
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "jest",
"cdk": "cdk"
},
"devDependencies": {
"@types/jest": "^29.2.0",
"@types/node": "^18.11.7",
"@types/prettier": "^2.7.1",
"aws-cdk": "2.49.0",
"jest": "^29.2.2",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
},
"dependencies": {
"aws-cdk-lib": "2.49.0",
"constructs": "^10.1.142"
}
}
30 changes: 30 additions & 0 deletions infrastructure/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"target": "ES2018",
"module": "commonjs",
"lib": [
"es2018"
],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": false,
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"typeRoots": [
"../node_modules/@types"
]
},
"exclude": [
"node_modules",
"cdk.out"
]
}
50 changes: 50 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "cdk-document-management-system",
"private": true,
"packageManager": "[email protected]",
"workspaces": [
"infrastructure",
"webapp",
"services/*"
],
"scripts": {
"lint": "npx eslint . --fix --ext .js,.ts,.jsx",
"test": "",
"load:sampleData": "aws dynamodb batch-write-item --request-items file://sampleData.json"
},
"devDependencies": {
"@babel/eslint-parser": "^7.19.1",
"@types/jest": "^29.2.0",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"esbuild": "^0.15.12",
"eslint": "^8.26.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-airbnb-typescript-prettier": "^5.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-simple-import-sort": "^8.0.0",
"eslint-plugin-unicorn": "^44.0.2",
"husky": "^8.0.1",
"jest-html-reporter": "^3.7.0",
"jest-junit": "^14.0.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"prettier-eslint": "^15.0.1",
"ts-jest": "^29.0.3",
"typescript": "^4.8.4"
},
"resolutions": {
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"jest": "^29.2.2"
}
}
15 changes: 15 additions & 0 deletions services/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": [
"airbnb",
"prettier",
"plugin:jest/recommended"
],
"plugins": ["prettier"],
"rules": {
"consistent-return": "off",
"global-require": "off",
"import/prefer-default-export": "off",
"no-underscore-dangle": "off",
"prettier/prettier": ["error", { "singleQuote": true }]
}
}
Loading

0 comments on commit bc7c502

Please sign in to comment.