@component-hook/create-app 0.2.4-alpha.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/bin/index.js +3 -0
- package/dist/index.mjs +105 -0
- package/package.json +46 -0
- package/template-vue/.github/actions/setup-environment/action.yml +45 -0
- package/template-vue/.github/renovate.json +12 -0
- package/template-vue/.github/workflows/ci.yml +22 -0
- package/template-vue/.github/workflows/deploy.yml +27 -0
- package/template-vue/.github/workflows/preview.yml +17 -0
- package/template-vue/.gitlab/setup.yml +18 -0
- package/template-vue/.husky/commit-msg +3 -0
- package/template-vue/.husky/pre-commit +3 -0
- package/template-vue/.vscode/extensions.json +10 -0
- package/template-vue/.vscode/settings.json +27 -0
- package/template-vue/LICENSE +21 -0
- package/template-vue/README.md.art +100 -0
- package/template-vue/_gitignore +38 -0
- package/template-vue/_gitlab-ci.yml +22 -0
- package/template-vue/commitlint.config.js +3 -0
- package/template-vue/eslint.config.js +18 -0
- package/template-vue/index.html.art +26 -0
- package/template-vue/lint-staged.config.js +4 -0
- package/template-vue/package.json +73 -0
- package/template-vue/playwright.config.ts +60 -0
- package/template-vue/postcss.config.js +14 -0
- package/template-vue/prettier.config.js +11 -0
- package/template-vue/public/mockServiceWorker.js +307 -0
- package/template-vue/public/vite.svg +1 -0
- package/template-vue/src/App.vue +7 -0
- package/template-vue/src/__tests__/e2e/IndexPage.spec.ts +49 -0
- package/template-vue/src/__tests__/setup/unit-test.ts +6 -0
- package/template-vue/src/__tests__/unit/components/indexPage/HelloWorld.test.ts +57 -0
- package/template-vue/src/__tests__/unit/render/index.ts +28 -0
- package/template-vue/src/assets/images/svgIcons/vue.svg +1 -0
- package/template-vue/src/components/common/SvgIcon.vue +29 -0
- package/template-vue/src/components/indexPage/HelloWorld.vue +59 -0
- package/template-vue/src/components.d.ts +14 -0
- package/template-vue/src/locales/en-US.json +3 -0
- package/template-vue/src/locales/zh-TW.json +3 -0
- package/template-vue/src/main.ts +25 -0
- package/template-vue/src/mocks/browser.ts +4 -0
- package/template-vue/src/mocks/handlers/index.ts +1 -0
- package/template-vue/src/mocks/server.ts +4 -0
- package/template-vue/src/pages/IndexPage.vue +34 -0
- package/template-vue/src/plugins/i18n.ts +15 -0
- package/template-vue/src/router/index.ts +23 -0
- package/template-vue/src/stores/index.ts +3 -0
- package/template-vue/src/stores/modules/config.ts +20 -0
- package/template-vue/src/styles/common/all.postcss +1 -0
- package/template-vue/src/styles/common/button.postcss +12 -0
- package/template-vue/src/styles/index.postcss +1 -0
- package/template-vue/src/styles/tailwind.postcss +39 -0
- package/template-vue/src/vite-env.d.ts +12 -0
- package/template-vue/tailwind.config.js +20 -0
- package/template-vue/tsconfig.app.json +13 -0
- package/template-vue/tsconfig.json +14 -0
- package/template-vue/tsconfig.node.json +12 -0
- package/template-vue/tsconfig.vitest.json +8 -0
- package/template-vue/vite.config.ts +49 -0
- package/template-vue/vitest.config.ts +21 -0
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@component-hook/create-app",
|
|
3
|
+
"version": "0.2.4-alpha.0",
|
|
4
|
+
"description": "Scaffolding a basic typescript project",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Tzuyi",
|
|
8
|
+
"bin": {
|
|
9
|
+
"create-component-hook": "bin/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin",
|
|
13
|
+
"template-*",
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/tzuyi0817/component-hook.git",
|
|
22
|
+
"directory": "packages/create-app"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/tzuyi0817/component-hook/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/tzuyi0817/component-hook/tree/master/packages/create-app#readme",
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/fs-extra": "^11.0.4",
|
|
30
|
+
"@types/minimist": "^1.2.5",
|
|
31
|
+
"@types/prompts": "^2.4.9",
|
|
32
|
+
"art-template": "^4.13.2",
|
|
33
|
+
"cross-spawn": "^7.0.6",
|
|
34
|
+
"fs-extra": "^11.2.0",
|
|
35
|
+
"minimist": "^1.2.8",
|
|
36
|
+
"ora": "^8.1.1",
|
|
37
|
+
"picocolors": "^1.1.1",
|
|
38
|
+
"prompts": "^2.4.2",
|
|
39
|
+
"unbuild": "^3.2.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"dev": "unbuild --stub",
|
|
43
|
+
"build": "unbuild",
|
|
44
|
+
"typecheck": "tsc --noEmit"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Setup environment
|
|
2
|
+
|
|
3
|
+
description: Install dependencies
|
|
4
|
+
|
|
5
|
+
runs:
|
|
6
|
+
using: composite
|
|
7
|
+
steps:
|
|
8
|
+
- name: install Node.js
|
|
9
|
+
uses: actions/setup-node@v4
|
|
10
|
+
with:
|
|
11
|
+
node-version: 20
|
|
12
|
+
|
|
13
|
+
- name: install pnpm
|
|
14
|
+
uses: pnpm/action-setup@v4
|
|
15
|
+
with:
|
|
16
|
+
run_install: false
|
|
17
|
+
|
|
18
|
+
- name: get pnpm store directory
|
|
19
|
+
id: pnpm-cache
|
|
20
|
+
shell: bash
|
|
21
|
+
run: |
|
|
22
|
+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
|
23
|
+
|
|
24
|
+
- name: setup pnpm cache
|
|
25
|
+
uses: actions/cache@v4
|
|
26
|
+
with:
|
|
27
|
+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
|
28
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
29
|
+
restore-keys: |
|
|
30
|
+
${{ runner.os }}-pnpm-store-
|
|
31
|
+
|
|
32
|
+
- name: setup node_modules cache
|
|
33
|
+
id: dependencies-cache
|
|
34
|
+
uses: actions/cache@v4
|
|
35
|
+
with:
|
|
36
|
+
path: |
|
|
37
|
+
**/node_modules
|
|
38
|
+
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
39
|
+
restore-keys: |
|
|
40
|
+
${{ runner.os }}-node-modules-
|
|
41
|
+
|
|
42
|
+
- name: install dependencies
|
|
43
|
+
if: steps.dependencies-cache.outputs.cache-hit != 'true'
|
|
44
|
+
shell: bash
|
|
45
|
+
run: pnpm install
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
+
"extends": ["config:base", "group:allNonMajor", "schedule:weekly", ":semanticCommitTypeAll(chore)"],
|
|
4
|
+
"labels": ["dependencies"],
|
|
5
|
+
"rangeStrategy": "bump",
|
|
6
|
+
"packageRules": [
|
|
7
|
+
{
|
|
8
|
+
"depTypeList": ["peerDependencies"],
|
|
9
|
+
"enabled": false
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: CI Pipeline
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_call:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
CI:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- name: setup environment
|
|
13
|
+
uses: './.github/actions/setup-environment'
|
|
14
|
+
|
|
15
|
+
- name: install Playwright browsers
|
|
16
|
+
run: npx playwright install --with-deps
|
|
17
|
+
|
|
18
|
+
- name: run unit test
|
|
19
|
+
run: pnpm test:unit
|
|
20
|
+
|
|
21
|
+
- name: run e2e test
|
|
22
|
+
run: pnpm test:ci-e2e
|
|
@@ -0,0 +1,27 @@
|
|
|
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@v4
|
|
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
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: Prewiew 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@v4
|
|
16
|
+
# - name: setup environment
|
|
17
|
+
# uses: './.github/actions/setup-environment'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
variables:
|
|
2
|
+
NODE_VERSION: '20'
|
|
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
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"[nginx]": {
|
|
3
|
+
"editor.defaultFormatter": "raynigon.nginx-formatter"
|
|
4
|
+
},
|
|
5
|
+
"editor.tabSize": 2,
|
|
6
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
7
|
+
"debug.javascript.autoAttachFilter": "smart",
|
|
8
|
+
"editor.formatOnSave": true,
|
|
9
|
+
"[dart]": {
|
|
10
|
+
"editor.formatOnSave": true,
|
|
11
|
+
"editor.formatOnType": true,
|
|
12
|
+
"editor.rulers": [120],
|
|
13
|
+
"editor.selectionHighlight": false,
|
|
14
|
+
"editor.suggest.snippetsPreventQuickSuggestions": false,
|
|
15
|
+
"editor.suggestSelection": "first",
|
|
16
|
+
"editor.tabCompletion": "onlySnippets",
|
|
17
|
+
"editor.wordBasedSuggestions": "off"
|
|
18
|
+
},
|
|
19
|
+
"workbench.editor.splitInGroupLayout": "vertical",
|
|
20
|
+
"terminal.integrated.shellIntegration.enabled": true,
|
|
21
|
+
"volar.format.initialIndent": {
|
|
22
|
+
"html": true
|
|
23
|
+
},
|
|
24
|
+
"files.associations": {},
|
|
25
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
26
|
+
"cSpell.words": ["dotenv", "pinia", "persistedstate", "unplugin", "Sonarjs", "typecheck"]
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
## Features
|
|
4
|
+
|
|
5
|
+
- Vue 3
|
|
6
|
+
- Pnpm 9
|
|
7
|
+
- Vite 5
|
|
8
|
+
- [Pinia](https://pinia.vuejs.org/) store
|
|
9
|
+
- [pinia-plugin-persistedstate](https://www.npmjs.com/package/pinia-plugin-persistedstate)
|
|
10
|
+
- Routing using [vue-router 4](https://router.vuejs.org/)
|
|
11
|
+
- TypeScript 5
|
|
12
|
+
- Axios
|
|
13
|
+
- Tailwind CSS 3
|
|
14
|
+
- Vue-i18n 9
|
|
15
|
+
- PostCSS 8 w/ `postcss-nesting` plugin
|
|
16
|
+
- [Cssnano](https://cssnano.github.io/cssnano/) for minimizing production CSS
|
|
17
|
+
- [Postcss-pxtorem](https://www.npmjs.com/package/postcss-pxtorem) generates rem units from pixel units
|
|
18
|
+
- [Vite-plugin-svg-icons](https://github.com/vbenjs/vite-plugin-svg-icons) generate svg sprite map
|
|
19
|
+
- [Unplugin-vue-components](https://www.npmjs.com/package/unplugin-vue-components) auto importing for common components
|
|
20
|
+
- Eslint
|
|
21
|
+
- [@component-hook/eslint-plugin](https://www.npmjs.com/package/@component-hook/eslint-plugin?activeTab=readme)
|
|
22
|
+
- Prettier
|
|
23
|
+
- [Husky](https://www.npmjs.com/package/husky) to improves commits
|
|
24
|
+
- if encounter npx: command not found, can execute `ln -s $(which npx) /usr/local/bin/npx` in zsh
|
|
25
|
+
- [commitlint](https://commitlint.js.org/#/) checks if your commit messages meet the conventional commit format
|
|
26
|
+
- [lint-staged](https://github.com/okonet/lint-staged) filter files checked by pre commit lint
|
|
27
|
+
- Alias `@` to `<project_root>/src`
|
|
28
|
+
- Mock use [msw](https://mswjs.io/)
|
|
29
|
+
- `npx msw init ./public`
|
|
30
|
+
- Unit test use [Vitest](https://vitest.dev/) + [Testing Library](https://testing-library.com/)
|
|
31
|
+
- [jsdom](https://www.npmjs.com/package/jsdom)
|
|
32
|
+
- [@vitest/coverage-v8](https://vitest.dev/guide/coverage.html)
|
|
33
|
+
- [@testing-library/jest-dom](https://testing-library.com/docs/ecosystem-jest-dom/)
|
|
34
|
+
- [@testing-library/vue](https://testing-library.com/docs/vue-testing-library/intro/)
|
|
35
|
+
- [@testing-library/user-event](https://testing-library.com/docs/ecosystem-user-event/)
|
|
36
|
+
- E2E test use [playwright](https://playwright.dev/)
|
|
37
|
+
- [Rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer) visualize and analyze your Rollup bundle to see which modules are taking up space
|
|
38
|
+
- Predefined and fully typed global variables:
|
|
39
|
+
- `VITE_APP_VERSION` is read from `package.json` version at build time
|
|
40
|
+
- `VITE_APP_BUILD_EPOCH` is populated as `new Date().getTime()` at build time
|
|
41
|
+
- Github workflows
|
|
42
|
+
- ci - on workflow call and dispatch
|
|
43
|
+
- deploy - on push main branch
|
|
44
|
+
- preview - on pull request
|
|
45
|
+
- Gitlab CI
|
|
46
|
+
- run tests - on branches, merge request and manual
|
|
47
|
+
|
|
48
|
+
## Project Files
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
src/
|
|
52
|
+
├── __tests__/
|
|
53
|
+
│ ├── __mocks__/
|
|
54
|
+
│ ├── setup/
|
|
55
|
+
│ │ └── unitTest.ts
|
|
56
|
+
│ ├── e2e/*
|
|
57
|
+
│ └── unit/*
|
|
58
|
+
├── apis/*
|
|
59
|
+
├── assets/*
|
|
60
|
+
│ └── images/
|
|
61
|
+
│ └── svgIcons
|
|
62
|
+
│ └── vue.svg
|
|
63
|
+
├── components/
|
|
64
|
+
│ ├── common/
|
|
65
|
+
│ │ └── SvgIcon.vue
|
|
66
|
+
│ └── indexPage/
|
|
67
|
+
│ └── HelloWorld.vue
|
|
68
|
+
├── configs/*
|
|
69
|
+
├── hooks/*
|
|
70
|
+
├── locales/
|
|
71
|
+
│ ├── en-US.json
|
|
72
|
+
│ └── zh-CN.json
|
|
73
|
+
├── mocks/
|
|
74
|
+
│ ├── handlers/*
|
|
75
|
+
│ │ ├── apis/*
|
|
76
|
+
│ │ └── index.ts
|
|
77
|
+
│ │── browser.ts
|
|
78
|
+
│ └── server.ts
|
|
79
|
+
├── pages/
|
|
80
|
+
│ └── IndexPage.vue
|
|
81
|
+
├── plugins/
|
|
82
|
+
│ └── i18n.ts
|
|
83
|
+
├── router/
|
|
84
|
+
│ └── index.ts
|
|
85
|
+
├── stores/
|
|
86
|
+
│ ├── modules
|
|
87
|
+
│ │ └── config.ts
|
|
88
|
+
│ └── index.ts
|
|
89
|
+
├── styles/
|
|
90
|
+
│ ├── common/
|
|
91
|
+
| │ ├── all.postcss
|
|
92
|
+
| │ └── button.postcss
|
|
93
|
+
│ ├── index.postcss
|
|
94
|
+
│ └── tailwind.postcss
|
|
95
|
+
├── types/*
|
|
96
|
+
├── utils/*
|
|
97
|
+
├── App.vue
|
|
98
|
+
├── vite-env.d.ts
|
|
99
|
+
└── main.ts
|
|
100
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
.vscode/*
|
|
18
|
+
!.vscode/extensions.json
|
|
19
|
+
!.vscode/settings.json
|
|
20
|
+
.idea
|
|
21
|
+
.DS_Store
|
|
22
|
+
*.suo
|
|
23
|
+
*.ntvs*
|
|
24
|
+
*.njsproj
|
|
25
|
+
*.sln
|
|
26
|
+
*.sw?
|
|
27
|
+
|
|
28
|
+
# Component auto import
|
|
29
|
+
/src/components.d.ts
|
|
30
|
+
|
|
31
|
+
# Test reports
|
|
32
|
+
coverage
|
|
33
|
+
/test-results/
|
|
34
|
+
/playwright-report/
|
|
35
|
+
/playwright/.cache/
|
|
36
|
+
|
|
37
|
+
# Visualizer
|
|
38
|
+
stats.html
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
];
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
<p>This site requires JavaScript to work.</p>
|
|
24
|
+
</noscript>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vue-starter",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"packageManager": "pnpm@9.15.3",
|
|
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.7.9",
|
|
22
|
+
"pinia": "^2.3.0",
|
|
23
|
+
"pinia-plugin-persistedstate": "^4.2.0",
|
|
24
|
+
"vue": "^3.5.13",
|
|
25
|
+
"vue-i18n": "^11.0.1",
|
|
26
|
+
"vue-router": "^4.5.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@component-hook/eslint-plugin": "0.2.4",
|
|
30
|
+
"@intlify/unplugin-vue-i18n": "^6.0.3",
|
|
31
|
+
"@playwright/test": "^1.49.1",
|
|
32
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
33
|
+
"@testing-library/user-event": "^14.5.2",
|
|
34
|
+
"@testing-library/vue": "^8.1.0",
|
|
35
|
+
"@tsconfig/node22": "22.0.0",
|
|
36
|
+
"@types/node": "^22.10.5",
|
|
37
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
38
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
39
|
+
"@vue/tsconfig": "^0.7.0",
|
|
40
|
+
"autoprefixer": "^10.4.20",
|
|
41
|
+
"cssnano": "^7.0.6",
|
|
42
|
+
"eslint": "^9.17.0",
|
|
43
|
+
"jsdom": "^25.0.1",
|
|
44
|
+
"msw": "^2.7.0",
|
|
45
|
+
"postcss": "^8.4.49",
|
|
46
|
+
"postcss-import": "^16.1.0",
|
|
47
|
+
"postcss-nesting": "^13.0.1",
|
|
48
|
+
"postcss-pxtorem": "^6.1.0",
|
|
49
|
+
"prettier": "^3.4.2",
|
|
50
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
51
|
+
"tailwindcss": "^3.4.17",
|
|
52
|
+
"typescript": "^5.7.3",
|
|
53
|
+
"unplugin-vue-components": "^0.28.0",
|
|
54
|
+
"vite": "^5.4.11",
|
|
55
|
+
"vite-plugin-svg-icons": "^2.0.1",
|
|
56
|
+
"vitest": "^2.1.8",
|
|
57
|
+
"vue-tsc": "^2.2.0"
|
|
58
|
+
},
|
|
59
|
+
"browserslist": [
|
|
60
|
+
"> 1%",
|
|
61
|
+
"last 2 versions",
|
|
62
|
+
"not dead"
|
|
63
|
+
],
|
|
64
|
+
"msw": {
|
|
65
|
+
"workerDirectory": "public"
|
|
66
|
+
},
|
|
67
|
+
"optionalDependencies": {
|
|
68
|
+
"@commitlint/cli": "^19.6.1",
|
|
69
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
70
|
+
"husky": "^9.1.7",
|
|
71
|
+
"lint-staged": "^15.3.0"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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: { ...devices['Desktop Chrome'] },
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
{
|
|
31
|
+
name: 'firefox',
|
|
32
|
+
use: { ...devices['Desktop Firefox'] },
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
name: 'webkit',
|
|
37
|
+
use: { ...devices['Desktop Safari'] },
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
/* Test against mobile viewports. */
|
|
41
|
+
// {
|
|
42
|
+
// name: 'Mobile Chrome',
|
|
43
|
+
// use: { ...devices['Pixel 5'] },
|
|
44
|
+
// },
|
|
45
|
+
// {
|
|
46
|
+
// name: 'Mobile Safari',
|
|
47
|
+
// use: { ...devices['iPhone 12'] },
|
|
48
|
+
// },
|
|
49
|
+
|
|
50
|
+
/* Test against branded browsers. */
|
|
51
|
+
// {
|
|
52
|
+
// name: 'Microsoft Edge',
|
|
53
|
+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
54
|
+
// },
|
|
55
|
+
// {
|
|
56
|
+
// name: 'Google Chrome',
|
|
57
|
+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
58
|
+
// },
|
|
59
|
+
],
|
|
60
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
plugins: {
|
|
3
|
+
'postcss-import': {},
|
|
4
|
+
'tailwindcss/nesting': {},
|
|
5
|
+
'postcss-nesting': {},
|
|
6
|
+
tailwindcss: {},
|
|
7
|
+
autoprefixer: {},
|
|
8
|
+
'postcss-pxtorem': {
|
|
9
|
+
rootValue: 16,
|
|
10
|
+
propList: ['*'],
|
|
11
|
+
},
|
|
12
|
+
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {}),
|
|
13
|
+
},
|
|
14
|
+
};
|