Skip to content

Commit

Permalink
Merge pull request #2 from mmdapl/feat/mono-code
Browse files Browse the repository at this point in the history
  • Loading branch information
微信公众号:储凡 authored Jul 14, 2024
2 parents e49ccea + 125e598 commit 7e9f87f
Show file tree
Hide file tree
Showing 88 changed files with 3,795 additions and 2,165 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ node_modules
*/typings
.idea
.github
nginx
docs
eslint.config.js
.gitignore

13 changes: 6 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ name: CI
# 触发条件
on:
# 提PR到next分支触发CI
# pull_request:
# branches:
# - next
# push:
# branches:
# - next
# pull_request:
# branches:
# - next
# push:
# branches:
# - next

# 手动触发部署
workflow_dispatch:
Expand Down Expand Up @@ -65,4 +65,3 @@ jobs:
- name: Build Midway Example Code
run: |
./scripts/build xxx
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019-2024 142vip 储凡
Copyright (c) 2019-present 142vip 储凡

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# @142vip/core-x

坚持开源,x代表一切都有可能

## 证书

[MIT](https://opensource.org/license/MIT)

Copyright (c) 2019-present, 142vip 储凡
35 changes: 0 additions & 35 deletions docs/技术栈.md

This file was deleted.

40 changes: 5 additions & 35 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const antFu = require('@antfu/eslint-config').default
import antFu from '@antfu/eslint-config'

// 参考:https://github.com/antfu/eslint-config

module.exports = antFu({
export default antFu({
ignores: [
'**/node_modules/**',
'dist',
Expand All @@ -12,23 +13,8 @@ module.exports = antFu({
'**/typings/**/',
'.output',
'**/.output/**',
'packages/framework/*',
'packages/framework/**',
'apps/tools-api-back/**',
],
typescript: {
tsconfigPath: 'tsconfig.json',
overrides: {
'ts/no-unused-vars': ['error', { ignoreRestSiblings: true, argsIgnorePattern: '^_' }], // 忽略 rest 属性的兄弟属性,便于解构;忽略函数中下划线开头的参数。
'ts/consistent-type-imports': ['off'], // Nest.js的依赖注入会被识别为type-imports,自动fix会在import添加type,导致注入失败,此项必须关闭。
'ts/no-inferrable-types': ['error', { ignoreProperties: true }], // 允许类属性在设置默认值的同时设置类型,以兼容swagger对DTO中默认值的识别。
'ts/explicit-function-return-type': ['warn'], // 显式声明方法返回类型
'ts/explicit-member-accessibility': ['warn', { overrides: { constructors: 'off', properties: 'off' } }], // 显式声明可访问性修饰符
'ts/explicit-module-boundary-types': ['warn'], // 导出函数和类的公共类方法上显式返回和参数类型。
'ts/no-require-imports': ['warn'], // 禁止require
'ts/no-var-requires': ['warn'], // 禁止require
},
},
typescript: true,
vue: true,
// Disable jsonc and yaml support
jsonc: false,
Expand All @@ -39,29 +25,13 @@ module.exports = antFu({
markdown: 'prettier',
},
rules: {
'no-void': ['off'], // 允许void类型,间接允许返回void类型时,不写return。由于存在对express next()等库方法的调用,为保证类型兼容,此项须关闭。
'dot-notation': ['off'], // 依赖库中的值可能使用`[key: string]: any`式的类型定义,我们调用时不可避免的需要使用`obj['key']`来访问某些成员,比如ConfigModule。
'ts/no-unused-vars': ['error', { ignoreRestSiblings: true, argsIgnorePattern: '^_' }], // 忽略 rest 属性的兄弟属性,便于解构;忽略函数中下划线开头的参数。
'ts/consistent-type-imports': ['off'], // Nest.js的依赖注入会被识别为type-imports,自动fix会在import添加type,导致注入失败,此项必须关闭。
'ts/no-inferrable-types': ['error', { ignoreProperties: true }], // 允许类属性在设置默认值的同时设置类型,以兼容swagger对DTO中默认值的识别。
'ts/explicit-function-return-type': ['warn'], // 显式声明方法返回类型
'ts/explicit-member-accessibility': ['warn', { overrides: { constructors: 'off', properties: 'off' } }], // 显式声明可访问性修饰符
'ts/explicit-module-boundary-types': ['warn'], // 导出函数和类的公共类方法上显式返回和参数类型。
'ts/no-require-imports': ['warn'], // 禁止require
'ts/no-var-requires': ['warn'], // 禁止require
'node/prefer-global/buffer': ['error', 'always'], // 一致地使用全局 Buffer
'node/prefer-global/process': ['error', 'always'], // 一致地使用全局 process
'no-console': 'off',
'no-console': 'warn',
'no-restricted-syntax': [
'error',
{
selector: 'CallExpression[callee.object.name=\'console\'][callee.property.name!=/^(log|warn|error|info|trace)$/]',
message: 'Unexpected property on console object was called',
},
],
'semi': [2, 'never'], // 去掉结尾的分号
'singleQuote': 0,
'array-bracket-spacing': [2, 'never'], // 强制数组方括号中使用一致的空格
'no-control-regex': 0, // 禁止在正则表达式中使用控制字符
},
})
4 changes: 4 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "release",
"section": "Release Module"
},
{
"type": "chore",
"hidden": true
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "142vip-oauth",
"version": "0.1.6-alpha.5",
"private": true,
"name": "@142vip/core-x",
"version": "0.0.1-alpha.1",
"type": "module",
"engines": {
"node": "18.18.0",
"pnpm": "7"
Expand All @@ -27,6 +27,7 @@
"turbo": "^2.0.1"
},
"devDependencies": {
"@142vip/changelog": "workspace:*",
"@antfu/eslint-config": "^2.20.0",
"@lerna-lite/cli": "^3.5.1",
"@lerna-lite/list": "^3.5.1",
Expand Down
1 change: 0 additions & 1 deletion packages/egg-axios/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# @142vip/egg-axios

9 changes: 9 additions & 0 deletions packages/egg-axios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
"private": false,
"description": "公众号搜:储凡",
"keywords": ["公众号搜:储凡"],
"scripts": {
"build": "npx tsc"
},
"dependencies": {

},
"devDependencies": {

},
"author": "mmdapl <[email protected]>",
"license": "MIT"
}
Empty file added packages/egg-axios/src/index.ts
Empty file.
10 changes: 10 additions & 0 deletions packages/egg-axios/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.package.json",
"exclude": [
"node_modules",
"dist"
],
"include": [
"src/**/*"
]
}
1 change: 0 additions & 1 deletion packages/egg-grpc-client/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# @142vip/egg-grpc-client

9 changes: 9 additions & 0 deletions packages/egg-grpc-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
"private": false,
"description": "公众号搜:储凡",
"keywords": ["公众号搜:储凡"],
"scripts": {
"build": "npx tsc"
},
"dependencies": {

},
"devDependencies": {

},
"author": "mmdapl <[email protected]>",
"license": "MIT"
}
Empty file.
10 changes: 10 additions & 0 deletions packages/egg-grpc-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.package.json",
"exclude": [
"node_modules",
"dist"
],
"include": [
"src/**/*"
]
}
1 change: 0 additions & 1 deletion packages/egg-grpc-server/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# @142vip/egg-grpc-server

3 changes: 3 additions & 0 deletions packages/egg-grpc-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"private": false,
"description": "公众号搜:储凡",
"keywords": ["公众号搜:储凡"],
"scripts": {
"build": "npx tsc"
},
"author": "mmdapl <[email protected]>",
"license": "MIT"
}
Empty file.
10 changes: 10 additions & 0 deletions packages/egg-grpc-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.package.json",
"exclude": [
"node_modules",
"dist"
],
"include": [
"src/**/*"
]
}
1 change: 1 addition & 0 deletions packages/egg-mysql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @142vip/egg-mysql
11 changes: 11 additions & 0 deletions packages/egg-mysql/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@142vip/egg-mysql",
"private": false,
"description": "公众号搜:储凡",
"keywords": ["公众号搜:储凡"],
"scripts": {
"build": "npx tsc"
},
"author": "mmdapl <[email protected]>",
"license": "MIT"
}
Empty file added packages/egg-mysql/src/index.ts
Empty file.
3 changes: 3 additions & 0 deletions packages/egg-mysql/src/mysql.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export class Mysql {

}
10 changes: 10 additions & 0 deletions packages/egg-mysql/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.package.json",
"exclude": [
"node_modules",
"dist"
],
"include": [
"src/**/*"
]
}
1 change: 0 additions & 1 deletion packages/egg-redis/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# @142vip/egg

