create-bc-app 1.3.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +3 -0
  2. package/dist/index.mjs +37 -36
  3. package/package.json +19 -5
  4. package/template-data-server/.eslintrc.cjs +201 -0
  5. package/template-data-server/.gitlab-ci.yml +75 -0
  6. package/template-data-server/README.md +16 -0
  7. package/template-data-server/_gitignore +24 -0
  8. package/template-data-server/example/App.vue +29 -0
  9. package/template-data-server/example/assets/bochui.svg +7 -0
  10. package/template-data-server/example/assets/group.svg +3 -0
  11. package/template-data-server/example/components/Example.vue +28 -0
  12. package/template-data-server/example/main.ts +12 -0
  13. package/template-data-server/example/style.css +19 -0
  14. package/template-data-server/example/vite-env.d.ts +1 -0
  15. package/template-data-server/image.png +0 -0
  16. package/template-data-server/index.html +13 -0
  17. package/template-data-server/package.json +40 -0
  18. package/template-data-server/public/group.svg +3 -0
  19. package/template-data-server/src/data/api/index.ts +5 -0
  20. package/template-data-server/src/data/index.ts +4 -0
  21. package/template-data-server/src/data/message/index.ts +34 -0
  22. package/template-data-server/src/data/test/dao/testDao.ts +6 -0
  23. package/template-data-server/src/data/test/index.ts +2 -0
  24. package/template-data-server/src/data/test/model/testModel.ts +5 -0
  25. package/template-data-server/src/index.ts +1 -0
  26. package/template-data-server/src/plop/plopfile.js +66 -0
  27. package/template-data-server/src/utils/index.ts +1 -0
  28. package/template-data-server/src/utils/updater.ts +16 -0
  29. package/template-data-server/test/App.test.ts +16 -0
  30. package/template-data-server/test/Example.test.ts +15 -0
  31. package/template-data-server/tsconfig.json +33 -0
  32. package/template-data-server/tsconfig.node.json +11 -0
  33. package/template-data-server/vite.config.ts +29 -0
  34. package/template-monorepo/.gitlab-ci.yml +41 -7
  35. package/template-vue-js/.gitlab-ci.yml +46 -12
  36. package/template-vue-ts/.gitlab-ci.yml +46 -12
