mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-01-23 02:40:23 +08:00
Merge branch 'v2.0' of github.com:aklivecai/hotgo into v2.0
This commit is contained in:
commit
07df5a20e1
@ -15,10 +15,10 @@
|
||||
5. 命令行运行 `pnpm -v` 若控制台输出版本号则前端环境搭建成功
|
||||
|
||||
### 后端环境
|
||||
1. 下载golang安装 版本号需>=1.21
|
||||
1. 下载golang安装 版本号需>=1.23
|
||||
2. 国际: https://golang.org/dl/
|
||||
3. 国内: https://golang.google.cn/dl/
|
||||
4. 命令行运行 go 若控制台输出各类提示命令 则安装成功 输入 `go version` 确认版本大于1.19
|
||||
4. 命令行运行 go 若控制台输出各类提示命令 则安装成功 输入 `go version` 确认版本大于1.23
|
||||
5. 开发工具推荐 [Goland](https://www.jetbrains.com/go/)
|
||||
|
||||
### 使用说明
|
||||
@ -26,6 +26,6 @@
|
||||
> 需要本地具有 git node golang 环境
|
||||
|
||||
- node版本 >= 16.0.0
|
||||
- golang版本 >= 1.21
|
||||
- golang版本 >= 1.23
|
||||
- mysql版本 >= 5.7,引擎需要是 innoDB
|
||||
- IDE推荐:Goland
|
||||
|
@ -8,7 +8,7 @@
|
||||
### 环境要求
|
||||
|
||||
- node版本 >= v16.0.0
|
||||
- golang版本 >= v1.21
|
||||
- golang版本 >= v1.23
|
||||
- goframe版本 >=v2.7.0
|
||||
- mysql版本 >=5.7
|
||||
|
||||
|
@ -179,7 +179,11 @@ func GenTypeSelect(ctx context.Context) (res sysin.GenTypeSelects, err error) {
|
||||
Templates: make(sysin.GenTemplateSelects, 0),
|
||||
}
|
||||
|
||||
confName, ok := consts.GenCodesTypeConfMap[k]
|
||||
km := k
|
||||
if km == consts.GenCodesTypeTree {
|
||||
km = consts.GenCodesTypeCurd
|
||||
}
|
||||
confName, ok := consts.GenCodesTypeConfMap[km]
|
||||
if ok {
|
||||
var temps []*model.GenerateAppCrudTemplate
|
||||
err = g.Cfg().MustGet(ctx, "hggen.application."+confName+".templates").Scan(&temps)
|
||||
|
@ -286,7 +286,7 @@ func (l *gCurd) generateLogicListWhereEach(buffer *bytes.Buffer, in *CurdPreview
|
||||
case WhereModeNotLike:
|
||||
whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "NotLike(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}"
|
||||
case WhereModeJsonContains:
|
||||
val := tablePrefix + "fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")"
|
||||
val := tablePrefix + `"JSON_CONTAINS("+dao.` + daoName + `.Columns().` + columnName + `+",?)", in.` + field.GoName
|
||||
whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "(" + val + ")\n\t}"
|
||||
|
||||
default:
|
||||
|
@ -177,8 +177,14 @@ func (s *sSysGenCodes) List(ctx context.Context, in *sysin.GenCodesListInp) (lis
|
||||
if row == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
genType := int(row.GenType)
|
||||
if genType == consts.GenCodesTypeTree {
|
||||
genType = consts.GenCodesTypeCurd
|
||||
}
|
||||
|
||||
for _, v := range typeSelect {
|
||||
if v.Value == int(row.GenType) {
|
||||
if v.Value == genType {
|
||||
for index, template := range v.Templates {
|
||||
if index == row.GenTemplate {
|
||||
return template.Label
|
||||
@ -186,7 +192,6 @@ func (s *sSysGenCodes) List(ctx context.Context, in *sysin.GenCodesListInp) (lis
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
*.sh
|
||||
node_modules
|
||||
*.md
|
||||
*.woff
|
||||
*.ttf
|
||||
.vscode
|
||||
.idea
|
||||
dist
|
||||
/public
|
||||
/docs
|
||||
.husky
|
||||
.local
|
||||
/bin
|
||||
Dockerfile
|
||||
components.d.ts
|
||||
components.d.ts
|
@ -1,77 +0,0 @@
|
||||
// @ts-check
|
||||
const { defineConfig } = require('eslint-define-config');
|
||||
module.exports = defineConfig({
|
||||
root: true,
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
es6: true,
|
||||
},
|
||||
parser: 'vue-eslint-parser',
|
||||
parserOptions: {
|
||||
parser: '@typescript-eslint/parser',
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'module',
|
||||
jsxPragma: 'React',
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
extends: [
|
||||
'plugin:vue/vue3-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'prettier',
|
||||
'plugin:prettier/recommended',
|
||||
],
|
||||
rules: {
|
||||
'vue/script-setup-uses-vars': 'error',
|
||||
'@typescript-eslint/ban-ts-ignore': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'vue/custom-event-name-casing': 'off',
|
||||
'no-use-before-define': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'@typescript-eslint/ban-types': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '.*', args: 'none' }],
|
||||
'no-unused-vars': [
|
||||
'error',
|
||||
// we are only using this rule to check for unused arguments since TS
|
||||
// catches unused variables but not args.
|
||||
{ varsIgnorePattern: '.*', args: 'none' },
|
||||
],
|
||||
'space-before-function-paren': 'off',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'vue/attributes-order': 'off',
|
||||
'vue/one-component-per-file': 'off',
|
||||
'vue/html-closing-bracket-newline': 'off',
|
||||
'vue/max-attributes-per-line': 'off',
|
||||
'vue/multiline-html-element-content-newline': 'off',
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
'vue/attribute-hyphenation': 'off',
|
||||
'vue/require-default-prop': 'off',
|
||||
'vue/html-self-closing': [
|
||||
'error',
|
||||
{
|
||||
html: {
|
||||
void: 'always',
|
||||
normal: 'never',
|
||||
component: 'always',
|
||||
},
|
||||
svg: 'always',
|
||||
math: 'always',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-this-alias': [
|
||||
'error',
|
||||
{
|
||||
allowDestructuring: false, // Disallow `const { props, state } = this`; true by default
|
||||
allowedNames: ['that'], // Allow `const self = this`; `[]` by default
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
@ -10,7 +10,7 @@ import { getConfigFileName } from '../getConfigFileName';
|
||||
|
||||
import pkg from '../../package.json';
|
||||
|
||||
function createConfig(
|
||||
async function createConfig(
|
||||
{
|
||||
configName,
|
||||
config,
|
||||
@ -27,7 +27,7 @@ function createConfig(
|
||||
writable: false,
|
||||
});
|
||||
`.replace(/\s/g, '');
|
||||
fs.mkdirp(getRootPath(OUTPUT_DIR));
|
||||
await fs.mkdirp(getRootPath(OUTPUT_DIR));
|
||||
fs.writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr);
|
||||
|
||||
console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`);
|
||||
@ -37,8 +37,8 @@ function createConfig(
|
||||
}
|
||||
}
|
||||
|
||||
export function runBuildConfig() {
|
||||
export async function runBuildConfig() {
|
||||
const config = getEnvConfig();
|
||||
const configFileName = getConfigFileName(config);
|
||||
createConfig({ config, configName: configFileName });
|
||||
await createConfig({ config, configName: configFileName });
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import { runBuildConfig } from './buildConf';
|
||||
import chalk from 'chalk';
|
||||
|
||||
import process from 'node:process'
|
||||
import pkg from '../../package.json';
|
||||
|
||||
export const runBuild = async () => {
|
||||
@ -20,4 +20,4 @@ export const runBuild = async () => {
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
runBuild();
|
||||
runBuild().then();
|
||||
|
104
web/eslint.config.js
Normal file
104
web/eslint.config.js
Normal file
@ -0,0 +1,104 @@
|
||||
import parser from 'vue-eslint-parser';
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
|
||||
const compat = new FlatCompat();
|
||||
|
||||
export default [
|
||||
{
|
||||
ignores: [
|
||||
'**/*.sh',
|
||||
'**/node_modules',
|
||||
'**/*.md',
|
||||
'**/*.woff',
|
||||
'**/*.ttf',
|
||||
'**/.vscode',
|
||||
'**/.idea',
|
||||
'**/dist',
|
||||
'public',
|
||||
'docs',
|
||||
'**/.husky',
|
||||
'**/.local',
|
||||
'bin',
|
||||
'**/Dockerfile',
|
||||
'**/components.d.ts',
|
||||
],
|
||||
},
|
||||
...compat.extends(
|
||||
'plugin:vue/vue3-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'prettier',
|
||||
'plugin:prettier/recommended'
|
||||
),
|
||||
{
|
||||
languageOptions: {
|
||||
parser: parser,
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'module',
|
||||
parserOptions: {
|
||||
parser: '@typescript-eslint/parser',
|
||||
jsxPragma: 'React',
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'vue/script-setup-uses-vars': 'error',
|
||||
'@typescript-eslint/ban-ts-ignore': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'vue/custom-event-name-casing': 'off',
|
||||
'no-use-before-define': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'@typescript-eslint/ban-types': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
varsIgnorePattern: '.*',
|
||||
args: 'none',
|
||||
},
|
||||
],
|
||||
'no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
varsIgnorePattern: '.*',
|
||||
args: 'none',
|
||||
},
|
||||
],
|
||||
'space-before-function-paren': 'off',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'vue/attributes-order': 'off',
|
||||
'vue/one-component-per-file': 'off',
|
||||
'vue/html-closing-bracket-newline': 'off',
|
||||
'vue/max-attributes-per-line': 'off',
|
||||
'vue/multiline-html-element-content-newline': 'off',
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
'vue/attribute-hyphenation': 'off',
|
||||
'vue/require-default-prop': 'off',
|
||||
'vue/html-self-closing': [
|
||||
'error',
|
||||
{
|
||||
html: {
|
||||
void: 'always',
|
||||
normal: 'never',
|
||||
component: 'always',
|
||||
},
|
||||
svg: 'always',
|
||||
math: 'always',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-this-alias': [
|
||||
'error',
|
||||
{
|
||||
allowDestructuring: false,
|
||||
allowedNames: ['that'],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
@ -66,7 +66,9 @@
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.4.1",
|
||||
"@commitlint/config-conventional": "^19.4.1",
|
||||
"@types/lodash": "^4.17.7",
|
||||
"@eslint/eslintrc": "^3.1.0",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^22.5.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
||||
"@typescript-eslint/parser": "^8.4.0",
|
||||
@ -75,6 +77,7 @@
|
||||
"@vue/compiler-sfc": "^3.4.38",
|
||||
"@vue/eslint-config-typescript": "^13.0.0",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"chalk": "^5.3.0",
|
||||
"commitizen": "^4.3.0",
|
||||
"core-js": "^3.38.1",
|
||||
"cross-env": "^7.0.3",
|
||||
@ -87,6 +90,7 @@
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-vue": "^9.28.0",
|
||||
"esno": "^4.7.0",
|
||||
"fs-extra": "^11.2.0",
|
||||
"gh-pages": "^6.1.1",
|
||||
"husky": "^9.1.5",
|
||||
"jest": "^29.7.0",
|
||||
|
33
web/pnpm-lock.yaml
generated
33
web/pnpm-lock.yaml
generated
@ -114,9 +114,15 @@ importers:
|
||||
'@commitlint/config-conventional':
|
||||
specifier: ^19.4.1
|
||||
version: 19.4.1
|
||||
'@types/lodash':
|
||||
specifier: ^4.17.7
|
||||
version: 4.17.7
|
||||
'@eslint/eslintrc':
|
||||
specifier: ^3.1.0
|
||||
version: 3.1.0
|
||||
'@types/fs-extra':
|
||||
specifier: ^11.0.4
|
||||
version: 11.0.4
|
||||
'@types/lodash-es':
|
||||
specifier: ^4.17.12
|
||||
version: 4.17.12
|
||||
'@types/node':
|
||||
specifier: ^22.5.2
|
||||
version: 22.5.2
|
||||
@ -141,6 +147,9 @@ importers:
|
||||
autoprefixer:
|
||||
specifier: ^10.4.20
|
||||
version: 10.4.20(postcss@8.4.44)
|
||||
chalk:
|
||||
specifier: ^5.3.0
|
||||
version: 5.3.0
|
||||
commitizen:
|
||||
specifier: ^4.3.0
|
||||
version: 4.3.0(@types/node@22.5.2)(typescript@5.5.4)
|
||||
@ -177,6 +186,9 @@ importers:
|
||||
esno:
|
||||
specifier: ^4.7.0
|
||||
version: 4.7.0
|
||||
fs-extra:
|
||||
specifier: ^11.2.0
|
||||
version: 11.2.0
|
||||
gh-pages:
|
||||
specifier: ^6.1.1
|
||||
version: 6.1.1
|
||||
@ -1264,6 +1276,9 @@ packages:
|
||||
'@types/estree@1.0.5':
|
||||
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
|
||||
|
||||
'@types/fs-extra@11.0.4':
|
||||
resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==}
|
||||
|
||||
'@types/graceful-fs@4.1.9':
|
||||
resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==}
|
||||
|
||||
@ -1279,6 +1294,9 @@ packages:
|
||||
'@types/json-schema@7.0.15':
|
||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||
|
||||
'@types/jsonfile@6.1.4':
|
||||
resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==}
|
||||
|
||||
'@types/katex@0.16.7':
|
||||
resolution: {integrity: sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ==}
|
||||
|
||||
@ -5643,6 +5661,11 @@ snapshots:
|
||||
|
||||
'@types/estree@1.0.5': {}
|
||||
|
||||
'@types/fs-extra@11.0.4':
|
||||
dependencies:
|
||||
'@types/jsonfile': 6.1.4
|
||||
'@types/node': 22.5.2
|
||||
|
||||
'@types/graceful-fs@4.1.9':
|
||||
dependencies:
|
||||
'@types/node': 22.5.2
|
||||
@ -5660,6 +5683,10 @@ snapshots:
|
||||
'@types/json-schema@7.0.15':
|
||||
optional: true
|
||||
|
||||
'@types/jsonfile@6.1.4':
|
||||
dependencies:
|
||||
'@types/node': 22.5.2
|
||||
|
||||
'@types/katex@0.16.7': {}
|
||||
|
||||
'@types/lodash-es@4.17.12':
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { debounce } from 'lodash';
|
||||
import { debounce } from 'lodash-es';
|
||||
|
||||
/**
|
||||
* description: 获取页面宽度
|
||||
|
Loading…
Reference in New Issue
Block a user