@component-hook/create-app 1.4.4 → 1.5.1
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/{template-shared/LICENSE → LICENSE} +1 -1
- package/README.md +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +110 -101
- package/package.json +3 -3
- package/template-react/.vscode/extensions.json +0 -9
- package/template-react/.vscode/settings.json +0 -18
- package/template-react/README.md.art +0 -84
- package/template-react/eslint.config.js +0 -18
- package/template-react/index.html.art +0 -13
- package/template-react/lint-staged.config.js +0 -6
- package/template-react/package.json +0 -69
- package/template-react/public/vite.svg +0 -1
- package/template-react/src/App.tsx +0 -6
- package/template-react/src/__tests__/e2e/home.spec.ts +0 -40
- package/template-react/src/__tests__/unit/pages/home/components/HelloWorld.test.tsx +0 -45
- package/template-react/src/__tests__/unit/pages/home/index.test.tsx +0 -19
- package/template-react/src/__tests__/unit/render/index.tsx +0 -15
- package/template-react/src/assets/svg-icons/react.svg +0 -1
- package/template-react/src/components/common/index.ts +0 -1
- package/template-react/src/components/common/svg-icon/index.ts +0 -1
- package/template-react/src/components/common/svg-icon/src/index.tsx +0 -23
- package/template-react/src/main.tsx +0 -26
- package/template-react/src/mocks/browser.ts +0 -4
- package/template-react/src/mocks/handlers/index.ts +0 -1
- package/template-react/src/mocks/server.ts +0 -4
- package/template-react/src/pages/home/components/hello-world/index.tsx +0 -49
- package/template-react/src/pages/home/index.module.css +0 -8
- package/template-react/src/pages/home/index.tsx +0 -37
- package/template-react/src/plugins/i18n/index.ts +0 -15
- package/template-react/src/plugins/i18n/locales/en-US.json +0 -3
- package/template-react/src/plugins/i18n/locales/zh-TW.json +0 -3
- package/template-react/src/router/index.tsx +0 -22
- package/template-react/src/stores/constants.ts +0 -1
- package/template-react/src/stores/index.ts +0 -1
- package/template-react/src/stores/middleware.ts +0 -17
- package/template-react/src/stores/modules/config.ts +0 -27
- package/template-react/src/styles/base.css +0 -68
- package/template-react/src/styles/common/all.css +0 -1
- package/template-react/src/styles/common/button.css +0 -26
- package/template-react/src/styles/index.css +0 -3
- package/template-react/src/styles/tailwind.css +0 -14
- package/template-react/src/vite-env.d.ts +0 -9
- package/template-react/tsconfig.app.json +0 -32
- package/template-react/tsconfig.vitest.json +0 -10
- package/template-react/vite.config.ts +0 -40
- package/template-react/vitest.config.ts +0 -18
- package/template-react/vitest.setup.ts +0 -13
- package/template-shared/.browserslistrc +0 -10
- package/template-shared/.github/actions/setup-environment/action.yml +0 -21
- package/template-shared/.github/renovate.json +0 -14
- package/template-shared/.github/workflows/ci.yml +0 -22
- package/template-shared/.github/workflows/deploy.yml +0 -27
- package/template-shared/.github/workflows/preview.yml +0 -17
- package/template-shared/.gitlab/setup.yml +0 -18
- package/template-shared/.husky/commit-msg +0 -1
- package/template-shared/.husky/pre-commit +0 -1
- package/template-shared/_gitignore +0 -32
- package/template-shared/_gitlab-ci.yml +0 -22
- package/template-shared/commitlint.config.js +0 -3
- package/template-shared/playwright.config.ts +0 -49
- package/template-shared/postcss.config.js +0 -15
- package/template-shared/prettier.config.js +0 -13
- package/template-shared/scripts/build-info/index.ts +0 -21
- package/template-shared/tsconfig.json +0 -14
- package/template-shared/tsconfig.node.json +0 -12
- package/template-vue/.vscode/extensions.json +0 -10
- package/template-vue/.vscode/settings.json +0 -18
- package/template-vue/README.md.art +0 -80
- package/template-vue/eslint.config.js +0 -18
- package/template-vue/index.html.art +0 -28
- package/template-vue/lint-staged.config.js +0 -6
- package/template-vue/package.json +0 -68
- package/template-vue/public/vite.svg +0 -1
- package/template-vue/src/App.vue +0 -7
- package/template-vue/src/__tests__/e2e/home.spec.ts +0 -61
- package/template-vue/src/__tests__/unit/pages/home/components/HelloWorld.test.ts +0 -57
- package/template-vue/src/__tests__/unit/pages/home/index.test.ts +0 -17
- package/template-vue/src/__tests__/unit/render/index.ts +0 -28
- package/template-vue/src/assets/svg-icons/vue.svg +0 -1
- package/template-vue/src/components/common/index.ts +0 -1
- package/template-vue/src/components/common/svg-icon/index.ts +0 -1
- package/template-vue/src/components/common/svg-icon/src/index.vue +0 -29
- package/template-vue/src/locales/en-US.json +0 -3
- package/template-vue/src/locales/zh-TW.json +0 -3
- package/template-vue/src/main.ts +0 -21
- package/template-vue/src/mocks/browser.ts +0 -4
- package/template-vue/src/mocks/handlers/index.ts +0 -1
- package/template-vue/src/mocks/server.ts +0 -4
- package/template-vue/src/pages/home/components/HelloWorld.vue +0 -54
- package/template-vue/src/pages/home/index.vue +0 -46
- package/template-vue/src/plugins/i18n.ts +0 -11
- package/template-vue/src/router/index.ts +0 -23
- package/template-vue/src/stores/constants.ts.art +0 -1
- package/template-vue/src/stores/index.ts +0 -15
- package/template-vue/src/stores/modules/config.ts +0 -20
- package/template-vue/src/styles/base.css +0 -59
- package/template-vue/src/styles/common/all.css +0 -1
- package/template-vue/src/styles/common/button.css +0 -15
- package/template-vue/src/styles/index.css +0 -3
- package/template-vue/src/styles/tailwind.css +0 -1
- package/template-vue/src/vite-env.d.ts +0 -9
- package/template-vue/tsconfig.app.json +0 -12
- package/template-vue/tsconfig.vitest.json +0 -10
- package/template-vue/vite.config.ts +0 -46
- package/template-vue/vitest.config.ts +0 -18
- package/template-vue/vitest.setup.ts +0 -12
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
name: Deploy to Production
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
paths:
|
|
7
|
-
- 'src/**'
|
|
8
|
-
- pnpm-lock.yaml
|
|
9
|
-
- package.json
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
CI:
|
|
13
|
-
uses: ./.github/workflows/ci.yml
|
|
14
|
-
|
|
15
|
-
deploy:
|
|
16
|
-
runs-on: ubuntu-latest
|
|
17
|
-
needs: CI
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v6
|
|
20
|
-
# - name: setup environment
|
|
21
|
-
# uses: './.github/actions/setup-environment'
|
|
22
|
-
|
|
23
|
-
# - name: build production
|
|
24
|
-
# run: pnpm build:production
|
|
25
|
-
|
|
26
|
-
# - name: deploy to production
|
|
27
|
-
# run: pnpm deploy
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
name: Preview Pull Request
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
types: [opened, synchronize, reopened]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
CI:
|
|
9
|
-
uses: ./.github/workflows/ci.yml
|
|
10
|
-
|
|
11
|
-
preview:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
needs: CI
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v6
|
|
16
|
-
# - name: setup environment
|
|
17
|
-
# uses: './.github/actions/setup-environment'
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
variables:
|
|
2
|
-
NODE_VERSION: '22'
|
|
3
|
-
CACHE_KEY: '${CI_PROJECT_PATH_SLUG}-${CI_COMMIT_REF_SLUG}'
|
|
4
|
-
|
|
5
|
-
image: node:${NODE_VERSION}-alpine
|
|
6
|
-
|
|
7
|
-
cache:
|
|
8
|
-
key: ${CACHE_KEY}
|
|
9
|
-
paths:
|
|
10
|
-
- .pnpm-store
|
|
11
|
-
- node_modules/
|
|
12
|
-
policy: pull-push
|
|
13
|
-
|
|
14
|
-
before_script:
|
|
15
|
-
- corepack enable
|
|
16
|
-
- corepack prepare --activate
|
|
17
|
-
- pnpm config set store-dir .pnpm-store
|
|
18
|
-
- pnpm install
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npx --no -- commitlint --edit ${1}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npx lint-staged
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
dist
|
|
12
|
-
dist-ssr
|
|
13
|
-
*.local
|
|
14
|
-
.env
|
|
15
|
-
|
|
16
|
-
# Editor directories and files
|
|
17
|
-
.idea
|
|
18
|
-
.DS_Store
|
|
19
|
-
*.suo
|
|
20
|
-
*.ntvs*
|
|
21
|
-
*.njsproj
|
|
22
|
-
*.sln
|
|
23
|
-
*.sw?
|
|
24
|
-
|
|
25
|
-
# Test reports
|
|
26
|
-
coverage
|
|
27
|
-
/test-results/
|
|
28
|
-
/playwright-report/
|
|
29
|
-
/playwright/.cache/
|
|
30
|
-
|
|
31
|
-
# Visualizer
|
|
32
|
-
stats.html
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
stages:
|
|
2
|
-
- test
|
|
3
|
-
# - deploy
|
|
4
|
-
|
|
5
|
-
include:
|
|
6
|
-
- local: .gitlab/setup.yml
|
|
7
|
-
|
|
8
|
-
run_test:
|
|
9
|
-
stage: test
|
|
10
|
-
image: mcr.microsoft.com/playwright:focal
|
|
11
|
-
script:
|
|
12
|
-
- npx playwright install --with-deps
|
|
13
|
-
- pnpm test:unit
|
|
14
|
-
- pnpm test:ci-e2e
|
|
15
|
-
rules:
|
|
16
|
-
- if: $CI_COMMIT_BRANCH
|
|
17
|
-
changes:
|
|
18
|
-
- 'src/**'
|
|
19
|
-
- pnpm-lock.yaml
|
|
20
|
-
- package.json
|
|
21
|
-
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
22
|
-
- when: manual
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { defineConfig, devices } from '@playwright/test';
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
testDir: './src/__tests__/e2e',
|
|
5
|
-
/* If gets stuck during the test, it will fail if it exceeds the timeout time. */
|
|
6
|
-
timeout: 30 * 1000,
|
|
7
|
-
fullyParallel: true,
|
|
8
|
-
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
9
|
-
forbidOnly: !!process.env.CI,
|
|
10
|
-
/* Retry on CI only */
|
|
11
|
-
retries: process.env.CI ? 2 : 0,
|
|
12
|
-
/* Opt out of parallel tests on CI. */
|
|
13
|
-
workers: process.env.CI ? 1 : undefined,
|
|
14
|
-
reporter: 'html',
|
|
15
|
-
use: {
|
|
16
|
-
baseURL: 'http://localhost:5173',
|
|
17
|
-
trace: 'on-first-retry',
|
|
18
|
-
},
|
|
19
|
-
webServer: {
|
|
20
|
-
command: 'pnpm dev:mock',
|
|
21
|
-
port: 5173,
|
|
22
|
-
reuseExistingServer: !process.env.CI,
|
|
23
|
-
},
|
|
24
|
-
projects: [
|
|
25
|
-
{
|
|
26
|
-
name: 'chromium',
|
|
27
|
-
use: {
|
|
28
|
-
browserName: 'chromium',
|
|
29
|
-
...devices['Macbook Pro'],
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
name: 'firefox',
|
|
35
|
-
use: {
|
|
36
|
-
browserName: 'firefox',
|
|
37
|
-
...devices['Macbook 11'],
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
name: 'webkit',
|
|
43
|
-
use: {
|
|
44
|
-
browserName: 'webkit',
|
|
45
|
-
...devices['iPhone SE'],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import cssnano from 'cssnano';
|
|
2
|
-
import postcssPresetEnv from 'postcss-preset-env';
|
|
3
|
-
import postcssPxtorem from 'postcss-pxtorem';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
plugins: [
|
|
7
|
-
postcssPresetEnv({ stage: 3 }),
|
|
8
|
-
postcssPxtorem({
|
|
9
|
-
rootValue: 16,
|
|
10
|
-
propList: ['*'],
|
|
11
|
-
selectorBlackList: ['norem'],
|
|
12
|
-
}),
|
|
13
|
-
...(process.env.NODE_ENV === 'production' ? [cssnano({ preset: 'default' })] : []),
|
|
14
|
-
],
|
|
15
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** @type {import('prettier').RequiredOptions} */
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
$schema: 'https://json.schemastore.org/prettierrc',
|
|
5
|
-
singleQuote: true,
|
|
6
|
-
semi: true,
|
|
7
|
-
endOfLine: 'lf',
|
|
8
|
-
printWidth: 120,
|
|
9
|
-
proseWrap: 'preserve',
|
|
10
|
-
arrowParens: 'avoid',
|
|
11
|
-
singleAttributePerLine: true,
|
|
12
|
-
plugins: ['prettier-plugin-tailwindcss'],
|
|
13
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from 'node:child_process';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import packageJson from '../../package.json' with { type: 'json' };
|
|
4
|
-
|
|
5
|
-
const platform = os.platform();
|
|
6
|
-
const git = platform === 'win32' ? String.raw`C:\Program Files\Git\bin\git.exe` : '/usr/bin/git';
|
|
7
|
-
let hash = 'unknown';
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
hash = execFileSync(git, ['rev-parse', 'HEAD']).toString().trim().slice(0, 7);
|
|
11
|
-
} catch {
|
|
12
|
-
hash = 'no-git-detected';
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
process.env.VITE_APP_VERSION = packageJson.version;
|
|
16
|
-
process.env.VITE_APP_LAST_COMMIT_HASH = hash;
|
|
17
|
-
process.env.VITE_APP_BUILD_EPOCH = Date.now().toString();
|
|
18
|
-
|
|
19
|
-
if (process.env.MOCK) {
|
|
20
|
-
process.env.VITE_APP_MOCK = 'service-worker';
|
|
21
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@tsconfig/node24/tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"composite": true,
|
|
5
|
-
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"moduleResolution": "bundler",
|
|
8
|
-
"types": ["node"],
|
|
9
|
-
"noEmit": true
|
|
10
|
-
},
|
|
11
|
-
"include": ["vite.config.ts", "package.json", "vitest.config.ts", "playwright.config.ts", "scripts/**/*.ts"]
|
|
12
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"editor.tabSize": 2,
|
|
3
|
-
"editor.formatOnSave": true,
|
|
4
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
5
|
-
|
|
6
|
-
"[json]": {
|
|
7
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
"debug.javascript.autoAttachFilter": "smart",
|
|
11
|
-
|
|
12
|
-
"typescript.tsdk": "node_modules/typescript/lib",
|
|
13
|
-
|
|
14
|
-
"workbench.editor.splitInGroupLayout": "vertical",
|
|
15
|
-
"terminal.integrated.shellIntegration.enabled": true,
|
|
16
|
-
|
|
17
|
-
"cSpell.words": ["dotenv", "pinia", "persistedstate", "unplugin", "Sonarjs", "typecheck", "pxtorem", "norem"]
|
|
18
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
This project is built with [vue3](https://vuejs.org/) + [vite](https://vite.dev/), using [pnpm](https://pnpm.io/) for package management and [pinia](https://pinia.vuejs.org/) for state management.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Development Experience**: Written in [typeScript](https://www.typescriptlang.org/), styled with [tailwindcss](https://tailwindcss.com/), and structured with [vue-router](https://router.vuejs.org/), and [vue-i18n](https://vue-i18n.intlify.dev/). Supports SVGs ([vite-plugin-svg-icons](https://github.com/vbenjs/vite-plugin-svg-icons)).
|
|
8
|
-
- **API & Mocking**: Handles requests with [axios](https://axios-http.com/docs/intro) and mocks APIs using [msw](https://mswjs.io/).
|
|
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
|
-
- **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/), 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
|
-
{{ciContent}}
|
|
13
|
-
|
|
14
|
-
## Code Features / Opinions
|
|
15
|
-
|
|
16
|
-
- Project root aliased as `@` to `<project_root>/src`
|
|
17
|
-
- Store persistedstate use [pinia-plugin-persistedstate](https://www.npmjs.com/package/pinia-plugin-persistedstate)
|
|
18
|
-
- ESlint plugin use [@component-hook/eslint-plugin](https://www.npmjs.com/package/@component-hook/eslint-plugin?activeTab=readme)
|
|
19
|
-
- if encounter npx: command not found, can execute `ln -s $(which npx) /usr/local/bin/npx` in zsh
|
|
20
|
-
- Predefined and fully typed global variables:
|
|
21
|
-
- `VITE_APP_VERSION` is read from `package.json` version at build time
|
|
22
|
-
- `VITE_APP_LAST_COMMIT_HASH` is last commit hash at build time
|
|
23
|
-
- `VITE_APP_BUILD_EPOCH` is populated as `Date.now()` at build time
|
|
24
|
-
- `VITE_APP_MOCK` is use mock environment
|
|
25
|
-
|
|
26
|
-
## Project Files
|
|
27
|
-
|
|
28
|
-
```text
|
|
29
|
-
src/
|
|
30
|
-
├── __tests__/
|
|
31
|
-
│ ├── __mocks__/
|
|
32
|
-
│ ├── e2e/*
|
|
33
|
-
│ └── unit/*
|
|
34
|
-
├── assets/*
|
|
35
|
-
│ └── svg-icons
|
|
36
|
-
│ └── vue.svg
|
|
37
|
-
├── components/
|
|
38
|
-
│ └── common
|
|
39
|
-
│ ├── svg-icon/
|
|
40
|
-
│ │ ├── src
|
|
41
|
-
│ │ │ └── index.vue
|
|
42
|
-
│ │ └── index.ts
|
|
43
|
-
│ └── index.ts
|
|
44
|
-
├── constants/*
|
|
45
|
-
├── hooks/*
|
|
46
|
-
├── locales/
|
|
47
|
-
│ ├── en-US.json
|
|
48
|
-
│ └── zh-CN.json
|
|
49
|
-
├── mocks/
|
|
50
|
-
│ ├── handlers/*
|
|
51
|
-
│ │ ├── modules/*
|
|
52
|
-
│ │ └── index.ts
|
|
53
|
-
│ │── browser.ts
|
|
54
|
-
│ └── server.ts
|
|
55
|
-
├── pages/
|
|
56
|
-
│ └── home/
|
|
57
|
-
│ ├── components
|
|
58
|
-
│ │ └── HelloWorld.vue
|
|
59
|
-
│ └── index.vue
|
|
60
|
-
├── plugins/
|
|
61
|
-
│ └── i18n.ts
|
|
62
|
-
├── router/
|
|
63
|
-
│ └── index.ts
|
|
64
|
-
├── stores/
|
|
65
|
-
│ ├── modules
|
|
66
|
-
│ │ └── config.ts
|
|
67
|
-
│ └── index.ts
|
|
68
|
-
├── styles/
|
|
69
|
-
│ ├── common/
|
|
70
|
-
| │ ├── all.css
|
|
71
|
-
| │ └── button.css
|
|
72
|
-
│ ├── base.css
|
|
73
|
-
│ ├── index.css
|
|
74
|
-
│ └── tailwind.css
|
|
75
|
-
├── types/*
|
|
76
|
-
├── utils/*
|
|
77
|
-
├── App.vue
|
|
78
|
-
├── vite-env.d.ts
|
|
79
|
-
└── main.ts
|
|
80
|
-
```
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import componentHookPlugin from '@component-hook/eslint-plugin';
|
|
2
|
-
|
|
3
|
-
export default [
|
|
4
|
-
...componentHookPlugin.configs.basic,
|
|
5
|
-
...componentHookPlugin.configs.vue,
|
|
6
|
-
componentHookPlugin.configs.prettier,
|
|
7
|
-
...componentHookPlugin.configs.sonarjs,
|
|
8
|
-
componentHookPlugin.configs.security,
|
|
9
|
-
...componentHookPlugin.configs.markdown,
|
|
10
|
-
{
|
|
11
|
-
files: ['**/__tests__/unit/**/*.test.[jt]s?(x)'],
|
|
12
|
-
...componentHookPlugin.configs['testing-library/vue'],
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
files: ['**/__tests__/e2e/**/*.spec.[jt]s?(x)'],
|
|
16
|
-
...componentHookPlugin.configs.playwright,
|
|
17
|
-
},
|
|
18
|
-
];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link
|
|
6
|
-
rel="icon"
|
|
7
|
-
type="image/svg+xml"
|
|
8
|
-
href="/vite.svg"
|
|
9
|
-
/>
|
|
10
|
-
<meta
|
|
11
|
-
name="viewport"
|
|
12
|
-
content="width=device-width, initial-scale=1.0"
|
|
13
|
-
/>
|
|
14
|
-
<title>{{projectName}}</title>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<div id="app"></div>
|
|
18
|
-
<script
|
|
19
|
-
type="module"
|
|
20
|
-
src="/src/main.ts"
|
|
21
|
-
></script>
|
|
22
|
-
<noscript>
|
|
23
|
-
<h1>Opinionated, production ready template for Vite and Vue 3</h1>
|
|
24
|
-
|
|
25
|
-
<p>This site requires JavaScript to work.</p>
|
|
26
|
-
</noscript>
|
|
27
|
-
</body>
|
|
28
|
-
</html>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vue-starter",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"private": true,
|
|
6
|
-
"packageManager": "pnpm@10.29.2",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"dev": "vite",
|
|
9
|
-
"dev:mock": "MOCK=true vite",
|
|
10
|
-
"build": "pnpm typecheck && vite build",
|
|
11
|
-
"lint": "eslint --fix .",
|
|
12
|
-
"test:unit": "vitest --coverage",
|
|
13
|
-
"test:e2e": "playwright test --headed",
|
|
14
|
-
"test:ui-e2e": "playwright test --ui",
|
|
15
|
-
"test:ci-e2e": "playwright test",
|
|
16
|
-
"typecheck": "vue-tsc --noEmit",
|
|
17
|
-
"prepare": "husky",
|
|
18
|
-
"preview": "vite preview"
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"axios": "^1.13.5",
|
|
22
|
-
"pinia": "^3.0.4",
|
|
23
|
-
"pinia-plugin-persistedstate": "^4.7.1",
|
|
24
|
-
"vue": "^3.5.28",
|
|
25
|
-
"vue-i18n": "^11.1.12",
|
|
26
|
-
"vue-router": "^5.0.2"
|
|
27
|
-
},
|
|
28
|
-
"optionalDependencies": {
|
|
29
|
-
"@commitlint/cli": "^20.4.1",
|
|
30
|
-
"@commitlint/config-conventional": "^20.4.1",
|
|
31
|
-
"husky": "^9.1.7",
|
|
32
|
-
"lint-staged": "^16.2.7"
|
|
33
|
-
},
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"@component-hook/eslint-plugin": "^1.4.2",
|
|
36
|
-
"@intlify/unplugin-vue-i18n": "^11.0.3",
|
|
37
|
-
"@playwright/test": "^1.58.2",
|
|
38
|
-
"@tailwindcss/vite": "^4.1.18",
|
|
39
|
-
"@testing-library/jest-dom": "^6.9.1",
|
|
40
|
-
"@testing-library/user-event": "^14.6.1",
|
|
41
|
-
"@testing-library/vue": "^8.1.0",
|
|
42
|
-
"@tsconfig/node24": "^24.0.4",
|
|
43
|
-
"@types/node": "^22.19.11",
|
|
44
|
-
"@vitejs/plugin-vue": "^6.0.4",
|
|
45
|
-
"@vitest/coverage-v8": "^4.0.18",
|
|
46
|
-
"@vue/tsconfig": "^0.8.1",
|
|
47
|
-
"cssnano": "^7.1.2",
|
|
48
|
-
"eslint": "^9.39.2",
|
|
49
|
-
"fast-glob": "^3.3.3",
|
|
50
|
-
"jsdom": "^28.1.0",
|
|
51
|
-
"msw": "^2.12.10",
|
|
52
|
-
"postcss": "^8.5.6",
|
|
53
|
-
"postcss-preset-env": "^11.1.3",
|
|
54
|
-
"postcss-pxtorem": "^6.1.0",
|
|
55
|
-
"prettier": "^3.8.1",
|
|
56
|
-
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
57
|
-
"rollup-plugin-visualizer": "^6.0.5",
|
|
58
|
-
"tailwindcss": "^4.1.18",
|
|
59
|
-
"typescript": "^5.9.3",
|
|
60
|
-
"vite": "^7.3.1",
|
|
61
|
-
"vite-plugin-svg-icons": "^2.0.1",
|
|
62
|
-
"vitest": "^4.0.18",
|
|
63
|
-
"vue-tsc": "^3.2.4"
|
|
64
|
-
},
|
|
65
|
-
"msw": {
|
|
66
|
-
"workerDirectory": "public"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/template-vue/src/App.vue
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { expect, test } from '@playwright/test';
|
|
2
|
-
|
|
3
|
-
test.beforeEach(async ({ page }) => {
|
|
4
|
-
await page.goto('/');
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test('click Vite logo open Vite official website blank tab', async ({ page }) => {
|
|
8
|
-
const link = page.getByRole('link', { name: /vite logo/i });
|
|
9
|
-
|
|
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');
|
|
15
|
-
});
|
|
16
|
-
|
|
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())]);
|
|
22
|
-
|
|
23
|
-
await popup.waitForLoadState();
|
|
24
|
-
await expect(popup).toHaveTitle('Vue.js - The Progressive JavaScript Framework | Vue.js');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('homepage count button interact', async ({ page }) => {
|
|
28
|
-
await page.getByRole('button', { name: 'count is 0' }).click();
|
|
29
|
-
await expect(page.getByRole('button', { name: 'count is 1' })).toBeVisible();
|
|
30
|
-
await page.getByRole('button', { name: 'count is 1' }).click();
|
|
31
|
-
await expect(page.getByRole('button', { name: 'count is 2' })).toBeVisible();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('locale change interact', async ({ page }) => {
|
|
35
|
-
await page.getByRole('button', { name: 'English' }).click();
|
|
36
|
-
await expect(page.getByRole('button', { name: '中文' })).toBeVisible();
|
|
37
|
-
await page.getByRole('button', { name: '中文' }).click();
|
|
38
|
-
await expect(page.getByRole('button', { name: 'English' })).toBeVisible();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('click create-vue link open Vue quick start blank tab', async ({ page }) => {
|
|
42
|
-
const link = page.getByRole('link', { name: 'create-vue' });
|
|
43
|
-
|
|
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');
|
|
49
|
-
});
|
|
50
|
-
|
|
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())]);
|
|
56
|
-
|
|
57
|
-
await popup.waitForLoadState();
|
|
58
|
-
await expect(popup).toHaveTitle(
|
|
59
|
-
'GitHub - vuejs/language-tools: ⚡ High-performance Vue language tooling based-on Volar.js',
|
|
60
|
-
);
|
|
61
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import userEvent from '@testing-library/user-event';
|
|
2
|
-
import { screen } from '@testing-library/vue';
|
|
3
|
-
import { renderComponent } from '@/__tests__/unit/render';
|
|
4
|
-
import HelloWorld from '@/pages/home/components/HelloWorld.vue';
|
|
5
|
-
import i18n from '@/plugins/i18n';
|
|
6
|
-
import { useConfigStore } from '@/stores';
|
|
7
|
-
|
|
8
|
-
describe('home page HelloWorld component', () => {
|
|
9
|
-
const { t } = i18n.global;
|
|
10
|
-
|
|
11
|
-
it('renders the correct content', () => {
|
|
12
|
-
const msg = 'Hello World!';
|
|
13
|
-
const { version } = useConfigStore();
|
|
14
|
-
|
|
15
|
-
renderComponent(HelloWorld, { props: { msg } });
|
|
16
|
-
expect(screen.getByRole('heading', { name: msg })).toBeInTheDocument();
|
|
17
|
-
expect(screen.getByRole('button', { name: /count is 0/i })).toBeInTheDocument();
|
|
18
|
-
expect(screen.getByText(/check out , the official vue \+ vite starter/i)).toBeInTheDocument();
|
|
19
|
-
expect(screen.getByRole('link', { name: /create-vue/i })).toBeInTheDocument();
|
|
20
|
-
expect(screen.getByText(/install in your ide for a better dx/i)).toBeInTheDocument();
|
|
21
|
-
expect(screen.getByRole('link', { name: /volar/i })).toBeInTheDocument();
|
|
22
|
-
expect(screen.getByText(/click on the vite and vue logos to learn more/i)).toBeInTheDocument();
|
|
23
|
-
expect(screen.getByText(version)).toBeInTheDocument();
|
|
24
|
-
expect(screen.getByRole('button', { name: t('language') })).toBeInTheDocument();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('count button interact', async () => {
|
|
28
|
-
renderComponent(HelloWorld, { props: { msg: '' } });
|
|
29
|
-
const countButton = screen.getByRole('button', { name: /count is 0/i });
|
|
30
|
-
|
|
31
|
-
await userEvent.click(countButton);
|
|
32
|
-
expect(countButton).toHaveTextContent(/count is 1/i);
|
|
33
|
-
await userEvent.click(countButton);
|
|
34
|
-
await userEvent.click(countButton);
|
|
35
|
-
expect(countButton).toHaveTextContent(/count is 3/i);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('link correct attribute', () => {
|
|
39
|
-
renderComponent(HelloWorld, { props: { msg: '' } });
|
|
40
|
-
const createVueLink = screen.getByRole('link', { name: /create-vue/i });
|
|
41
|
-
const volarLink = screen.getByRole('link', { name: /volar/i });
|
|
42
|
-
|
|
43
|
-
expect(createVueLink).toHaveAttribute('href', 'https://vuejs.org/guide/quick-start.html#local');
|
|
44
|
-
expect(createVueLink).toHaveAttribute('target', '_blank');
|
|
45
|
-
expect(volarLink).toHaveAttribute('href', 'https://github.com/vuejs/language-tools');
|
|
46
|
-
expect(volarLink).toHaveAttribute('target', '_blank');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('locale change interact', async () => {
|
|
50
|
-
renderComponent(HelloWorld, { props: { msg: '' } });
|
|
51
|
-
const localeButton = screen.getByRole('button', { name: t('language') });
|
|
52
|
-
|
|
53
|
-
expect(localeButton).toHaveTextContent('English');
|
|
54
|
-
await userEvent.click(localeButton);
|
|
55
|
-
expect(localeButton).toHaveTextContent('中文');
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
});
|