-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
chore: initial commit 🚀
0 parents
commit f219da5
Showing
24 changed files
with
7,227 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/node_modules | ||
/dist | ||
/.idea | ||
/.vscode | ||
/.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin', 'typescript-sort-keys'], | ||
extends: [ | ||
'@channel.io/eslint-config', | ||
'plugin:typescript-sort-keys/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@channel.io/hooks-deps-element-newline': 0, | ||
'@typescript-eslint/explicit-member-accessibility': [ | ||
'error', | ||
{ | ||
accessibility: 'no-public', | ||
}, | ||
], | ||
'@typescript-eslint/camelcase': 'off', | ||
'import/order': [ | ||
'error', | ||
{ | ||
'newlines-between': 'always', | ||
alphabetize: { order: 'asc' }, | ||
groups: [ | ||
'external', | ||
'builtin', | ||
'internal', | ||
'parent', | ||
'sibling', | ||
'index', | ||
], | ||
}, | ||
], | ||
'typescript-sort-keys/interface': 'warn', | ||
'typescript-sort-keys/string-enum': 'warn', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- dev | ||
- main | ||
push: | ||
branches: | ||
- dev | ||
- main | ||
tags: | ||
- v* | ||
|
||
concurrency: # only one job can be run in one PR | ||
group: ${{ github.head_ref || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
ci: | ||
name: Test and Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.17.1' | ||
|
||
- name: Setup pnpm | ||
run: npm install -g pnpm | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Lint | ||
run: pnpm run lint | ||
|
||
- name: Unit test | ||
run: pnpm run test | ||
|
||
- name: E2E test | ||
run: pnpm run test:e2e | ||
|
||
- name: Build | ||
run: pnpm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# compiled output | ||
/dist | ||
/node_modules | ||
/build | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# temp directory | ||
.temp | ||
.tmp | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
.eslintcache | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pnpm run typecheck && pnpm lint-staged --no-stash && pnpm jest -o --forceExit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pnpm test && pnpm test:e2e && pnpm knip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
22.12.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"tabWidth": 2, | ||
"singleAttributePerLine": true, | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h1 align="center"> | ||
<br /> | ||
📁 | ||
<br /> | ||
@cabinet/server | ||
<sup> | ||
<br /> | ||
<br /> | ||
</sup> | ||
</h1> | ||
|
||
<div align="center"> | ||
<br /> | ||
<sup>archive <i>everything</i> on the web <i>anywhere</i></sup> | ||
<br /> | ||
<br /> | ||
</div> | ||
|
||
## Introduction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
FROM node:18.17.1-alpine AS deps | ||
WORKDIR /app | ||
|
||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ | ||
|
||
RUN \ | ||
if [ -f package-lock.json ]; then npm ci; \ | ||
elif [ -f yarn.lock ]; then yarn --frozen-lockfile; \ | ||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
FROM node:18.17.1-alpine AS builder | ||
WORKDIR /app | ||
|
||
COPY --from=deps /app/node_modules ./node_modules | ||
|
||
COPY . . | ||
|
||
RUN \ | ||
if [ -f package-lock.json ]; then npm run build; \ | ||
elif [ -f yarn.lock ]; then yarn build; \ | ||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm build; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
ENV NODE_ENV=production | ||
|
||
RUN \ | ||
if [ -f package-lock.json ]; then npm ci --only=production && npm cache clean --force; \ | ||
elif [ -f yarn.lock ]; then yarn --frozen-lockfile --production && yarn cache clean; \ | ||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile --prod; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
FROM node:18.17.1-alpine AS runner | ||
WORKDIR /app | ||
|
||
COPY --from=builder --chown=node:node /app/dist ./dist | ||
COPY --from=builder --chown=node:node /app/node_modules ./node_modules | ||
|
||
USER node | ||
|
||
CMD ["node", "dist/main.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
moduleFileExtensions: ['js', 'json', 'ts'], | ||
rootDir: 'src', | ||
testRegex: '.*\\.spec\\.ts$', | ||
transform: { | ||
'^.+\\.(t|j)s$': 'ts-jest', | ||
}, | ||
collectCoverageFrom: ['**/*.(t|j)s'], | ||
coverageDirectory: '../coverage', | ||
testEnvironment: 'node', | ||
moduleNameMapper: { | ||
'^@/(.*)$': '<rootDir>/$1', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "https://unpkg.com/knip@5/schema.json", | ||
"entry": ["src/main.ts", "test/**/*.ts", "typeorm.config.ts"], | ||
"project": ["src/**/*.ts", "test/**/*.ts"], | ||
"ignore": ["src/migrations/**"], | ||
"ignoreDependencies": ["@types/express", "source-map-support", "ts-loader"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/nest-cli", | ||
"collection": "@nestjs/schematics", | ||
"sourceRoot": "src", | ||
"compilerOptions": { | ||
"deleteOutDir": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"name": "@cabinet/server", | ||
"version": "0.0.0", | ||
"description": "", | ||
"author": { | ||
"name": "Sophia", | ||
"email": "[email protected]", | ||
"url": "https://sophia-dev.io" | ||
}, | ||
"private": true, | ||
"license": "UNLICENSED", | ||
"scripts": { | ||
"typecheck": "tsc --noEmit", | ||
"build": "nest build", | ||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"dev": "nest start --watch", | ||
"debug": "nest start --debug --watch", | ||
"start": "node dist/main", | ||
"lint": "eslint \"{src,apps,libs,test,scripts}/**/*.ts\" --fix", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage", | ||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", | ||
"test:e2e": "jest --config ./test/jest-e2e.json", | ||
"prepare": "husky", | ||
"knip": "knip", | ||
"migration": "node -r ts-node/register ./scripts/migration.ts" | ||
}, | ||
"lint-staged": { | ||
"{src,test}/**/*.{ts,js}": "eslint --cache --fix", | ||
"{src,test}/**/*.{ts}": "prettier --write --cache" | ||
}, | ||
"dependencies": { | ||
"@nestjs/common": "^10.0.0", | ||
"@nestjs/core": "^10.0.0", | ||
"@nestjs/platform-express": "^10.0.0", | ||
"class-transformer": "^0.5.1", | ||
"class-validator": "^0.14.1", | ||
"husky": "^9.1.6", | ||
"reflect-metadata": "^0.2.0", | ||
"rxjs": "^7.8.1" | ||
}, | ||
"devDependencies": { | ||
"@channel.io/eslint-config": "^2.1.0", | ||
"@nestjs/cli": "^10.0.0", | ||
"@nestjs/schematics": "^10.0.0", | ||
"@nestjs/testing": "^10.0.0", | ||
"@types/express": "^5.0.0", | ||
"@types/jest": "^29.5.2", | ||
"@types/node": "^20.3.1", | ||
"@types/supertest": "^6.0.0", | ||
"@typescript-eslint/eslint-plugin": "^8.0.0", | ||
"@typescript-eslint/parser": "^8.0.0", | ||
"eslint": "^8.0.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"eslint-plugin-typescript-sort-keys": "^3.3.0", | ||
"jest": "^29.5.0", | ||
"knip": "^5.37.0", | ||
"lint-staged": "^15.2.10", | ||
"prettier": "^3.0.0", | ||
"source-map-support": "^0.5.21", | ||
"supertest": "^7.0.0", | ||
"ts-jest": "^29.1.0", | ||
"ts-loader": "^9.4.3", | ||
"ts-node": "^10.9.2", | ||
"tsconfig-paths": "^4.2.0", | ||
"typescript": "^5.1.3" | ||
} | ||
} |
Oops, something went wrong.