@@ -0,0 +1,66 @@
1
+ /* eslint-disable no-undef */
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+ // plopfile.js
4
+ // const path = require("path')
5
+ const sourceDatas = require('./data.js')
6
+
7
+ function equalIgnoreCase(str1, str2) {
8
+ return str1.toLowerCase() === str2.toLowerCase()
9
+ }
10
+
11
+ function toDelphiType(str) {
12
+ if (equalIgnoreCase(str, 'number')) {
13
+ return 'Integer'
14
+ }
15
+ if (equalIgnoreCase(str, 'double')) {
16
+ return 'Double'
17
+ }
18
+ return str
19
+ }
20
+
21
+ function toJsonFunc(str) {
22
+ let type = toDelphiType(str)
23
+ if (equalIgnoreCase(type, 'Integer')) {
24
+ return 'I'
25
+ }
26
+ if (equalIgnoreCase(type, 'string')) {
27
+ return 'S'
28
+ }
29
+ if (equalIgnoreCase(type, 'Boolean')) {
30
+ return 'B'
31
+ }
32
+ return 'O'
33
+ }
34
+
35
+ module.exports = function (plop) {
36
+ plop.setHelper('uf', (str) => str.charAt(0).toUpperCase() + str.slice(1))
37
+ plop.setHelper('lf', (str) => str.charAt(0).toLowerCase() + str.slice(1))
38
+ plop.setHelper('l', (str) => str.toLowerCase())
39
+ plop.setHelper('toDelphiType', (str) => toDelphiType(str))
40
+ plop.setHelper('toJsonFunc', (str) => toJsonFunc(str))
41
+ // 添加一个生成器
42
+ plop.setGenerator('models', {
43
+ description: 'Generate a new model',
44
+ prompts: [],
45
+ actions: () => {
46
+ const actions = []
47
+ sourceDatas.forEach((sourceData) => {
48
+ actions.push({
49
+ type: 'add',
50
+ force: true,
51
+ data: sourceData,
52
+ path: 'src/model/ts/' + sourceData.class + '.ts',
53
+ templateFile: 'template/Model-ts.hbs'
54
+ })
55
+ actions.push({
56
+ type: 'add',
57
+ force: true,
58
+ data: sourceData,
59
+ path: 'src/model/delphi/' + sourceData.class + '.pas',
60
+ templateFile: 'template/Model-delphi.hbs'
61
+ })
62
+ })
63
+ return actions
64
+ }
65
+ })
66
+ }
@@ -0,0 +1 @@
1
+ export * from './updater'
@@ -0,0 +1,16 @@
1
+
2
+ export class Updater<T = any> {
3
+ data: T
4
+
5
+ constructor(data: T) {
6
+ this.data = data
7
+ }
8
+
9
+ onChange(data: T): void {
10
+ this.data = data
11
+ }
12
+
13
+ change(): void {
14
+ this.onChange(this.data)
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import { describe, it, expect } from 'vitest'
3
+ import Example from '../src/components/Example.vue'
4
+ import App from '../src/App.vue'
5
+
6
+ describe('App.vue', () => {
7
+ it('text app.vue', () => {
8
+ const wrapper = mount(App)
9
+ // 渲染app.vue组件
10
+ const example = wrapper.findComponent(Example)
11
+ // 检查 example 组件是否存在
12
+ expect(example.exists()).toBe(true)
13
+ // 检查props 对不对
14
+ expect(example.props('msg')).toBe('Vite + Vue + TS example project')
15
+ })
16
+ })
@@ -0,0 +1,15 @@
1
+ import { mount } from '@vue/test-utils'
2
+ import { describe, it, expect } from 'vitest'
3
+ import Example from '../src/components/Example.vue'
4
+
5
+ describe('Example.vue', () => {
6
+ it('render this correct text', () => {
7
+ const wrapper = mount(Example, {
8
+ props: {
9
+ msg: 'Vite + Vue + TS example project'
10
+ }
11
+ })
12
+ expect(wrapper.find('h1').text()).toBe('Vite + Vue + TS example project')
13
+ })
14
+ })
15
+
@@ -0,0 +1,33 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "./",
4
+ "paths": {
5
+ "@/*":["src/*"]
6
+ },
7
+ "target": "ES2020",
8
+ "useDefineForClassFields": true,
9
+ "module": "ESNext",
10
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
11
+ "skipLibCheck": true,
12
+
13
+ /* Bundler mode */
14
+ "moduleResolution": "Node",
15
+ "allowImportingTsExtensions": true,
16
+ "resolveJsonModule": true,
17
+ "isolatedModules": true,
18
+ "noEmit": true,
19
+ "jsx": "preserve",
20
+ "checkJs": false,
21
+
22
+ /* Linting */
23
+ "strict": true,
24
+ "noUnusedLocals": true,
25
+ "noUnusedParameters": true,
26
+ "noFallthroughCasesInSwitch": true,
27
+ "experimentalDecorators": true,
28
+ },
29
+
30
+ "include": ["example/**/*.ts", "example/**/*.d.ts", "example/**/*.tsx", "example/**/*.vue", "example/main.ts"],
31
+ "references": [{ "path": "./tsconfig.node.json" }] ,
32
+ "exclude": ["node_modules"]
33
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true,
8
+ "strict": true
9
+ },
10
+ "include": ["vite.config.ts"]
11
+ }
@@ -0,0 +1,29 @@
1
+ /// <reference types="vitest" />
2
+ import { defineConfig } from 'vite'
3
+ import vue from '@vitejs/plugin-vue'
4
+ import path from 'path';
5
+ import { resolve } from 'path'
6
+
7
+ const __dirname = resolve()
8
+ // https://vitejs.dev/config/
9
+ export default ({ mode }: { mode: string }) => {
10
+ const pkg = mode === 'test' ? '@fsdev' : '@fscut'
11
+ return defineConfig({
12
+ plugins: [vue()],
13
+ test: {
14
+ global: true,
15
+ environment: 'happy-dom',
16
+ deps: {
17
+ inline: ['@vue']
18
+ }
19
+ },
20
+ resolve: {
21
+ alias: {
22
+ '@': resolve(__dirname, 'src'),
23
+ '@fs/bochui': path.resolve(__dirname, `node_modules/${pkg}/bochui`),
24
+ '@fs/utils': path.resolve(__dirname, `node_modules/${pkg}/fs-utils`)
25
+ }
26
+ }
27
+ })
28
+ }
29
+
@@ -1,31 +1,65 @@
1
+ # ============= 阶段定义 =============
1
2
  stages:
