Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting/lint #314

Merged
merged 7 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ jobs:
determine-service-matrix:
runs-on: ubuntu-latest
outputs:
services: ${{ steps.determine-matrix.outputs.changes }}
services: ${{ steps.determine-matrix.outputs.changes }}
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: determine-matrix
with:
# Note, 'common' is for future use--when code is factored out into common libraries,
# but it's set up here so that the workflow logic could be tested with it present
filters: |
common:
- '*'
Expand All @@ -41,39 +43,36 @@ jobs:
- 'services/content-watcher/**'

build:
name: "[${{ matrix.service }}] Build and Test"
name: '[${{ matrix.service }}] Build and Test'
runs-on: ubuntu-latest
needs: determine-service-matrix
strategy:
matrix:
service: ${{ fromJson(needs.determine-service-matrix.outputs.services) }}
exclude:
- service: common
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
registry-url: "https://registry.npmjs.org"
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
cache-dependency-path: services/${{ matrix.service }}/package-lock.json
- name: Install dependencies
working-directory: services/${{ matrix.service }}
run: npm ci
if: matrix.service != 'common'
- name: Build NestJS
working-directory: services/${{ matrix.service }}
run: npm run build
if: matrix.service != 'common'
- name: Lint
working-directory: services/${{ matrix.service }}
run: npm run lint
if: matrix.service != 'common'
- name: Unit Test
working-directory: services/${{ matrix.service }}
run: npm run test
if: matrix.service != 'common'
- name: License Check
working-directory: services/${{ matrix.service }}
# List all the licenses and error out if it is not one of the supported licenses
run: npx license-report --fields=name --fields=licenseType | jq 'map(select(.licenseType | IN("MIT", "Apache-2.0", "ISC", "BSD-3-Clause", "BSD-2-Clause", "(Apache-2.0 AND MIT)", "Apache-2.0 OR MIT") | not)) | if length == 0 then halt else halt_error(1) end'
if: matrix.service != 'common'
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore artifacts
**/dist
**/build
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"prettier.configPath": ".prettierrc.json",
"eslint.workingDirectories": [
"./services/account",
"./services/graph",
"./services/content-publishing",
"./services/content-watcher"
]
}
33 changes: 29 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"name": "@amplicalabs/gateway",
"name": "@amplica-labs/gateway",
"version": "1.0.0",
"description": "<!-- TABLE OF CONTENTS -->",
"main": "index.js",
"directories": {
"doc": "docs"
},
"description": "Monorepo for Gateway shared packages",
"author": "Project Liberty, LLC",
"license": "Apache-2.0",
"workspaces": [
"packages/*"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"format": "prettier --write ."
},
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"prettier": "^3.3.3"
"@amplica-labs/prettier-config": "^1.0.0"
}
}
11 changes: 11 additions & 0 deletions packages/prettier-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@amplica-labs/prettier-config",
"version": "1.0.0",
"description": "Shared prettier config",
"main": "./prettier-config.json",
"author": "",
"license": "Apache-2.0",
"peerDependencies": {
"prettier": "^3.3.3"
}
}
11 changes: 11 additions & 0 deletions packages/ts-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@amplica-labs/ts-config",
"version": "1.0.0",
"description": "Shared TS compiler options",
"main": "tsconfig.json",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "Apache-2.0"
}
20 changes: 20 additions & 0 deletions packages/ts-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "CommonJS",
"moduleResolution": "node",
"noImplicitAny": false,
"noImplicitThis": false,
"outDir": "dist",
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"skipLibCheck": true,
"strictPropertyInitialization": false,
"target": "es2021",
}
}
1 change: 1 addition & 0 deletions services/account/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@amplica-labs/prettier-config"
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable max-classes-per-file */
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional } from 'class-validator';

Expand Down
24 changes: 24 additions & 0 deletions services/account/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions services/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
},
"devDependencies": {
"@amplica-labs/frequency-scenario-template": "^1.1.4",
"@amplica-labs/prettier-config": "file:../../packages/prettier-config",
"@amplica-labs/ts-config": "file:../../packages/ts-config",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.11",
"@types/supertest": "^6.0.2",
Expand Down
16 changes: 1 addition & 15 deletions services/account/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
"extends": "@amplica-labs/ts-config",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "CommonJS",
"moduleResolution": "node",
"noImplicitAny": false,
"noImplicitThis": false,
"outDir": "dist",
"paths": {
"#api": [
"apps/api/src"
Expand Down Expand Up @@ -60,12 +52,6 @@
"libs/common/src/utils/*"
]
},
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"skipLibCheck": true,
"strictPropertyInitialization": false,
"target": "es2021",
"typeRoots": [
"node_modules/@types"
]
Expand Down
10 changes: 10 additions & 0 deletions services/content-publishing/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions services/content-publishing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"time-constants": "^1.0.3"
},
"devDependencies": {
"@amplica-labs/ts-config": "file:../../packages/ts-config",
"@jest/globals": "^29.7.0",
"@nestjs/testing": "^10.3.8",
"@types/express": "^4.17.21",
Expand Down
19 changes: 3 additions & 16 deletions services/content-publishing/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
{
"extends": "@amplica-labs/ts-config",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": "./src",
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "CommonJS",
"moduleResolution": "node",
"noImplicitAny": false,
"noImplicitThis": false,
"baseUrl": ".",
"outDir": "dist",
"paths": {
"#app/*": [
Expand All @@ -21,14 +14,8 @@
"libs/common/src/*"
]
},
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"skipLibCheck": true,
"strictPropertyInitialization": false,
"target": "es2021",
"typeRoots": [
"node_modules/@types"
]
}
}
}
10 changes: 10 additions & 0 deletions services/content-watcher/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading