@component-hook/create-app 1.1.1 → 1.1.3
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/README.md +6 -4
- package/dist/index.js +34 -30
- package/package.json +2 -2
- package/template-react/.vscode/extensions.json +9 -0
- package/template-react/.vscode/settings.json +24 -0
- package/template-react/README.md.art +86 -0
- package/template-react/eslint.config.js +18 -0
- package/template-react/index.html.art +13 -0
- package/template-react/lint-staged.config.js +6 -0
- package/template-react/package.json +68 -0
- package/template-react/pnpm-lock.yaml +9897 -0
- package/template-react/public/vite.svg +1 -0
- package/template-react/src/App.tsx +6 -0
- package/template-react/src/__tests__/e2e/home.spec.ts +40 -0
- package/template-react/src/__tests__/unit/pages/home/components/HelloWorld.test.tsx +45 -0
- package/template-react/src/__tests__/unit/pages/home/index.test.tsx +19 -0
- package/template-react/src/__tests__/unit/render/index.tsx +15 -0
- package/template-react/src/assets/svg-icons/react.svg +1 -0
- package/template-react/src/components/common/index.ts +1 -0
- package/template-react/src/components/common/svg-icon/index.ts +1 -0
- package/template-react/src/components/common/svg-icon/src/index.tsx +23 -0
- package/template-react/src/main.tsx +26 -0
- package/template-react/src/mocks/browser.ts +4 -0
- package/template-react/src/mocks/handlers/index.ts +1 -0
- package/template-react/src/mocks/server.ts +4 -0
- package/template-react/src/pages/home/components/hello-world/index.tsx +47 -0
- package/template-react/src/pages/home/index.module.css +8 -0
- package/template-react/src/pages/home/index.tsx +37 -0
- package/template-react/src/plugins/i18n/index.ts +15 -0
- package/template-react/src/plugins/i18n/locales/en-US.json +3 -0
- package/template-react/src/plugins/i18n/locales/zh-TW.json +3 -0
- package/template-react/src/router/index.tsx +22 -0
- package/template-react/src/stores/constants.ts +1 -0
- package/template-react/src/stores/index.ts +1 -0
- package/template-react/src/stores/middleware.ts +17 -0
- package/template-react/src/stores/modules/config.ts +25 -0
- package/template-react/src/styles/base.css +68 -0
- package/template-react/src/styles/common/all.css +1 -0
- package/template-react/src/styles/common/button.css +26 -0
- package/template-react/src/styles/index.css +3 -0
- package/template-react/src/styles/tailwind.css +14 -0
- package/template-react/src/vite-env.d.ts +9 -0
- package/template-react/tsconfig.app.json +32 -0
- package/template-react/tsconfig.vitest.json +10 -0
- package/template-react/vite.config.ts +50 -0
- package/template-react/vitest.config.ts +18 -0
- package/template-react/vitest.setup.ts +13 -0
- package/template-shared/.browserslistrc +10 -0
- package/{template-vue → template-shared}/.github/workflows/preview.yml +1 -1
- package/{template-vue → template-shared}/.husky/commit-msg +0 -2
- package/{template-vue → template-shared}/.husky/pre-commit +0 -2
- package/{template-vue → template-shared}/_gitignore +0 -3
- package/{template-vue → template-shared}/postcss.config.js +2 -0
- package/{template-vue → template-shared}/tsconfig.node.json +2 -2
- package/template-vue/README.md.art +8 -10
- package/template-vue/package.json +25 -29
- package/template-vue/src/__tests__/e2e/home.spec.ts +28 -20
- package/template-vue/src/__tests__/unit/{components/home → pages/home/components}/HelloWorld.test.ts +1 -1
- package/template-vue/src/__tests__/unit/pages/home/index.test.ts +17 -0
- package/template-vue/src/components/common/index.ts +1 -0
- package/template-vue/src/main.ts +2 -4
- package/template-vue/src/pages/home/index.vue +2 -1
- package/template-vue/src/plugins/i18n.ts +2 -6
- package/template-vue/src/stores/constants.ts.art +1 -0
- package/template-vue/src/stores/index.ts +14 -2
- package/template-vue/src/stores/modules/{config.ts.art → config.ts} +1 -1
- package/template-vue/src/styles/base.css +14 -3
- package/template-vue/tsconfig.app.json +2 -3
- package/template-vue/tsconfig.vitest.json +5 -3
- package/template-vue/vite.config.ts +7 -1
- package/template-vue/vitest.config.ts +1 -4
- package/template-vue/{src/__tests__/setup/unit-test.ts → vitest.setup.ts} +7 -1
- /package/{template-vue → template-shared}/.github/actions/setup-environment/action.yml +0 -0
- /package/{template-vue → template-shared}/.github/renovate.json +0 -0
- /package/{template-vue → template-shared}/.github/workflows/ci.yml +0 -0
- /package/{template-vue → template-shared}/.github/workflows/deploy.yml +0 -0
- /package/{template-vue → template-shared}/.gitlab/setup.yml +0 -0
- /package/{template-vue → template-shared}/LICENSE +0 -0
- /package/{template-vue → template-shared}/_gitlab-ci.yml +0 -0
- /package/{template-vue → template-shared}/commitlint.config.js +0 -0
- /package/{template-vue → template-shared}/playwright.config.ts +0 -0
- /package/{template-vue → template-shared}/prettier.config.js +0 -0
- /package/{template-vue → template-shared}/tsconfig.json +0 -0
- /package/template-vue/src/assets/{images/svg-icons → svg-icons}/vue.svg +0 -0
- /package/template-vue/src/components/{svg-icon → common/svg-icon}/index.ts +0 -0
- /package/template-vue/src/components/{svg-icon → common/svg-icon}/src/index.vue +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cleanup } from '@testing-library/react';
|
|
2
|
+
import { mswServer } from '@/mocks/server';
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
|
+
import '@/plugins/i18n';
|
|
5
|
+
|
|
6
|
+
beforeAll(() => mswServer.listen());
|
|
7
|
+
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
cleanup();
|
|
10
|
+
mswServer.resetHandlers();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterAll(() => mswServer.close());
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Click this link to view browser coverage https://browsersl.ist/#q=%3E+1.5%25%0Aios+%3E%3D+12%0Achrome+%3E%3D+49%0Anot+ie+%3C%3D+11%0Alast+2+versions%0Anot+dead
|
|
2
|
+
|
|
3
|
+
# Browsers that support
|
|
4
|
+
|
|
5
|
+
> 1.5%
|
|
6
|
+
ios >= 12
|
|
7
|
+
chrome >= 49
|
|
8
|
+
not ie <= 11
|
|
9
|
+
last 2 versions
|
|
10
|
+
not dead
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import autoprefixer from 'autoprefixer';
|
|
2
2
|
import cssnano from 'cssnano';
|
|
3
|
+
import postcssPresetEnv from 'postcss-preset-env';
|
|
3
4
|
import postcssPxtorem from 'postcss-pxtorem';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
@@ -10,6 +11,7 @@ export default {
|
|
|
10
11
|
propList: ['*'],
|
|
11
12
|
selectorBlackList: ['norem'],
|
|
12
13
|
}),
|
|
14
|
+
postcssPresetEnv({ stage: 3 }),
|
|
13
15
|
...(process.env.NODE_ENV === 'production' ? [cssnano({ preset: 'default' })] : []),
|
|
14
16
|
],
|
|
15
17
|
};
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"extends": "@tsconfig/node22/tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"composite": true,
|
|
5
|
-
"
|
|
5
|
+
"noEmit": true,
|
|
6
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
6
7
|
"module": "ESNext",
|
|
7
8
|
"moduleResolution": "bundler",
|
|
8
|
-
"resolveJsonModule": true,
|
|
9
9
|
"types": ["node"]
|
|
10
10
|
},
|
|
11
11
|
"include": ["vite.config.ts", "package.json", "vitest.config.ts", "playwright.config.ts"]
|
|
@@ -8,7 +8,7 @@ This project is built with [vue3](https://vuejs.org/) + [vite](https://vite.dev/
|
|
|
8
8
|
- **API & Mocking**: Handles requests with [axios](https://axios-http.com/docs/intro) and mocks APIs using [msw](https://mswjs.io/).
|
|
9
9
|
- **Code Quality**: Enforces standards with [eslint](https://eslint.org/) and [prettier](https://prettier.io/), with [husky](https://www.npmjs.com/package/husky), [commitlint](https://commitlint.js.org/#/), and [lint-staged](https://github.com/okonet/lint-staged) for commit validation.
|
|
10
10
|
- **Testing**: Uses [vitest](https://vitest.dev/) + [testing-library](https://testing-library.com/) for unit testing and [playwright](https://playwright.dev/) for E2E testing.
|
|
11
|
-
- **Optimization**: Compresses CSS with [cssnano](https://cssnano.github.io/cssnano/)
|
|
11
|
+
- **Optimization**: Compresses CSS with [cssnano](https://cssnano.github.io/cssnano/), converts units with [postcss-pxtorem](https://www.npmjs.com/package/postcss-pxtorem), convert modern CSS into something most browsers can understand with [postcss-preset-env](https://www.npmjs.com/package/postcss-preset-env), and analyzes assets with [rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer).
|
|
12
12
|
- **CI/CD**: Integrates `{{gitRepository}}` for automated testing and deployment.
|
|
13
13
|
|
|
14
14
|
## Code Features / Opinions
|
|
@@ -28,19 +28,17 @@ This project is built with [vue3](https://vuejs.org/) + [vite](https://vite.dev/
|
|
|
28
28
|
src/
|
|
29
29
|
├── __tests__/
|
|
30
30
|
│ ├── __mocks__/
|
|
31
|
-
│ ├── setup/
|
|
32
|
-
│ │ └── unitTest.ts
|
|
33
31
|
│ ├── e2e/*
|
|
34
32
|
│ └── unit/*
|
|
35
|
-
├── apis/*
|
|
36
33
|
├── assets/*
|
|
37
|
-
│ └──
|
|
38
|
-
│ └── svg-icons
|
|
34
|
+
│ └── svg-icons
|
|
39
35
|
│ └── vue.svg
|
|
40
36
|
├── components/
|
|
41
|
-
│ └──
|
|
42
|
-
│ ├──
|
|
43
|
-
│ │
|
|
37
|
+
│ └── common
|
|
38
|
+
│ ├── svg-icon/
|
|
39
|
+
│ │ ├── src
|
|
40
|
+
│ │ │ └── index.vue
|
|
41
|
+
│ │ └── index.ts
|
|
44
42
|
│ └── index.ts
|
|
45
43
|
├── constants/*
|
|
46
44
|
├── hooks/*
|
|
@@ -49,7 +47,7 @@ src/
|
|
|
49
47
|
│ └── zh-CN.json
|
|
50
48
|
├── mocks/
|
|
51
49
|
│ ├── handlers/*
|
|
52
|
-
│ │ ├──
|
|
50
|
+
│ │ ├── modules/*
|
|
53
51
|
│ │ └── index.ts
|
|
54
52
|
│ │── browser.ts
|
|
55
53
|
│ └── server.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-starter",
|
|
3
3
|
"version": "0.0.0",
|
|
4
|
-
"
|
|
4
|
+
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"packageManager": "pnpm@10.
|
|
6
|
+
"packageManager": "pnpm@10.13.1",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "vite",
|
|
9
9
|
"dev:mock": "MOCK=true vite",
|
|
@@ -18,47 +18,43 @@
|
|
|
18
18
|
"preview": "vite preview"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"axios": "^1.
|
|
22
|
-
"pinia": "^3.0.
|
|
23
|
-
"pinia-plugin-persistedstate": "^4.
|
|
24
|
-
"vue": "^3.5.
|
|
25
|
-
"vue-i18n": "^11.1.
|
|
21
|
+
"axios": "^1.10.0",
|
|
22
|
+
"pinia": "^3.0.3",
|
|
23
|
+
"pinia-plugin-persistedstate": "^4.4.1",
|
|
24
|
+
"vue": "^3.5.17",
|
|
25
|
+
"vue-i18n": "^11.1.9",
|
|
26
26
|
"vue-router": "^4.5.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@component-hook/eslint-plugin": "1.1.
|
|
29
|
+
"@component-hook/eslint-plugin": "1.1.2",
|
|
30
30
|
"@intlify/unplugin-vue-i18n": "^6.0.8",
|
|
31
|
-
"@playwright/test": "^1.
|
|
32
|
-
"@tailwindcss/vite": "^4.1.
|
|
31
|
+
"@playwright/test": "^1.54.0",
|
|
32
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
33
33
|
"@testing-library/jest-dom": "^6.6.3",
|
|
34
34
|
"@testing-library/user-event": "^14.6.1",
|
|
35
35
|
"@testing-library/vue": "^8.1.0",
|
|
36
|
-
"@tsconfig/node22": "^22.0.
|
|
37
|
-
"@types/node": "^22.
|
|
38
|
-
"@vitejs/plugin-vue": "^
|
|
39
|
-
"@vitest/coverage-v8": "^3.
|
|
36
|
+
"@tsconfig/node22": "^22.0.2",
|
|
37
|
+
"@types/node": "^22.16.3",
|
|
38
|
+
"@vitejs/plugin-vue": "^6.0.0",
|
|
39
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
40
40
|
"@vue/tsconfig": "^0.7.0",
|
|
41
41
|
"autoprefixer": "^10.4.21",
|
|
42
42
|
"cssnano": "^7.0.7",
|
|
43
|
-
"eslint": "^9.
|
|
43
|
+
"eslint": "^9.30.1",
|
|
44
44
|
"jsdom": "^26.1.0",
|
|
45
|
-
"msw": "^2.
|
|
46
|
-
"postcss": "^8.5.
|
|
45
|
+
"msw": "^2.10.3",
|
|
46
|
+
"postcss": "^8.5.6",
|
|
47
|
+
"postcss-preset-env": "^10.2.4",
|
|
47
48
|
"postcss-pxtorem": "^6.1.0",
|
|
48
|
-
"prettier": "^3.
|
|
49
|
-
"rollup-plugin-visualizer": "^
|
|
50
|
-
"tailwindcss": "^4.1.
|
|
49
|
+
"prettier": "^3.6.2",
|
|
50
|
+
"rollup-plugin-visualizer": "^6.0.3",
|
|
51
|
+
"tailwindcss": "^4.1.11",
|
|
51
52
|
"typescript": "^5.8.3",
|
|
52
|
-
"vite": "^
|
|
53
|
+
"vite": "^7.0.4",
|
|
53
54
|
"vite-plugin-svg-icons": "^2.0.1",
|
|
54
|
-
"vitest": "^3.
|
|
55
|
-
"vue-tsc": "^
|
|
55
|
+
"vitest": "^3.2.4",
|
|
56
|
+
"vue-tsc": "^3.0.1"
|
|
56
57
|
},
|
|
57
|
-
"browserslist": [
|
|
58
|
-
"> 1%",
|
|
59
|
-
"last 2 versions",
|
|
60
|
-
"not dead"
|
|
61
|
-
],
|
|
62
58
|
"msw": {
|
|
63
59
|
"workerDirectory": "public"
|
|
64
60
|
},
|
|
@@ -66,6 +62,6 @@
|
|
|
66
62
|
"@commitlint/cli": "^19.8.1",
|
|
67
63
|
"@commitlint/config-conventional": "^19.8.1",
|
|
68
64
|
"husky": "^9.1.7",
|
|
69
|
-
"lint-staged": "^16.
|
|
65
|
+
"lint-staged": "^16.1.2"
|
|
70
66
|
}
|
|
71
67
|
}
|
|
@@ -4,20 +4,24 @@ test.beforeEach(async ({ page }) => {
|
|
|
4
4
|
await page.goto('/');
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
test('click Vite logo open Vite official website blank tab', async ({ page
|
|
8
|
-
|
|
9
|
-
const newPage = await context.waitForEvent('page');
|
|
7
|
+
test('click Vite logo open Vite official website blank tab', async ({ page }) => {
|
|
8
|
+
const link = page.getByRole('link', { name: /vite logo/i });
|
|
10
9
|
|
|
11
|
-
await
|
|
12
|
-
await
|
|
10
|
+
await expect(link).toBeVisible();
|
|
11
|
+
const [popup] = await Promise.all([page.waitForEvent('popup'), link.evaluate((node: HTMLElement) => node.click())]);
|
|
12
|
+
|
|
13
|
+
await popup.waitForLoadState();
|
|
14
|
+
await expect(popup).toHaveTitle('Vite | Next Generation Frontend Tooling');
|
|
13
15
|
});
|
|
14
16
|
|
|
15
|
-
test('click Vue logo open Vue official website blank tab', async ({ page
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
test('click Vue logo open Vue official website blank tab', async ({ page }) => {
|
|
18
|
+
const link = page.getByLabel(/vue link/i);
|
|
19
|
+
|
|
20
|
+
await expect(link).toBeVisible();
|
|
21
|
+
const [popup] = await Promise.all([page.waitForEvent('popup'), link.evaluate((node: HTMLElement) => node.click())]);
|
|
18
22
|
|
|
19
|
-
await
|
|
20
|
-
await expect(
|
|
23
|
+
await popup.waitForLoadState();
|
|
24
|
+
await expect(popup).toHaveTitle('Vue.js - The Progressive JavaScript Framework | Vue.js');
|
|
21
25
|
});
|
|
22
26
|
|
|
23
27
|
test('homepage count button interact', async ({ page }) => {
|
|
@@ -34,20 +38,24 @@ test('locale change interact', async ({ page }) => {
|
|
|
34
38
|
await expect(page.getByRole('button', { name: 'English' })).toBeVisible();
|
|
35
39
|
});
|
|
36
40
|
|
|
37
|
-
test('click create-vue link open Vue quick start blank tab', async ({ page
|
|
38
|
-
|
|
39
|
-
const newPage = await context.waitForEvent('page');
|
|
41
|
+
test('click create-vue link open Vue quick start blank tab', async ({ page }) => {
|
|
42
|
+
const link = page.getByRole('link', { name: 'create-vue' });
|
|
40
43
|
|
|
41
|
-
await
|
|
42
|
-
await
|
|
44
|
+
await expect(link).toBeVisible();
|
|
45
|
+
const [popup] = await Promise.all([page.waitForEvent('popup'), link.evaluate((node: HTMLElement) => node.click())]);
|
|
46
|
+
|
|
47
|
+
await popup.waitForLoadState();
|
|
48
|
+
await expect(popup).toHaveTitle('Quick Start | Vue.js');
|
|
43
49
|
});
|
|
44
50
|
|
|
45
|
-
test('click Volar link open language-tools github blank tab', async ({ page
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
test('click Volar link open language-tools github blank tab', async ({ page }) => {
|
|
52
|
+
const link = page.getByRole('link', { name: 'Volar' });
|
|
53
|
+
|
|
54
|
+
await expect(link).toBeVisible();
|
|
55
|
+
const [popup] = await Promise.all([page.waitForEvent('popup'), link.evaluate((node: HTMLElement) => node.click())]);
|
|
48
56
|
|
|
49
|
-
await
|
|
50
|
-
await expect(
|
|
57
|
+
await popup.waitForLoadState();
|
|
58
|
+
await expect(popup).toHaveTitle(
|
|
51
59
|
'GitHub - vuejs/language-tools: ⚡ High-performance Vue language tooling based-on Volar.js',
|
|
52
60
|
);
|
|
53
61
|
});
|
package/template-vue/src/__tests__/unit/{components/home → pages/home/components}/HelloWorld.test.ts
RENAMED
|
@@ -5,7 +5,7 @@ import HelloWorld from '@/pages/home/components/HelloWorld.vue';
|
|
|
5
5
|
import i18n from '@/plugins/i18n';
|
|
6
6
|
import { useConfigStore } from '@/stores';
|
|
7
7
|
|
|
8
|
-
describe('HelloWorld component', () => {
|
|
8
|
+
describe('home page HelloWorld component', () => {
|
|
9
9
|
const { t } = i18n.global;
|
|
10
10
|
|
|
11
11
|
it('renders the correct content', () => {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { screen } from '@testing-library/vue';
|
|
2
|
+
import { renderComponent } from '@/__tests__/unit/render';
|
|
3
|
+
import Home from '@/pages/home/index.vue';
|
|
4
|
+
|
|
5
|
+
describe('home page', () => {
|
|
6
|
+
it('renders the correct content', () => {
|
|
7
|
+
renderComponent(Home);
|
|
8
|
+
const viteLink = screen.getByRole('link', { name: /vite logo/i });
|
|
9
|
+
const vueLink = screen.getByLabelText(/vue link/i);
|
|
10
|
+
|
|
11
|
+
expect(viteLink).toHaveAttribute('href', 'https://vitejs.dev');
|
|
12
|
+
expect(viteLink).toHaveAttribute('target', '_blank');
|
|
13
|
+
|
|
14
|
+
expect(vueLink).toHaveAttribute('href', 'https://vuejs.org/');
|
|
15
|
+
expect(vueLink).toHaveAttribute('target', '_blank');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './svg-icon';
|
package/template-vue/src/main.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { createPinia } from 'pinia';
|
|
2
|
-
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
|
|
3
1
|
import { createApp } from 'vue';
|
|
4
2
|
import i18NPlugin from '@/plugins/i18n';
|
|
5
3
|
|
|
6
4
|
import router from '@/router';
|
|
7
5
|
import App from './App.vue';
|
|
6
|
+
import { createPinia } from './stores';
|
|
8
7
|
import 'virtual:svg-icons-register';
|
|
9
8
|
import '@/styles/index.css';
|
|
10
9
|
|
|
@@ -14,10 +13,9 @@ if (import.meta.env.VITE_APP_MOCK === 'service-worker') {
|
|
|
14
13
|
worker.start();
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
const pinia = createPinia();
|
|
18
16
|
const app = createApp(App);
|
|
17
|
+
const pinia = createPinia();
|
|
19
18
|
|
|
20
|
-
pinia.use(piniaPluginPersistedstate);
|
|
21
19
|
app.use(pinia);
|
|
22
20
|
app.use(router);
|
|
23
21
|
app.use(i18NPlugin);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { SvgIcon } from '@/components/
|
|
2
|
+
import { SvgIcon } from '@/components/common';
|
|
3
3
|
import HelloWorld from './components/HelloWorld.vue';
|
|
4
4
|
</script>
|
|
5
5
|
|
|
@@ -18,6 +18,7 @@ import HelloWorld from './components/HelloWorld.vue';
|
|
|
18
18
|
<a
|
|
19
19
|
href="https://vuejs.org/"
|
|
20
20
|
target="_blank"
|
|
21
|
+
aria-label="Vue link"
|
|
21
22
|
>
|
|
22
23
|
<svg-icon
|
|
23
24
|
name="vue"
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
+
import messages from '@intlify/unplugin-vue-i18n/messages';
|
|
1
2
|
import { createI18n } from 'vue-i18n';
|
|
2
|
-
import enUS from '@/locales/en-US.json';
|
|
3
|
-
import zhTW from '@/locales/zh-TW.json';
|
|
4
3
|
|
|
5
4
|
const i18n = createI18n({
|
|
6
5
|
legacy: import.meta.env.MODE === 'test',
|
|
7
6
|
locale: navigator.language,
|
|
8
7
|
fallbackLocale: 'en-US',
|
|
9
|
-
messages
|
|
10
|
-
'zh-TW': zhTW,
|
|
11
|
-
'en-US': enUS,
|
|
12
|
-
},
|
|
8
|
+
messages,
|
|
13
9
|
});
|
|
14
10
|
|
|
15
11
|
export default i18n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const STORAGE_PREFIX = '{{projectName}}';
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createPinia as create } from 'pinia';
|
|
2
|
+
import { createPersistedState } from 'pinia-plugin-persistedstate';
|
|
3
|
+
import { STORAGE_PREFIX } from './constants';
|
|
4
|
+
export { useConfigStore } from './modules/config';
|
|
2
5
|
|
|
3
|
-
export
|
|
6
|
+
export function createPinia() {
|
|
7
|
+
const pinia = create();
|
|
8
|
+
const persistedState = createPersistedState({
|
|
9
|
+
key: storeKey => `${STORAGE_PREFIX}-${storeKey}`,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
pinia.use(persistedState);
|
|
13
|
+
|
|
14
|
+
return pinia;
|
|
15
|
+
}
|
|
@@ -7,11 +7,16 @@
|
|
|
7
7
|
color: rgba(255, 255, 255, 0.87);
|
|
8
8
|
background-color: #242424;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
overscroll-behavior: none none;
|
|
11
|
+
touch-action: manipulation;
|
|
12
|
+
user-select: none;
|
|
11
13
|
text-rendering: optimizeLegibility;
|
|
12
|
-
-webkit-font-smoothing: antialiased;
|
|
13
14
|
-moz-osx-font-smoothing: grayscale;
|
|
14
|
-
-
|
|
15
|
+
-moz-touch-callout: none;
|
|
16
|
+
-ms-touch-callout: none;
|
|
17
|
+
-webkit-font-smoothing: antialiased;
|
|
18
|
+
-webkit-touch-callout: none;
|
|
19
|
+
-webkit-overflow-scrolling: touch;
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
@media (prefers-color-scheme: light) {
|
|
@@ -29,6 +34,12 @@ body {
|
|
|
29
34
|
min-height: 100vh;
|
|
30
35
|
}
|
|
31
36
|
|
|
37
|
+
img {
|
|
38
|
+
-webkit-touch-callout: none;
|
|
39
|
+
-webkit-user-drag: none;
|
|
40
|
+
user-select: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
32
43
|
#app {
|
|
33
44
|
max-width: 80rem;
|
|
34
45
|
margin: auto;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "./tsconfig.app.json",
|
|
3
|
-
"exclude": [],
|
|
4
3
|
"compilerOptions": {
|
|
5
4
|
"composite": true,
|
|
6
|
-
"
|
|
7
|
-
|
|
5
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo",
|
|
6
|
+
"types": ["vitest/globals"]
|
|
7
|
+
},
|
|
8
|
+
"exclude": [],
|
|
9
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "vitest.setup.ts"]
|
|
8
10
|
}
|
|
@@ -27,7 +27,7 @@ export default defineConfig({
|
|
|
27
27
|
include: resolve(dirname(fileURLToPath(import.meta.url)), 'src/locales/**'),
|
|
28
28
|
}),
|
|
29
29
|
createSvgIconsPlugin({
|
|
30
|
-
iconDirs: [resolve(process.cwd(), 'src/assets/
|
|
30
|
+
iconDirs: [resolve(process.cwd(), 'src/assets/svg-icons')],
|
|
31
31
|
}),
|
|
32
32
|
visualizer({ gzipSize: true }),
|
|
33
33
|
],
|
|
@@ -44,6 +44,12 @@ export default defineConfig({
|
|
|
44
44
|
rollupOptions: {
|
|
45
45
|
output: {
|
|
46
46
|
chunkFileNames: 'chunks/[name]-[hash].js',
|
|
47
|
+
assetFileNames: 'assets/[name].[hash].[ext]',
|
|
48
|
+
entryFileNames: 'entries/[name].[hash].js',
|
|
49
|
+
manualChunks: {
|
|
50
|
+
core: ['vue', 'vue-router', 'pinia', 'pinia-plugin-persistedstate', 'vue-i18n'],
|
|
51
|
+
vender: ['axios', '@intlify/unplugin-vue-i18n/messages'],
|
|
52
|
+
},
|
|
47
53
|
},
|
|
48
54
|
},
|
|
49
55
|
},
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
import { fileURLToPath, URL } from 'node:url';
|
|
3
1
|
import { defineConfig, mergeConfig } from 'vitest/config';
|
|
4
2
|
import viteConfig from './vite.config';
|
|
5
3
|
|
|
@@ -10,8 +8,7 @@ export default mergeConfig(
|
|
|
10
8
|
globals: true,
|
|
11
9
|
environment: 'jsdom',
|
|
12
10
|
include: ['src/__tests__/unit/**/*.test.ts'],
|
|
13
|
-
|
|
14
|
-
setupFiles: ['src/__tests__/setup/unit-test.ts'],
|
|
11
|
+
setupFiles: ['./vitest.setup.ts'],
|
|
15
12
|
coverage: {
|
|
16
13
|
provider: 'v8',
|
|
17
14
|
include: ['!src/main.ts', 'src/**/*.ts', 'src/**/*.vue'],
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { cleanup } from '@testing-library/vue';
|
|
1
2
|
import { mswServer } from '@/mocks/server';
|
|
2
3
|
import '@testing-library/jest-dom';
|
|
3
4
|
|
|
4
5
|
beforeAll(() => mswServer.listen());
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
afterEach(() => {
|
|
8
|
+
cleanup();
|
|
9
|
+
mswServer.resetHandlers();
|
|
10
|
+
});
|
|
11
|
+
|
|
6
12
|
afterAll(() => mswServer.close());
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|