Skip to content

Commit 9f7a9da

Browse files
author
jiank
committed
init
0 parents  commit 9f7a9da

File tree

93 files changed

+10197
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+10197
-0
lines changed

.config/dev.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
db_config:
2+
type: "mysql"
3+
host: "localhost"
4+
port: 3306
5+
username: "root"
6+
password: "Aa123456"
7+
database: "nest-db"
8+
# logging: true # ['error']
9+
logging: ['error']
10+
synchronize: true # 启动数据库时自动根据加载的模型(Entity)来同步数据表到数据库
11+
autoLoadEntities: true # 这样我们就不需要把每个模块的Entity逐个定死地添加到配置中的entities数组中了,因为你可以在每个模块中使用TypeOrmModule.forFeature来动态的加入Entity
12+
13+
elastic_config:
14+
node: 'http://localhost:9200'
15+
username: "elastic"
16+
password: "elastic"
17+
18+
app_config:
19+
searchType: "elastic" # 全文搜索: like, against, elastic
20+
jwtSecret: '123456'
21+
jwtExpiresIn: '1 day'

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
[*.md]
11+
trim_trailing_whitespace = false
12+
[Makefile]
13+
indent_style = tab

.eslintignore

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
dist
2+
back
3+
node_modules
4+
pnpm-lock.yaml
5+
docker
6+
Dockerfile*
7+
LICENSE
8+
yarn-error.log
9+
.history
10+
.vscode
11+
.docusaurus
12+
.dockerignore
13+
.DS_Store
14+
.eslintignore
15+
.editorconfig
16+
.gitignore
17+
.prettierignore
18+
.eslintcache
19+
*.lock
20+
**/*.svg
21+
**/*.md
22+
**/*.svg
23+
**/*.ejs
24+
**/*.html
25+
**/*.png
26+
**/*.toml
27+
**/*.md

.eslintrc.js

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: 'tsconfig.json',
5+
tsconfigRootDir: __dirname,
6+
ecmaVersion: 'latest',
7+
sourceType: 'module',
8+
},
9+
root: true,
10+
env: {
11+
node: true,
12+
jest: true,
13+
},
14+
plugins: ['@typescript-eslint', 'jest', 'prettier', 'import', 'unused-imports'],
15+
extends: [
16+
// airbnb规范
17+
// https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
18+
'airbnb-base',
19+
// 兼容typescript的airbnb规范
20+
// https://github.com/iamturns/eslint-config-airbnb-typescript
21+
'airbnb-typescript/base',
22+
23+
// typescript的eslint插件
24+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md
25+
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
26+
'plugin:@typescript-eslint/recommended',
27+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
28+
29+
// 支持jest
30+
'plugin:jest/recommended',
31+
// 使用prettier格式化代码
32+
// https://github.com/prettier/eslint-config-prettier#readme
33+
'prettier',
34+
// 整合typescript-eslint与prettier, eslint与pretttire冲突时,以prettire为准
35+
// https://github.com/prettier/eslint-plugin-prettier
36+
'plugin:prettier/recommended',
37+
],
38+
rules: {
39+
/* ********************************** ES6+ ********************************** */
40+
'no-console': 0,
41+
'no-var-requires': 0,
42+
'no-restricted-syntax': 0,
43+
'no-continue': 0,
44+
'no-await-in-loop': 0,
45+
'no-return-await': 0,
46+
'no-unused-vars': 0,
47+
'no-multi-assign': 0,
48+
'no-param-reassign': [2, { props: false }],
49+
'import/prefer-default-export': 0,
50+
'import/no-cycle': 0,
51+
'import/no-dynamic-require': 0,
52+
'max-classes-per-file': 0,
53+
'class-methods-use-this': 0,
54+
'guard-for-in': 0,
55+
'no-underscore-dangle': 0,
56+
'no-plusplus': 0,
57+
'no-lonely-if': 0,
58+
'no-bitwise': ['error', { allow: ['~'] }],
59+
60+
/* ********************************** Module Import ********************************** */
61+
62+
'import/no-absolute-path': 0,
63+
'import/extensions': 0,
64+
'import/no-named-default': 0,
65+
'no-restricted-exports': 0,
66+
67+
// 一部分文件在导入devDependencies的依赖时不报错
68+
'import/no-extraneous-dependencies': [
69+
1,
70+
{
71+
devDependencies: ['**/*.test.{ts,js}', '**/*.spec.{ts,js}', './test/**.{ts,js}'],
72+
},
73+
],
74+
// 模块导入顺序规则
75+
'import/order': [
76+
1,
77+
{
78+
pathGroups: [
79+
{
80+
pattern: '@/**',
81+
group: 'external',
82+
position: 'after',
83+
},
84+
],
85+
alphabetize: { order: 'asc', caseInsensitive: false },
86+
'newlines-between': 'always-and-inside-groups',
87+
warnOnUnassignedImports: true,
88+
},
89+
],
90+
// 自动删除未使用的导入
91+
// https://github.com/sweepline/eslint-plugin-unused-imports
92+
'unused-imports/no-unused-imports': 1,
93+
'unused-imports/no-unused-vars': [
94+
'error',
95+
{
96+
vars: 'all',
97+
args: 'none',
98+
ignoreRestSiblings: true,
99+
},
100+
],
101+
/* ********************************** Typescript ********************************** */
102+
'@typescript-eslint/no-unused-vars': 0,
103+
'@typescript-eslint/no-empty-interface': 0,
104+
'@typescript-eslint/no-this-alias': 0,
105+
'@typescript-eslint/no-var-requires': 0,
106+
'@typescript-eslint/no-use-before-define': 0,
107+
'@typescript-eslint/explicit-member-accessibility': 0,
108+
'@typescript-eslint/no-non-null-assertion': 0,
109+
'@typescript-eslint/no-unnecessary-type-assertion': 0,
110+
'@typescript-eslint/require-await': 0,
111+
'@typescript-eslint/no-for-in-array': 0,
112+
'@typescript-eslint/interface-name-prefix': 0,
113+
'@typescript-eslint/explicit-function-return-type': 0,
114+
'@typescript-eslint/no-explicit-any': 0,
115+
'@typescript-eslint/explicit-module-boundary-types': 0,
116+
'@typescript-eslint/no-floating-promises': 0,
117+
'@typescript-eslint/restrict-template-expressions': 0,
118+
'@typescript-eslint/no-unsafe-assignment': 0,
119+
'@typescript-eslint/no-unsafe-return': 0,
120+
'@typescript-eslint/no-unused-expressions': 0,
121+
'@typescript-eslint/no-misused-promises': 0,
122+
'@typescript-eslint/no-unsafe-member-access': 0,
123+
'@typescript-eslint/no-unsafe-call': 0,
124+
'@typescript-eslint/no-unsafe-argument': 0,
125+
'@typescript-eslint/ban-ts-comment': 0,
126+
},
127+
128+
settings: {
129+
extensions: ['.ts', '.d.ts', '.cts', '.mts', '.js', '.cjs', 'mjs', '.json'],
130+
},
131+
};

