Skip to content

Commit 8056b5a

Browse files
authored
Merge pull request #223 from import-ai/fix/lint
build(lint): support test lint
2 parents 268df92 + 8f40703 commit 8056b5a

File tree

13 files changed

+111
-52
lines changed

13 files changed

+111
-52
lines changed

.github/workflows/ci.yaml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name: CI
33
on:
44
push:
55
branches:
6-
- "main"
6+
- 'main'
77
tags:
8-
- "v*"
8+
- 'v*'
99
pull_request:
1010
branches:
1111
- 'main'
@@ -77,19 +77,46 @@ jobs:
7777
cache-from: type=gha
7878
cache-to: type=gha,mode=max
7979

80-
test:
80+
lint:
8181
runs-on: ubuntu-latest
82-
needs: [ runtime ]
83-
container:
84-
image: ghcr.io/import-ai/omnibox-backend-runtime:latest
85-
credentials:
86-
username: ${{ github.actor }}
87-
password: ${{ secrets.GITHUB_TOKEN }}
82+
steps:
83+
- name: Checkout
84+
uses: actions/checkout@v4
8885

86+
- name: Setup pnpm
87+
uses: pnpm/action-setup@v4
88+
with:
89+
version: 10.17.1
90+
91+
- name: Setup Node.js
92+
uses: actions/setup-node@v4
93+
with:
94+
node-version: '20'
95+
cache: 'pnpm'
96+
97+
- name: Install dependencies
98+
run: pnpm install --frozen-lockfile
99+
100+
- name: Run lint
101+
run: pnpm lint
102+
103+
test:
104+
runs-on: ubuntu-latest
89105
steps:
90106
- name: Checkout
91107
uses: actions/checkout@v4
92108

109+
- name: Setup pnpm
110+
uses: pnpm/action-setup@v4
111+
with:
112+
version: 10.17.1
113+
114+
- name: Setup Node.js
115+
uses: actions/setup-node@v4
116+
with:
117+
node-version: '20'
118+
cache: 'pnpm'
119+
93120
- name: Install dependencies
94121
run: pnpm install --frozen-lockfile
95122

@@ -108,9 +135,7 @@ jobs:
108135
- name: Run tests
109136
run: pnpm test:e2e --coverage
110137
env:
111-
OBB_POSTGRES_URL: postgres://omnibox:omnibox@postgres:5432/omnibox
112-
OBB_MINIO_URL: http://username:password@minio:9000/omnibox
113-
OBB_LOG_LEVELS: ""
138+
OBB_LOG_LEVELS: ''
114139

115140
- name: Print coverage report
116141
run: |
@@ -125,7 +150,7 @@ jobs:
125150

126151
app:
127152
runs-on: ubuntu-latest
128-
needs: [ test ]
153+
needs: [runtime, test, lint]
129154
steps:
130155
- name: Checkout
131156
uses: actions/checkout@v4
@@ -172,7 +197,7 @@ jobs:
172197

173198
webhook:
174199
runs-on: ubuntu-latest
175-
needs: [ app ]
200+
needs: [app]
176201
steps:
177202
- name: TEST push webhook
178203
if: github.event_name == 'push'

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm lint:fix

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ FROM ghcr.io/import-ai/omnibox-backend-runtime:latest
1010

1111
WORKDIR /app
1212
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
13-
RUN pnpm install --prod
13+
RUN HUSKY=0 pnpm install --prod
1414
COPY --from=builder /app/dist ./dist
1515

1616
EXPOSE 3000

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
"start:dev": "nest start --watch",
1010
"start:debug": "nest start --debug --watch",
1111
"start:prod": "node dist/main",
12-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
12+
"lint": "eslint \"{src,test}/**/*.ts\"",
13+
"lint:fix": "eslint \"{src,test}/**/*.ts\" --fix",
1314
"test": "jest",
1415
"test:watch": "jest --watch",
1516
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
16-
"test:e2e": "jest --config jest.e2e-config.js --runInBand"
17+
"test:e2e": "jest --config jest.e2e-config.js --runInBand",
18+
"prepare": "husky || true"
1719
},
1820
"devDependencies": {
1921
"@eslint/eslintrc": "^3.3.1",
@@ -37,6 +39,7 @@
3739
"eslint-config-prettier": "^10.1.8",
3840
"eslint-plugin-prettier": "^5.5.4",
3941
"globals": "^16.4.0",
42+
"husky": "^9.1.7",
4043
"jest": "^29.7.0",
4144
"prettier": "^3.6.2",
4245
"source-map-support": "^0.5.21",

pnpm-lock.yaml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ ENV PATH="$PNPM_HOME:$PATH"
66
RUN corepack enable
77
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
88
RUN pnpm add -g pm2@6
9-
RUN pnpm install --prod
9+
RUN HUSKY=0 pnpm install --prod

src/auth/auth.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class AuthService {
9696
lang?: string;
9797
},
9898
) {
99-
const payload: SignUpPayloadDto = await this.jwtVerify(token);
99+
const payload: SignUpPayloadDto = this.jwtVerify(token);
100100
const account = await this.userService.findByEmail(payload.email);
101101
if (account) {
102102
const message = this.i18n.t('auth.errors.emailAlreadyExists');
@@ -227,7 +227,7 @@ export class AuthService {
227227
}
228228

229229
async inviteConfirm(token: string): Promise<void> {
230-
const payload: InvitePayloadDto = await this.jwtVerify(token);
230+
const payload: InvitePayloadDto = this.jwtVerify(token);
231231
const user = await this.userService.find(payload.userId);
232232
await this.dataSource.transaction(async (manager) => {
233233
await this.handleUserInvitation(user.id, payload.invitation, manager);

0 commit comments

Comments
 (0)