@farris/cli 2.2.6 → 2.3.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.
- package/lib/commands/add-app.js +6 -0
- package/lib/commands/add-app.js.map +1 -0
- package/lib/commands/add-lib.js +6 -0
- package/lib/commands/add-lib.js.map +1 -0
- package/lib/commands/add-project.js +194 -0
- package/lib/commands/add-project.js.map +1 -0
- package/lib/commands/build-components.js +8 -1
- package/lib/commands/build-components.js.map +1 -1
- package/lib/commands/build-lib.js +5 -0
- package/lib/commands/build-lib.js.map +1 -1
- package/lib/commands/build.js +7 -2
- package/lib/commands/build.js.map +1 -1
- package/lib/commands/create-app-options.js +0 -2
- package/lib/commands/create-app-options.js.map +1 -1
- package/lib/commands/create-app.js +6 -1
- package/lib/commands/create-app.js.map +1 -1
- package/lib/commands/create-options.js +3 -0
- package/lib/commands/create-options.js.map +1 -1
- package/lib/commands/create.js +95 -42
- package/lib/commands/create.js.map +1 -1
- package/lib/commands/generate/common.js +13 -12
- package/lib/commands/generate/common.js.map +1 -1
- package/lib/commands/workspace/add-app.js +10 -175
- package/lib/commands/workspace/add-app.js.map +1 -1
- package/lib/commands/workspace/create.js +29 -346
- package/lib/commands/workspace/create.js.map +1 -1
- package/lib/common/agents-doc.js +34 -0
- package/lib/common/agents-doc.js.map +1 -0
- package/lib/common/generate-app.js +48 -24
- package/lib/common/generate-app.js.map +1 -1
- package/lib/common/output.js +72 -2
- package/lib/common/output.js.map +1 -1
- package/lib/common/project-layout.js +143 -0
- package/lib/common/project-layout.js.map +1 -0
- package/lib/common/safety.js +4 -2
- package/lib/common/safety.js.map +1 -1
- package/lib/common/template-manifest.js +2 -4
- package/lib/common/template-manifest.js.map +1 -1
- package/lib/common/verifier.js +143 -99
- package/lib/common/verifier.js.map +1 -1
- package/lib/common/workspace-contract.js +86 -0
- package/lib/common/workspace-contract.js.map +1 -0
- package/lib/index.js +31 -2
- package/lib/index.js.map +1 -1
- package/lib/plugins/create-app-package-json.js +24 -0
- package/lib/plugins/create-app-package-json.js.map +1 -0
- package/package.json +53 -52
- package/templates/create/.gitignore.tpl +12 -0
- package/templates/create/AGENTS.md +62 -0
- package/templates/create/CLAUDE.md +1 -0
- package/templates/create/README.md +14 -1
- package/templates/create/package.json +11 -3
- package/templates/create/pnpm-workspace.yaml +2 -1
- package/templates/lib/.eslintrc.cjs +15 -0
- package/templates/lib/.gitignore.tpl +3 -0
- package/templates/lib/.prettierrc.json +8 -0
- package/templates/lib/index.html +1 -1
- package/templates/lib/package.json +38 -3
- package/templates/lib/{components → test/components}/button/button.spec.ts +3 -2
- package/templates/lib/test/components/button/button.spec.tsx +11 -0
- package/templates/lib/tsconfig.json +5 -1
- package/templates/lib/vitest.config.ts +1 -1
- package/templates/mobile/.gitignore.tpl +31 -0
- package/templates/mobile/.gitlab-ci.yml +3 -9
- package/templates/mobile/index.html +1 -1
- package/templates/mobile/package.json +14 -10
- package/templates/mobile/src/main.ts +5 -4
- package/templates/mobile/src/router/index.ts +17 -17
- package/templates/mobile/test/src/components/TheButton.spec.ts +15 -0
- package/templates/mobile/test/src/components/TheButton.spec.tsx +15 -0
- package/templates/mobile/tsconfig.json +3 -2
- package/templates/mobile/vitest.config.ts +2 -1
- package/templates/web/.gitignore.tpl +31 -0
- package/templates/web/.gitlab-ci.yml +3 -9
- package/templates/web/index.html +1 -1
- package/templates/web/package.json +14 -10
- package/templates/web/src/locales/index.ts +5 -0
- package/templates/web/src/locales/zh-CN.json +1 -0
- package/templates/web/src/main.ts +5 -2
- package/templates/web/src/router/index.ts +17 -17
- package/templates/web/src/styles/index.css +0 -0
- package/templates/web/src/styles/index.scss +0 -0
- package/templates/web/test/src/components/TheButton.spec.ts +15 -0
- package/templates/web/test/src/components/TheButton.spec.tsx +15 -0
- package/templates/web/tsconfig.json +3 -2
- package/templates/web/vitest.config.ts +2 -1
- package/lib/common/project-package-name.js +0 -5
- package/lib/common/project-package-name.js.map +0 -1
- package/templates/mobile/.changeset/README.md +0 -4
- package/templates/mobile/.changeset/config.json +0 -11
- package/templates/mobile/project.json +0 -4
- package/templates/mobile/src/components/TheButton.spec.ts +0 -8
- package/templates/web/.changeset/README.md +0 -4
- package/templates/web/.changeset/config.json +0 -11
- package/templates/web/project.json +0 -4
- package/templates/web/src/components/TheButton.spec.ts +0 -8
- package/templates/workspace/app/farris.config.mjs +0 -13
- package/templates/workspace/app/index.html +0 -12
- package/templates/workspace/app/package.json +0 -22
- package/templates/workspace/app/src/App.tsx +0 -11
- package/templates/workspace/app/src/main.ts +0 -12
- package/templates/workspace/app/src/router/index.ts +0 -16
- package/templates/workspace/app/src/views/home/composables/use-home.ts +0 -7
- package/templates/workspace/app/src/views/home/home.component.tsx +0 -15
- package/templates/workspace/app/src/views/home/index.ts +0 -4
- package/templates/workspace/app/tsconfig.json +0 -21
- package/templates/workspace/root/README.md +0 -28
- package/templates/workspace/root/package.json +0 -13
- package/templates/workspace/root/pnpm-workspace.yaml +0 -12
- /package/templates/{workspace/app → mobile}/src/locales/index.ts +0 -0
- /package/templates/{workspace/app → mobile}/src/locales/zh-CN.json +0 -0
- /package/templates/{workspace/app → mobile}/src/styles/index.css +0 -0
- /package/templates/{workspace/app → mobile}/src/styles/index.scss +0 -0
|
@@ -3,11 +3,37 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"description": "<%= name %>,基于 Farris Vue 的 Vue3 组件库。",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"farris",
|
|
10
|
+
"vue3",
|
|
11
|
+
"components"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://farris-design.gitee.io/farris-vue/",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git@gitee.com:ubml/farris-vue.git"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"lib"
|
|
20
|
+
],
|
|
21
|
+
"sideEffects": [
|
|
22
|
+
"**/*.css",
|
|
23
|
+
"**/*.scss"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
6
28
|
"scripts": {
|
|
7
29
|
"dev": "farris-cli dev",
|
|
8
30
|
"build": "farris-cli build-lib -ep && farris-cli build-components",
|
|
31
|
+
"preview": "farris-cli preview",
|
|
9
32
|
"test": "vitest run",
|
|
10
33
|
"test:watch": "vitest",
|
|
34
|
+
"typecheck": "vue-tsc --noEmit",
|
|
35
|
+
"lint": "eslint . --ext .vue,.ts,.tsx --fix",
|
|
36
|
+
"format": "prettier --write components/ src/",
|
|
11
37
|
"changeset": "changeset",
|
|
12
38
|
"version": "changeset version"
|
|
13
39
|
},
|
|
@@ -17,12 +43,21 @@
|
|
|
17
43
|
"devDependencies": {
|
|
18
44
|
"@changesets/cli": "^2.29.5",
|
|
19
45
|
"@farris/cli": "<%= cliVersion %>",
|
|
20
|
-
"@
|
|
21
|
-
"@vue/test-utils": "^2.4.6",
|
|
46
|
+
"@rushstack/eslint-patch": "^1.8.0",
|
|
22
47
|
"@vitejs/plugin-vue": "^5.2.4",
|
|
48
|
+
"@vue/eslint-config-prettier": "^9.0.0",
|
|
49
|
+
"@vue/eslint-config-typescript": "^13.0.0",
|
|
50
|
+
"@vue/test-utils": "^2.4.6",
|
|
51
|
+
"@vue/tsconfig": "^0.5.1",
|
|
52
|
+
"eslint": "^8.57.0",
|
|
53
|
+
"eslint-plugin-vue": "^9.23.0",
|
|
23
54
|
"jsdom": "^25.0.1",
|
|
55
|
+
"prettier": "^3.2.5",
|
|
56
|
+
"sass": "^1.90.0",
|
|
24
57
|
"typescript": "~5.4.0",
|
|
58
|
+
"vite": "^5.4.19",
|
|
59
|
+
"vitest": "^3.2.4",
|
|
25
60
|
"vue": "^3.4.29",
|
|
26
|
-
"
|
|
61
|
+
"vue-tsc": "^2.2.0"
|
|
27
62
|
}
|
|
28
63
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils';
|
|
2
2
|
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import { Button } from '
|
|
3
|
+
import { Button } from '../../../../components/button/index';
|
|
4
4
|
|
|
5
5
|
describe('Button', () => {
|
|
6
|
-
it('renders
|
|
6
|
+
it('renders its default slot', () => {
|
|
7
7
|
const wrapper = mount(Button, { slots: { default: 'OK' } });
|
|
8
|
+
|
|
8
9
|
expect(wrapper.text()).toContain('OK');
|
|
9
10
|
});
|
|
10
11
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { Button } from '../../../../components/button/index';
|
|
4
|
+
|
|
5
|
+
describe('Button (tsx collection)', () => {
|
|
6
|
+
it('is collected by the unified vitest include', () => {
|
|
7
|
+
const wrapper = mount(Button, { slots: { default: 'OK' } });
|
|
8
|
+
|
|
9
|
+
expect(wrapper.text()).toContain('OK');
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
package-lock.json
|
|
12
|
+
.DS_Store
|
|
13
|
+
dist
|
|
14
|
+
dist-ssr
|
|
15
|
+
coverage
|
|
16
|
+
*.local
|
|
17
|
+
|
|
18
|
+
/cypress/videos/
|
|
19
|
+
/cypress/screenshots/
|
|
20
|
+
|
|
21
|
+
# Editor directories and files
|
|
22
|
+
.vscode/*
|
|
23
|
+
!.vscode/extensions.json
|
|
24
|
+
.idea
|
|
25
|
+
*.suo
|
|
26
|
+
*.ntvs*
|
|
27
|
+
*.njsproj
|
|
28
|
+
*.sln
|
|
29
|
+
*.sw?
|
|
30
|
+
|
|
31
|
+
*.tsbuildinfo
|
|
@@ -39,11 +39,8 @@ publish-project:
|
|
|
39
39
|
stage: publishproject
|
|
40
40
|
tags:
|
|
41
41
|
- environment:cloud
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- cicd
|
|
45
|
-
changes:
|
|
46
|
-
- project.json
|
|
42
|
+
rules:
|
|
43
|
+
- if: $CI_COMMIT_TAG =~ /^v\d/
|
|
47
44
|
before_script:
|
|
48
45
|
- |
|
|
49
46
|
if [ -z "${ARTIFACTS_REPO_USERNAME}" ] || [ -z "${ARTIFACTS_REPO_PASSWORD}" ]; then
|
|
@@ -59,7 +56,4 @@ publish-project:
|
|
|
59
56
|
- npm config fix
|
|
60
57
|
script:
|
|
61
58
|
- npm config set //repos.iec.io/repository/npm-igix-release/:_auth=$(echo -n ${ARTIFACTS_REPO_USERNAME}:${ARTIFACTS_REPO_PASSWORD} | base64)
|
|
62
|
-
-
|
|
63
|
-
- cd ./dist
|
|
64
|
-
- mv ./project.json ./package.json
|
|
65
|
-
- npm publish
|
|
59
|
+
- cd dist && npm publish
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<%= name %>",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "farris-cli dev",
|
|
8
|
-
"build": "farris-cli build",
|
|
8
|
+
"build": "farris-cli build -ep",
|
|
9
9
|
"preview": "farris-cli preview",
|
|
10
|
-
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
11
|
-
"format": "prettier --write src/",
|
|
12
10
|
"test": "vitest run",
|
|
13
11
|
"test:watch": "vitest",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
12
|
+
"typecheck": "vue-tsc --noEmit",
|
|
13
|
+
"lint": "eslint . --ext .vue,.ts,.tsx --fix",
|
|
14
|
+
"format": "prettier --write src/",
|
|
15
|
+
"i18n": "farris-cli extract-i18n"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@farris/mobile-ui-vue": "latest",
|
|
@@ -20,17 +20,21 @@
|
|
|
20
20
|
"vue-router": "^4.3.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@changesets/cli": "^2.29.5",
|
|
24
23
|
"@farris/cli": "<%= cliVersion %>",
|
|
25
24
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
25
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
26
26
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
27
27
|
"@vue/eslint-config-typescript": "^13.0.0",
|
|
28
|
+
"@vue/test-utils": "^2.4.6",
|
|
28
29
|
"@vue/tsconfig": "^0.5.1",
|
|
29
|
-
"@vitejs/plugin-vue": "^5.2.4",
|
|
30
30
|
"eslint": "^8.57.0",
|
|
31
31
|
"eslint-plugin-vue": "^9.23.0",
|
|
32
|
+
"jsdom": "^25.0.1",
|
|
32
33
|
"prettier": "^3.2.5",
|
|
33
34
|
"typescript": "~5.4.0",
|
|
34
|
-
"
|
|
35
|
+
"vite": "^5.4.19",
|
|
36
|
+
"vitest": "^3.2.4",
|
|
37
|
+
"vue-tsc": "^2.2.0",
|
|
38
|
+
"sass": "^1.90.0"
|
|
35
39
|
}
|
|
36
|
-
}
|
|
40
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { createApp } from 'vue';
|
|
2
2
|
import FarrisVue from '@farris/mobile-ui-vue';
|
|
3
|
-
import App from './App.vue';
|
|
4
|
-
import router from './router';
|
|
5
|
-
|
|
6
3
|
import '@farris/mobile-ui-vue/style.css';
|
|
4
|
+
import App from './App.vue';
|
|
5
|
+
import router from './router';<%= styleImport %>
|
|
6
|
+
import { localResources } from './locales';
|
|
7
7
|
|
|
8
8
|
const app = createApp(App);
|
|
9
9
|
|
|
10
|
-
app.use(
|
|
10
|
+
app.use(FarrisVue, { basePath: '', locale: 'zh-CN', localResources });
|
|
11
|
+
app.use(router);
|
|
11
12
|
|
|
12
13
|
app.mount('#app');
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { createRouter, createWebHistory } from 'vue-router';
|
|
2
|
-
|
|
1
|
+
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
|
|
2
|
+
|
|
3
|
+
// 生成器(farris-cli generate view --with-route)依赖下面的 routes 数组赋值形式;
|
|
4
|
+
// 改动结构会导致路由无法自动注册。
|
|
5
|
+
export const routes: RouteRecordRaw[] = [
|
|
6
|
+
{
|
|
7
|
+
path: '/',
|
|
8
|
+
name: 'Home',
|
|
9
|
+
component: () => import('../views/HomeView.vue')
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
path: '/about',
|
|
13
|
+
name: 'About',
|
|
14
|
+
component: () => import('../views/AboutView.vue')
|
|
15
|
+
}
|
|
16
|
+
];
|
|
3
17
|
|
|
4
18
|
const router = createRouter({
|
|
5
19
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
6
|
-
routes
|
|
7
|
-
{
|
|
8
|
-
path: '/',
|
|
9
|
-
name: 'home',
|
|
10
|
-
component: HomeView
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
path: '/about',
|
|
14
|
-
name: 'about',
|
|
15
|
-
// route level code-splitting
|
|
16
|
-
// this generates a separate chunk (About.[hash].js) for this route
|
|
17
|
-
// which is lazy-loaded when the route is visited.
|
|
18
|
-
component: () => import('../views/AboutView.vue')
|
|
19
|
-
}
|
|
20
|
-
]
|
|
20
|
+
routes
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
export default router;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import TheButton from '../../../src/components/TheButton.vue';
|
|
4
|
+
|
|
5
|
+
describe('TheButton', () => {
|
|
6
|
+
it('mounts and renders its default slot', () => {
|
|
7
|
+
const wrapper = mount(TheButton, {
|
|
8
|
+
global: {
|
|
9
|
+
stubs: { 'fm-button': { template: '<button><slot /></button>' } }
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(wrapper.text()).toContain('按钮');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import TheButton from '../../../src/components/TheButton.vue';
|
|
4
|
+
|
|
5
|
+
describe('TheButton (tsx collection)', () => {
|
|
6
|
+
it('is collected by the unified vitest include', () => {
|
|
7
|
+
const wrapper = mount(TheButton, {
|
|
8
|
+
global: {
|
|
9
|
+
stubs: { 'fm-button': { template: '<button><slot /></button>' } }
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(wrapper.text()).toContain('按钮');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
package-lock.json
|
|
12
|
+
.DS_Store
|
|
13
|
+
dist
|
|
14
|
+
dist-ssr
|
|
15
|
+
coverage
|
|
16
|
+
*.local
|
|
17
|
+
|
|
18
|
+
/cypress/videos/
|
|
19
|
+
/cypress/screenshots/
|
|
20
|
+
|
|
21
|
+
# Editor directories and files
|
|
22
|
+
.vscode/*
|
|
23
|
+
!.vscode/extensions.json
|
|
24
|
+
.idea
|
|
25
|
+
*.suo
|
|
26
|
+
*.ntvs*
|
|
27
|
+
*.njsproj
|
|
28
|
+
*.sln
|
|
29
|
+
*.sw?
|
|
30
|
+
|
|
31
|
+
*.tsbuildinfo
|
|
@@ -39,11 +39,8 @@ publish-project:
|
|
|
39
39
|
stage: publishproject
|
|
40
40
|
tags:
|
|
41
41
|
- environment:cloud
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- cicd
|
|
45
|
-
changes:
|
|
46
|
-
- project.json
|
|
42
|
+
rules:
|
|
43
|
+
- if: $CI_COMMIT_TAG =~ /^v\d/
|
|
47
44
|
before_script:
|
|
48
45
|
- |
|
|
49
46
|
if [ -z "${ARTIFACTS_REPO_USERNAME}" ] || [ -z "${ARTIFACTS_REPO_PASSWORD}" ]; then
|
|
@@ -59,7 +56,4 @@ publish-project:
|
|
|
59
56
|
- npm config fix
|
|
60
57
|
script:
|
|
61
58
|
- npm config set //repos.iec.io/repository/npm-igix-release/:_auth=$(echo -n ${ARTIFACTS_REPO_USERNAME}:${ARTIFACTS_REPO_PASSWORD} | base64)
|
|
62
|
-
-
|
|
63
|
-
- cd ./dist
|
|
64
|
-
- mv ./project.json ./package.json
|
|
65
|
-
- npm publish
|
|
59
|
+
- cd dist && npm publish
|
package/templates/web/index.html
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<%= name %>",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "farris-cli dev",
|
|
8
|
-
"build": "farris-cli build",
|
|
8
|
+
"build": "farris-cli build -ep",
|
|
9
9
|
"preview": "farris-cli preview",
|
|
10
|
-
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
|
|
11
|
-
"format": "prettier --write src/",
|
|
12
10
|
"test": "vitest run",
|
|
13
11
|
"test:watch": "vitest",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
12
|
+
"typecheck": "vue-tsc --noEmit",
|
|
13
|
+
"lint": "eslint . --ext .vue,.ts,.tsx --fix",
|
|
14
|
+
"format": "prettier --write src/",
|
|
15
|
+
"i18n": "farris-cli extract-i18n"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@farris/ui-vue": "latest",
|
|
@@ -20,17 +20,21 @@
|
|
|
20
20
|
"vue-router": "^4.3.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@changesets/cli": "^2.29.5",
|
|
24
23
|
"@farris/cli": "<%= cliVersion %>",
|
|
25
24
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
25
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
26
26
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
27
27
|
"@vue/eslint-config-typescript": "^13.0.0",
|
|
28
|
+
"@vue/test-utils": "^2.4.6",
|
|
28
29
|
"@vue/tsconfig": "^0.5.1",
|
|
29
|
-
"@vitejs/plugin-vue": "^5.2.4",
|
|
30
30
|
"eslint": "^8.57.0",
|
|
31
31
|
"eslint-plugin-vue": "^9.23.0",
|
|
32
|
+
"jsdom": "^25.0.1",
|
|
32
33
|
"prettier": "^3.2.5",
|
|
33
34
|
"typescript": "~5.4.0",
|
|
34
|
-
"
|
|
35
|
+
"vite": "^5.4.19",
|
|
36
|
+
"vitest": "^3.2.4",
|
|
37
|
+
"vue-tsc": "^2.2.0",
|
|
38
|
+
"sass": "^1.90.0"
|
|
35
39
|
}
|
|
36
|
-
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { createApp } from 'vue';
|
|
2
2
|
import FarrisVue from '@farris/ui-vue';
|
|
3
|
+
import '@farris/ui-vue/index.css';
|
|
3
4
|
import App from './App.vue';
|
|
4
|
-
import router from './router'
|
|
5
|
+
import router from './router';<%= styleImport %>
|
|
6
|
+
import { localResources } from './locales';
|
|
5
7
|
|
|
6
8
|
const app = createApp(App);
|
|
7
9
|
|
|
8
|
-
app.use(
|
|
10
|
+
app.use(FarrisVue, { basePath: '', locale: 'zh-CN', localResources });
|
|
11
|
+
app.use(router);
|
|
9
12
|
|
|
10
13
|
app.mount('#app');
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { createRouter, createWebHistory } from 'vue-router';
|
|
2
|
-
|
|
1
|
+
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
|
|
2
|
+
|
|
3
|
+
// 生成器(farris-cli generate view --with-route)依赖下面的 routes 数组赋值形式;
|
|
4
|
+
// 改动结构会导致路由无法自动注册。
|
|
5
|
+
export const routes: RouteRecordRaw[] = [
|
|
6
|
+
{
|
|
7
|
+
path: '/',
|
|
8
|
+
name: 'Home',
|
|
9
|
+
component: () => import('../views/HomeView.vue')
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
path: '/about',
|
|
13
|
+
name: 'About',
|
|
14
|
+
component: () => import('../views/AboutView.vue')
|
|
15
|
+
}
|
|
16
|
+
];
|
|
3
17
|
|
|
4
18
|
const router = createRouter({
|
|
5
19
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
6
|
-
routes
|
|
7
|
-
{
|
|
8
|
-
path: '/',
|
|
9
|
-
name: 'home',
|
|
10
|
-
component: HomeView
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
path: '/about',
|
|
14
|
-
name: 'about',
|
|
15
|
-
// route level code-splitting
|
|
16
|
-
// this generates a separate chunk (About.[hash].js) for this route
|
|
17
|
-
// which is lazy-loaded when the route is visited.
|
|
18
|
-
component: () => import('../views/AboutView.vue')
|
|
19
|
-
}
|
|
20
|
-
]
|
|
20
|
+
routes
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
export default router;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import TheButton from '../../../src/components/TheButton.vue';
|
|
4
|
+
|
|
5
|
+
describe('TheButton', () => {
|
|
6
|
+
it('mounts and renders its default slot', () => {
|
|
7
|
+
const wrapper = mount(TheButton, {
|
|
8
|
+
global: {
|
|
9
|
+
stubs: { 'f-button': { template: '<button><slot /></button>' } }
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(wrapper.text()).toContain('按钮');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import TheButton from '../../../src/components/TheButton.vue';
|
|
4
|
+
|
|
5
|
+
describe('TheButton (tsx collection)', () => {
|
|
6
|
+
it('is collected by the unified vitest include', () => {
|
|
7
|
+
const wrapper = mount(TheButton, {
|
|
8
|
+
global: {
|
|
9
|
+
stubs: { 'f-button': { template: '<button><slot /></button>' } }
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(wrapper.text()).toContain('按钮');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-package-name.js","sourceRoot":"","sources":["../../src/common/project-package-name.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC/C,OAAO,mBAAmB,QAAQ,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "restricted",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|