diff --git a/.eslintrc.json b/.eslintrc.json index bfd0e5f15..ba8973824 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,16 +1,9 @@ { - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "prettier" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "./tsconfig.json" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - } + "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "./tsconfig.json" + }, + "plugins": ["@typescript-eslint"], + "rules": {} } diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 915bdb2ac..4774a4554 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,21 +1,19 @@ version: 2 updates: - # Maintain dependencies for GitHub Actions - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: 'github-actions' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' # Maintain dependencies for npm - - package-ecosystem: "npm" - directory: "/" + - package-ecosystem: 'npm' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' # Maintain dependencies for docker - - package-ecosystem: "docker" - directory: "/usecases/guest-webapp-sample/container/sample-ecs-app" + - package-ecosystem: 'docker' + directory: '/usecases/guest-webapp-sample/container/sample-ecs-app' schedule: - interval: "weekly" - + interval: 'weekly' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb47fb28d..b8bef94be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: build on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: build: @@ -20,6 +20,9 @@ jobs: - node: 14 os: windows-latest steps: + - run: | + git config --global core.autocrlf false + git config --global core.eol lf - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: @@ -30,7 +33,8 @@ jobs: echo "node: $(node --version)" echo "npm: $(npm --version)" - run: npm ci - - run: npm run lint + - run: npm run lint:ci + - run: npm run format:ci - run: npm run build --workspaces - run: npm run test --workspaces - run: npm run synth:dev --workspaces diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2aff4b09..b81877be4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,39 +1,40 @@ default: - before_script: - - npm i -g npm - - echo node $(node --version) - - echo npm $(npm --version) - - npm ci --cache .npm --prefer-offline - cache: - key: - files: - - package-lock.json - prefix: ${CI_PROJECT_NAME} - paths: - - .npm/ + before_script: + - npm i -g npm + - echo node $(node --version) + - echo npm $(npm --version) + - npm ci --cache .npm --prefer-offline + cache: + key: + files: + - package-lock.json + prefix: ${CI_PROJECT_NAME} + paths: + - .npm/ variables: - # Disable AWS profile in GitLab Runner to avoid unintended access during `cdk synth`. - # If you use your AWS account to deploy CDK apps, you should remove this, then set secret varibales in GitLab CI/CD settings from web. - AWS_PROFILE: "" - AWS_DEFAULT_REGION: "" - AWS_ACCESS_KEY_ID: "" - AWS_SECRET_ACCESS_KEY: "" + # Disable AWS profile in GitLab Runner to avoid unintended access during `cdk synth`. + # If you use your AWS account to deploy CDK apps, you should remove this, then set secret varibales in GitLab CI/CD settings from web. + AWS_PROFILE: '' + AWS_DEFAULT_REGION: '' + AWS_ACCESS_KEY_ID: '' + AWS_SECRET_ACCESS_KEY: '' .node-build: &node-build - - npm run lint - - npm run build --workspaces - - npm run test --workspaces - - npm run synth:dev --workspaces + - npm run lint:ci + - npm run format:ci + - npm run build --workspaces + - npm run test --workspaces + - npm run synth:dev --workspaces build-node14: - stage: build - image: node:14 - script: - - *node-build + stage: build + image: node:14 + script: + - *node-build build-node16: - stage: build - image: node:16 - script: - - *node-build + stage: build + image: node:16 + script: + - *node-build diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..9867efa50 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +LICENSE +CHANGELOG.md +CODE_OF_CONDUCT.md +CONTRIBUTING.md +.github/PULL_REQUEST_TEMPLATE.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md old mode 100755 new mode 100644 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100755 new mode 100644 diff --git a/package.json b/package.json index 810754af6..d3dafb2c4 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,9 @@ ], "scripts": { "lint": "eslint --fix .", + "lint:ci": "eslint .", "format": "prettier --write .", + "format:ci": "prettier --check .", "release": "standard-version" }, "devDependencies": { @@ -41,8 +43,10 @@ "*": [ "git-secrets --scan" ], - "*.ts": [ - "npx eslint --fix", + "*.(ts|tsx|js|jsx)": [ + "npx eslint --fix" + ], + "*.(ts|tsx|js|jsx|json|html|yml|yaml|md|graphql|css|scss|less|vue|flow)": [ "npx prettier --write" ] } diff --git a/tools/cicd/jest.config.js b/tools/cicd/jest.config.js index 772f97490..98bd8c9e5 100644 --- a/tools/cicd/jest.config.js +++ b/tools/cicd/jest.config.js @@ -2,6 +2,6 @@ module.exports = { roots: ['/test'], testMatch: ['**/*.test.ts'], transform: { - '^.+\\.tsx?$': 'ts-jest' - } + '^.+\\.tsx?$': 'ts-jest', + }, }; diff --git a/usecases/base-standalone/cfn/AWS-Control-Tower-Detective-Guardrails.yaml b/usecases/base-standalone/cfn/AWS-Control-Tower-Detective-Guardrails.yaml index 9a256bf2e..1ef7a61b3 100644 --- a/usecases/base-standalone/cfn/AWS-Control-Tower-Detective-Guardrails.yaml +++ b/usecases/base-standalone/cfn/AWS-Control-Tower-Detective-Guardrails.yaml @@ -7,7 +7,7 @@ # AWS Config Rules based guardrails from AWS Control Tower. Use this conformance # pack to apply AWS Control Tower detective guardrails to your existing accounts # prior to enrolling them in AWS Control Tower or to manage resources in your -# accounts in regions not currently supported by AWS Control Tower. +# accounts in regions not currently supported by AWS Control Tower. ################################################################################### Resources: @@ -166,4 +166,4 @@ Resources: SourceIdentifier: S3_BUCKET_VERSIONING_ENABLED Scope: ComplianceResourceTypes: - - AWS::S3::Bucket \ No newline at end of file + - AWS::S3::Bucket diff --git a/usecases/guest-apiapp-sample/package.json b/usecases/guest-apiapp-sample/package.json index 603969406..1efbf2ad7 100644 --- a/usecases/guest-apiapp-sample/package.json +++ b/usecases/guest-apiapp-sample/package.json @@ -8,7 +8,7 @@ "blea-guest-apiapp-nodejs-sample": "bin/blea-guest-apiapp-nodejs-sample.js" }, "scripts": { - "synth:dev": "npx cdk synth -c environment=dev", + "synth:dev": "npx cdk synth -c environment=dev && npx cdk synth --app \"npx ts-node bin/blea-guest-apiapp-python-sample.ts\" -c environment=dev", "depcheck": "npx depcheck --ignore-dirs cdk.out", "build": "tsc --build", "clean": "tsc --build --clean && rm -rf cdk.out", diff --git a/usecases/guest-webapp-sample/package.json b/usecases/guest-webapp-sample/package.json index be059018e..05764acc6 100644 --- a/usecases/guest-webapp-sample/package.json +++ b/usecases/guest-webapp-sample/package.json @@ -8,7 +8,7 @@ "blea-guest-ecsapp-sample": "bin/blea-guest-ecsapp-sample.js" }, "scripts": { - "synth:dev": "npx cdk synth -c environment=dev", + "synth:dev": "npx cdk synth -c environment=dev && npx cdk synth --app \"npx ts-node bin/blea-guest-asgapp-sample.ts\" -c environment=dev && npx cdk synth --app \"npx ts-node bin/blea-guest-ec2app-sample.ts\" -c environment=dev && npx cdk synth --app \"npx ts-node bin/blea-guest-ecsapp-ssl-sample.ts\" -c environment=dev", "depcheck": "npx depcheck --ignore-dirs cdk.out", "build": "tsc --build", "clean": "tsc --build --clean && rm -rf cdk.out",