Skip to content

Commit

Permalink
build: Initial workspace
Browse files Browse the repository at this point in the history
undefined
  • Loading branch information
jiayisheji committed Mar 7, 2024
1 parent 72fc15f commit 58c8962
Show file tree
Hide file tree
Showing 24 changed files with 6,927 additions and 1 deletion.
140 changes: 140 additions & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
const projects = [
{
name: 'admin',
readme: '/apps/admin',
},
{
name: 'webapp',
readme: '/apps/webapp',
},
{
name: 'api',
readme: '/apps/api',
},
];

// 默认自定义 scopes
const defaultScopes = [
{
name: 'wip',
readme: 'Work In Process',
},
{
name: 'workspace',
readme: '/',
},
{
name: 'tools',
readme: '/tools',
},
{
name: 'docs',
readme: '/docs',
},
{
name: 'deps',
readme: 'bump package-name from 7.0.1 to 8.0.1',
},
{
name: 'dev-deps',
readme: 'bump package-name from 7.0.1 to 8.0.1',
},
];

const scopes = [...projects, ...defaultScopes].filter(Boolean);

module.exports = {
// 自定义types
types: [
{
value: 'feat',
name: '新增功能',
},
{
value: 'fix',
name: 'bug修复',
},
{
value: 'docs',
name: '文档更新',
},
{
value: 'style',
name: '不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑)',
},
{
value: 'refactor',
name: '重构代码(既没有新增功能,也没有修复bug)',
},
{
value: 'perf',
name: '改进性能、体验优化的代码更改',
},
{
value: 'test',
name: '新增测试或更新现有测试用例',
},
{
value: 'build',
name: '主要目的是修改项目构建系统(例如 glup, webpack, rollup,npm的配置等.xxx) 的提交',
},
{
value: 'ci',
name: '主要目的是修改项目继续集成流程(例如 Travis, Jenkins, GitLab CI, Circle等) 的提交',
},
{
value: 'revert',
name: '回滚某个更早之前的提交',
},
{
value: 'release',
name: '版本发布',
},
{
value: 'chore',
name: '不属于以上类型的其他类型',
},
],
// 自定义scopes
scopes,

allowTicketNumber: false,
isTicketNumberRequired: false,
ticketNumberPrefix: 'TICKET-',
ticketNumberRegExp: '\\d{1,5}',

// it needs to match the value for field type. Eg.: 'fix'
/*
scopeOverrides: {
fix: [
{name: 'merge'},
{name: 'style'},
{name: 'e2eTest'},
{name: 'unitTest'}
]
},
*/
// override the messages, defaults are as follows
messages: {
type: '选择要提交的更改类型:',
scope: '表示此更改的范围(可选):',
// used if allowCustomScopes is true
customScope: '选择此项可以更改自定义范围:',
subject: '用简短的文字描述变更内容:',
body: '提供更长的变更描述(可选)。使用“|”中断新行:',
breaking: '列出任何中断更改(可选):',
footer: '列出此更改所关闭的任何问题(可选)。例如:#31 #34。对应“package.json”文件里“bugs.url”',
confirmCommit: '你确定要继续执行上面的提交吗?',
},

allowCustomScopes: true,
allowBreakingChanges: ['feat', 'fix'],
// 跳过任何你想问的问题
skipQuestions: ['body', 'footer'],

// limit subject length
subjectLimit: 100,
// breaklineChar: '|', // It is supported for fields body and footer.
// footerPrefix : 'ISSUES CLOSED:'
// askForBreakingChangeFirst : true, // default is false
};
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
13 changes: 13 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# mysql config
MYSQL_DATABASE=miracle
MYSQL_PORT=3306
MYSQL_HOST=localhost
MYSQL_TZ=Asia/Shanghai
MYSQL_USER=super
MYSQL_PASSWORD=super123

# redis config
REDIS_PASSWORD=super123
REDIS_PORT=6379
REDIS_HOST=localhost
REDIS_DATABASES=16
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
73 changes: 73 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"root": true,
"ignorePatterns": [
"**/*"
],
"plugins": [
"@nx"
],
"overrides": [
{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": [
"*"
]
}
]
}
]
}
},
{
"files": [
"*.ts",
"*.tsx"
],
"extends": [
"plugin:@nx/typescript"
],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"extends": [
"plugin:@nx/javascript"
],
"rules": {}
},
{
"files": [
"*.spec.ts",
"*.spec.tsx",
"*.spec.js",
"*.spec.jsx"
],
"env": {
"jest": true
},
"rules": {}
}
]
}
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
push:
branches:
- main
pull_request:

permissions:
actions: read
contents: read

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Connect your workspace on nx.app and uncomment this to enable task distribution.
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
# - run: pnpm exec nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build"

- uses: pnpm/action-setup@v2
with:
version: 8
# Cache node_modules
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- uses: nrwl/nx-set-shas@v4

- run: pnpm exec nx-cloud record -- nx format:check
- run: pnpm exec nx affected -t lint test build
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist
tmp
/out-tsc

# dependencies
node_modules

# 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

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db

.nx/cache

.docker

.env
!.env.example
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install -- commitlint --edit
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install lint-staged --relative
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
strict-peer-dependencies=false
auto-install-peers=true
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
pnpm-lock.yaml
49 changes: 49 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"printWidth": 120,
"bracketSpacing": true,
"trailingComma": "es5",
"semi": true,
"overrides": [
{
"files": "*.yml",
"options": {
"useTabs": false,
"tabWidth": 4
}
},
{
"files": [
"*.json"
],
"options": {
"parser": "json-stringify"
}
},
{
"files": [
"*.ts"
],
"options": {
"parser": "typescript"
}
},
{
"files": [
"*.html"
],
"options": {
"printWidth": 140,
"singleQuote": false
}
},
{
"files": "*.scss",
"options": {
"singleQuote": false
}
}
]
}
Loading

0 comments on commit 58c8962

Please sign in to comment.