2
3
  - install
4
+ - ai
3
5
  - eslint
4
6
  - notify
5
7
 
6
- cache:
7
- key: "$CI_COMMIT_REF_SLUG"
8
-
8
+ # ============= 安装依赖 =============
9
9
  install:
10
10
  stage: install
11
11
  cache:
12
+ key: "$CI_COMMIT_REF_SLUG"
12
13
  paths:
13
14
  - node_modules/
14
15
  script:
15
- - pnpm install
16
+ - pnpm -v
17
+ - pnpm config set @fscut:registry http://nexus.xxxxx.com/repository/fscut-npm/
18
+ - pnpm config set @fsdev:registry http://nexus.xxxxx.com/repository/npm-dev/
19
+ - pnpm install --frozen-lockfile
16
20
  tags:
17
- - sonar
21
+ - runner161
22
+
23
+ # ============= AI 代码审查 =============
24
+ ai-job:
25
+ stage: ai
26
+ tags:
27
+ - win191
28
+ only:
29
+ - merge_requests
30
+ variables:
31
+ GIT_CLEAN_FLAGS: none
32
+ allow_failure: true
33
+ script:
34
+ - $GIT_DIR = $(pwd)
35
+ - $GIT_DIR = $GIT_DIR -replace "\\", "/"
36
+ - git fetch origin
37
+ - if ((Test-Path -Path llm_utils)) { Remove-Item -Path llm_utils -Recurse -Force }
38
+ - if (!(Test-Path -Path llm_utils)) { git clone https://git.xxxxx.com/wangzhiqiang/llm_utils.git }
39
+ - cd llm_utils
40
+ - $MR_ID = $env:CI_MERGE_REQUEST_IID
41
+ - $PROJECT_ID = $env:CI_PROJECT_ID
42
+ - $PRIVATE_TOKEN = $env:PRIVATE_TOKEN
43
+ - Write-Host $MR_ID
44
+ - Write-Host $PROJECT_ID
45
+ - Write-Host `"$GIT_DIR`"
46
+ - Write-Host `"$PRIVATE_TOKEN`"
47
+ - python -c "import core; core.run_and_post('$PROJECT_ID', '$MR_ID', '$GIT_DIR', '$PRIVATE_TOKEN')"
18
48
 
49
+ # ============= ESLint 检查 =============
19
50
  eslint:
20
51
  stage: eslint
52
+ needs: ["install"] # 明确依赖 install
21
53
  cache:
54
+ key: "$CI_COMMIT_REF_SLUG"
22
55
  paths:
23
56
  - node_modules/
24
57
  script:
25
58
  - pnpm run lint
26
59
  tags:
27
- - sonar
60
+ - runner161
28
61
 
62
+ # ============= 失败通知 =============
29
63
  notify-fail:
30
64
  stage: notify
31
65
  cache:
@@ -33,7 +67,7 @@ notify-fail:
33
67
  - node_modules/
34
68
  script:
35
69
  - >
36
- curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=需要找企业微信管理员'
70
+ curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=找企业微信管理员获取'
37
71
  -H 'Content-Type: application/json'
38
72
  -d "{\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"项目构建结果:<font color=\\"warning\\">失败</font>\n>本次构建由: $GITLAB_USER_NAME 触发\n>项目名称:$CI_PROJECT_NAME\n>提交号:$CI_COMMIT_SHA\n>提交日志:$CI_COMMIT_MESSAGE\n>构建分支: $CI_COMMIT_REF_NAME\n>流水线地址:[$CI_PIPELINE_URL]($CI_PIPELINE_URL)\"}}"
39
73
  when: on_failure
@@ -1,31 +1,65 @@
1
+ # ============= 阶段定义 =============
1
2
  stages:
2
3
  - install
4
+ - ai
3
5
  - eslint
4
6
  - notify
5
7
 
6
- cache:
7
- key: '$CI_COMMIT_REF_SLUG'
8
-
8
+ # ============= 安装依赖 =============
9
9
  install:
10
10
  stage: install
11
11
  cache:
12
- paths:
13
- - node_modules/
14
- script:
15
- - cnpm install
12
+ key: "$CI_COMMIT_REF_SLUG"
13
+ paths:
14
+ - node_modules/
15
+ script:
16
+ - npm -v
17
+ - npm config set @fscut:registry http://nexus.xxxxx.com/repository/fscut-npm/
18
+ - npm config set @fsdev:registry http://nexus.xxxxx.com/repository/npm-dev/
19
+ - npm install --frozen-lockfile
20
+ tags:
21
+ - runner161
22
+
23
+ # ============= AI 代码审查 =============
24
+ ai-job:
25
+ stage: ai
16
26
  tags:
17
- - sonar
27
+ - win191
28
+ only:
29
+ - merge_requests
30
+ variables:
31
+ GIT_CLEAN_FLAGS: none
32
+ allow_failure: true
33
+ script:
34
+ - $GIT_DIR = $(pwd)
35
+ - $GIT_DIR = $GIT_DIR -replace "\\", "/"
36
+ - git fetch origin
37
+ - if ((Test-Path -Path llm_utils)) { Remove-Item -Path llm_utils -Recurse -Force }
38
+ - if (!(Test-Path -Path llm_utils)) { git clone https://git.xxxxx.com/wangzhiqiang/llm_utils.git }
39
+ - cd llm_utils
40
+ - $MR_ID = $env:CI_MERGE_REQUEST_IID
41
+ - $PROJECT_ID = $env:CI_PROJECT_ID
42
+ - $PRIVATE_TOKEN = $env:PRIVATE_TOKEN
43
+ - Write-Host $MR_ID
44
+ - Write-Host $PROJECT_ID
45
+ - Write-Host `"$GIT_DIR`"
46
+ - Write-Host `"$PRIVATE_TOKEN`"
47
+ - python -c "import core; core.run_and_post('$PROJECT_ID', '$MR_ID', '$GIT_DIR', '$PRIVATE_TOKEN')"
18
48
 
49
+ # ============= ESLint 检查 =============
19
50
  eslint:
20
51
  stage: eslint
52
+ needs: ["install"] # 明确依赖 install
21
53
  cache:
54
+ key: "$CI_COMMIT_REF_SLUG"
22
55
  paths:
23
56
  - node_modules/
24
57
  script:
25
58
  - npm run lint
26
59
  tags:
27
- - sonar
28
-
60
+ - runner161
61
+
62
+ # ============= 失败通知 =============
29
63
  notify-fail:
30
64
  stage: notify
31
65
  cache:
@@ -33,9 +67,9 @@ notify-fail:
33
67
  - node_modules/
34
68
  script:
35
69
  - >
36
- curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=需要找企业微信管理员'
70
+ curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=找企业微信管理员获取'
37
71
  -H 'Content-Type: application/json'
38
72
  -d "{\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"项目构建结果:<font color=\\"warning\\">失败</font>\n>本次构建由: $GITLAB_USER_NAME 触发\n>项目名称:$CI_PROJECT_NAME\n>提交号:$CI_COMMIT_SHA\n>提交日志:$CI_COMMIT_MESSAGE\n>构建分支: $CI_COMMIT_REF_NAME\n>流水线地址:[$CI_PIPELINE_URL]($CI_PIPELINE_URL)\"}}"
39
73
  when: on_failure
40
74
  tags:
41
- - sonar
75
+ - sonar
@@ -1,31 +1,65 @@
1
+ # ============= 阶段定义 =============
1
2
  stages:
2
3
  - install
4
+ - ai
3
5
  - eslint
4
6
  - notify
5
7
 
6
- cache:
7
- key: '$CI_COMMIT_REF_SLUG'
8
-
8
+ # ============= 安装依赖 =============
9
9
  install:
10
10
  stage: install
11
11
  cache:
12
- paths:
13
- - node_modules/
14
- script:
15
- - cnpm install
12
+ key: "$CI_COMMIT_REF_SLUG"
13
+ paths:
14
+ - node_modules/
15
+ script:
16
+ - npm -v
17
+ - npm config set @fscut:registry http://nexus.xxxxx.com/repository/fscut-npm/
18
+ - npm config set @fsdev:registry http://nexus.xxxxx.com/repository/npm-dev/
19
+ - npm install --frozen-lockfile
20
+ tags:
21
+ - runner161
22
+
23
+ # ============= AI 代码审查 =============
24
+ ai-job:
25
+ stage: ai
16
26
  tags:
17
- - sonar
27
+ - win191
28
+ only:
29
+ - merge_requests
30
+ variables:
31
+ GIT_CLEAN_FLAGS: none
32
+ allow_failure: true
33
+ script:
34
+ - $GIT_DIR = $(pwd)
35
+ - $GIT_DIR = $GIT_DIR -replace "\\", "/"
36
+ - git fetch origin
37
+ - if ((Test-Path -Path llm_utils)) { Remove-Item -Path llm_utils -Recurse -Force }
38
+ - if (!(Test-Path -Path llm_utils)) { git clone https://git.xxxxx.com/wangzhiqiang/llm_utils.git }
39
+ - cd llm_utils
40
+ - $MR_ID = $env:CI_MERGE_REQUEST_IID
41
+ - $PROJECT_ID = $env:CI_PROJECT_ID
42
+ - $PRIVATE_TOKEN = $env:PRIVATE_TOKEN
43
+ - Write-Host $MR_ID
44
+ - Write-Host $PROJECT_ID
45
+ - Write-Host `"$GIT_DIR`"
46
+ - Write-Host `"$PRIVATE_TOKEN`"
47
+ - python -c "import core; core.run_and_post('$PROJECT_ID', '$MR_ID', '$GIT_DIR', '$PRIVATE_TOKEN')"
18
48
 
49
+ # ============= ESLint 检查 =============
19
50
  eslint:
20
51
  stage: eslint
52
+ needs: ["install"] # 明确依赖 install
21
53
  cache:
54
+ key: "$CI_COMMIT_REF_SLUG"
22
55
  paths:
23
56
  - node_modules/
24
57
  script:
25
58
  - npm run lint
26
59
  tags:
27
- - sonar
28
-
60
+ - runner161
61
+
62
+ # ============= 失败通知 =============
29
63
  notify-fail:
30
64
  stage: notify
31
65
  cache:
@@ -33,9 +67,9 @@ notify-fail:
33
67
  - node_modules/
34
68
  script:
35
69
  - >
36
- curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=需要找企业微信管理员'
70
+ curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=找企业微信管理员获取'
37
71
  -H 'Content-Type: application/json'
38
72
  -d "{\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"项目构建结果:<font color=\\"warning\\">失败</font>\n>本次构建由: $GITLAB_USER_NAME 触发\n>项目名称:$CI_PROJECT_NAME\n>提交号:$CI_COMMIT_SHA\n>提交日志:$CI_COMMIT_MESSAGE\n>构建分支: $CI_COMMIT_REF_NAME\n>流水线地址:[$CI_PIPELINE_URL]($CI_PIPELINE_URL)\"}}"
39
73
  when: on_failure
40
74
  tags:
41
- - sonar
75
+ - sonar