.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# compiled output
2+
/dist
3+
/node_modules
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
pnpm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
# OS
13+
.DS_Store
14+
# Tests
15+
/coverage
16+
/.nyc_output
17+
# IDEs and editors
18+
/.idea
19+
.project
20+
.classpath
21+
.c9/
22+
*.launch
23+
.settings/
24+
*.sublime-workspace
25+
# IDE - VSCode
26+
.vscode/*
27+
!.vscode/settings.json
28+
!.vscode/tasks.json
29+
!.vscode/launch.json
30+
!.vscode/extensions.json
31+
32+
# Docker Volumes
33+
.volumes

.prettierignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
dist
2+
node_modules
3+
pnpm-lock.yaml
4+
docker
5+
Dockerfile*
6+
LICENSE
7+
yarn-error.log
8+
.history
9+
.docusaurus
10+
.dockerignore
11+
.DS_Store
12+
.eslintignore
13+
.editorconfig
14+
.gitignore
15+
.prettierignore
16+
.eslintcache
17+
*.lock
18+
**/*.svg
19+
**/*.md
20+
**/*.svg
21+
**/*.ejs
22+
**/*.html
23+
**/*.png
24+
**/*.toml

.prettierrc

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 100,
5+
"proseWrap": "never",
6+
"endOfLine": "auto",
7+
"semi": true,
8+
"tabWidth": 4,
9+
"overrides": [
10+
{
11+
"files": ".prettierrc",
12+
"options": {
13+
"parser": "json"
14+
}
15+
}
16+
]
17+
}

.vscode/launch.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
// 使用 IntelliSense 了解相关属性。
3+
// 悬停以查看现有属性的描述。
4+
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "debug nest.js",
9+
"request": "launch",
10+
"runtimeArgs": ["run-script", "start:debug"],
11+
"autoAttachChildProcesses": true,
12+
"internalConsoleOptions": "neverOpen",
13+
"console": "integratedTerminal",
14+
"runtimeExecutable": "pnpm",
15+
"skipFiles": ["<node_internals>/**"],
16+
"type": "node"
17+
}
18+
]
19+
}

.vscode/settings.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
// 使用eslint+prettier自动格式化
3+
"editor.formatOnSave": false,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll.eslint": true
6+
},
7+
// 导入模块时默认使用相对于项目的路径
8+
"javascript.preferences.importModuleSpecifier": "project-relative",
9+
// jsdoc注释时不带return
10+
"typescript.suggest.jsdoc.generateReturns": false,
11+
// 只启用项目范围的错误报告
12+
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
13+
// 使用项目内部安装的ts的sdk
14+
"typescript.tsdk": "node_modules/typescript/lib",
15+
// 默认使用pnpm作为eslint服务器的包管理工具
16+
"eslint.packageManager": "pnpm",
17+
// 默认使用pnpm作为包安装的管理工具
18+
"npm.packageManager": "pnpm",
19+
"stylelint.packageManager": "pnpm",
20+
"editor.codeLensFontFamily": "JetBrains Mono",
21+
"editor.fontFamily": "JetBrains Mono",
22+
"editor.inlayHints.fontFamily": "JetBrains Mono",
23+
"scm.inputFontFamily": "JetBrains Mono",
24+
"debug.console.fontFamily": "JetBrains Mono",
25+
"notebook.outputFontFamily": "JetBrains Mono",
26+
"terminal.integrated.fontFamily": "JetBrains Mono",
27+
"errorLens.fontFamily": "JetBrains Mono",
28+
"breadcrumbs.filePath": "on",
29+
"breadcrumbs.symbolPath": "on"
30+
}

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Installation
2+
3+
```bash
4+
pnpm install
5+
```
6+
7+
## Running the app
8+
9+
```bash
10+
# development
11+
$ pnpm run start
12+
13+
# watch mode
14+
$ pnpm run start:dev
15+
16+
# production mode
17+
$ pnpm run start:prod
18+
```
19+
20+
## Test
21+
22+
```bash
23+
# unit tests
24+
$ pnpm run test
25+
26+
# e2e tests
27+
$ pnpm run test:e2e
28+
29+
# test coverage
30+
$ pnpm run test:cov
31+
```

0 commit comments

Comments
 (0)