5 changes: 4 additions & 1 deletion packages/egg-redis/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"name": "@142vip/egg",
"name": "@142vip/egg-redis",
"private": false,
"description": "公众号搜:储凡",
"keywords": ["公众号搜:储凡"],
"scripts": {
"build": "npx tsc"
},
"author": "mmdapl <[email protected]>",
"license": "MIT"
}
Empty file added packages/egg-redis/src/index.ts
Empty file.
10 changes: 10 additions & 0 deletions packages/egg-redis/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.package.json",
"exclude": [
"node_modules",
"dist"
],
"include": [
"src/**/*"
]
}
1 change: 0 additions & 1 deletion packages/egg-sequelize/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# @142vip/egg-sequelize

1 change: 1 addition & 0 deletions packages/egg-sequelize/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './src'
10 changes: 9 additions & 1 deletion packages/egg-sequelize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
"name": "@142vip/egg-sequelize",
"private": false,
"description": "公众号搜:储凡",
"keywords": ["公众号搜:储凡"],
"keywords": [
"公众号搜:储凡"
],
"scripts": {
"build": "npx tsc"
},
"dependencies": {
"egg-sequelize": "^6.0.0"
},
"author": "mmdapl <[email protected]>",
"license": "MIT"
}
29 changes: 29 additions & 0 deletions packages/egg-sequelize/src/core/base.entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { DataTypes } from 'sequelize'

/**
* 基础实体
*/
export const BaseEntity = {
/**
* 主键
*/
id: {
type: DataTypes.BIGINT,
primaryKey: true,
autoIncrement: true,
},
/**
* 是否删除
*/
deleted: {
type: DataTypes.BIGINT,
defaultValue: false,
},
}

/**
* 创建实体
*/
export function createEntity(entity: object) {
return Object.assign({}, BaseEntity, entity)
}
Loading

0 comments on commit 7e9f87f

Please sign in to comment.