@component-hook/create-app 1.0.4 → 1.1.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/README.md +106 -82
- package/dist/index.js +35 -18
- package/package.json +1 -1
- package/template-vue/.github/actions/setup-environment/action.yml +45 -45
- package/template-vue/.github/renovate.json +12 -12
- package/template-vue/.github/workflows/ci.yml +22 -22
- package/template-vue/.github/workflows/deploy.yml +27 -27
- package/template-vue/.github/workflows/preview.yml +17 -17
- package/template-vue/.gitlab/setup.yml +18 -18
- package/template-vue/.husky/commit-msg +3 -3
- package/template-vue/.husky/pre-commit +3 -3
- package/template-vue/.vscode/extensions.json +10 -10
- package/template-vue/.vscode/settings.json +27 -27
- package/template-vue/LICENSE +21 -21
- package/template-vue/README.md.art +81 -100
- package/template-vue/_gitignore +38 -38
- package/template-vue/_gitlab-ci.yml +22 -22
- package/template-vue/index.html.art +28 -26
- package/template-vue/lint-staged.config.js +2 -0
- package/template-vue/package.json +71 -73
- package/template-vue/playwright.config.ts +12 -23
- package/template-vue/postcss.config.js +11 -10
- package/template-vue/src/__tests__/e2e/{IndexPage.spec.ts → home.spec.ts} +9 -5
- package/template-vue/src/__tests__/setup/unit-test.ts +1 -1
- package/template-vue/src/__tests__/unit/components/{indexPage → home}/HelloWorld.test.ts +3 -3
- package/template-vue/src/__tests__/unit/render/index.ts +4 -4
- package/template-vue/src/components/svg-icon/index.ts +1 -0
- package/template-vue/src/locales/en-US.json +3 -3
- package/template-vue/src/locales/zh-TW.json +3 -3
- package/template-vue/src/main.ts +6 -7
- package/template-vue/src/{components/indexPage → pages/home/components}/HelloWorld.vue +3 -8
- package/template-vue/src/pages/{IndexPage.vue → home/index.vue} +14 -3
- package/template-vue/src/router/index.ts +2 -2
- package/template-vue/src/stores/modules/{config.ts → config.ts.art} +1 -1
- package/template-vue/src/styles/base.css +48 -0
- package/template-vue/src/styles/common/all.css +1 -0
- package/template-vue/src/styles/common/button.css +15 -0
- package/template-vue/src/styles/index.css +3 -0
- package/template-vue/src/styles/tailwind.css +1 -0
- package/template-vue/src/vite-env.d.ts +13 -12
- package/template-vue/tsconfig.app.json +13 -13
- package/template-vue/tsconfig.json +14 -14
- package/template-vue/tsconfig.node.json +12 -12
- package/template-vue/tsconfig.vitest.json +8 -8
- package/template-vue/vite.config.ts +12 -11
- package/template-vue/vitest.config.ts +1 -1
- package/template-vue/public/mockServiceWorker.js +0 -307
- package/template-vue/src/components.d.ts +0 -14
- package/template-vue/src/styles/common/all.postcss +0 -1
- package/template-vue/src/styles/common/button.postcss +0 -12
- package/template-vue/src/styles/index.postcss +0 -1
- package/template-vue/src/styles/tailwind.postcss +0 -39
- package/template-vue/tailwind.config.js +0 -20
- /package/template-vue/src/assets/images/{svgIcons → svg-icons}/vue.svg +0 -0
- /package/template-vue/src/components/{common/SvgIcon.vue → svg-icon/src/index.vue} +0 -0
package/README.md
CHANGED
|
@@ -1,82 +1,106 @@
|
|
|
1
|
-
# @component-hook/create-app
|
|
2
|
-
|
|
3
|
-
Scaffolding a basic `typescript` project.
|
|
4
|
-
|
|
5
|
-
> **Compatibility Note:**
|
|
6
|
-
> Requires [Node.js](https://nodejs.org/en/) version
|
|
7
|
-
|
|
8
|
-
<p>
|
|
9
|
-
<a href="https://npm-stat.com/charts.html?package=@component-hook/create-app">
|
|
10
|
-
<img src="https://img.shields.io/npm/dm/@component-hook/create-app.svg" alt="npm"/>
|
|
11
|
-
</a>
|
|
12
|
-
<a href="https://www.npmjs.com/package/@component-hook/create-app">
|
|
13
|
-
<img src="https://img.shields.io/npm/v/@component-hook/create-app.svg" alt="npm"/>
|
|
14
|
-
</a>
|
|
15
|
-
</p>
|
|
16
|
-
|
|
17
|
-
## Create Project
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
$ npm create @component-hook/app@latest
|
|
21
|
-
|
|
22
|
-
# or use yarn
|
|
23
|
-
$ yarn create @component-hook/app
|
|
24
|
-
|
|
25
|
-
# or use pnpm
|
|
26
|
-
$ pnpm create @component-hook/app
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Then follow the prompts!
|
|
30
|
-
|
|
31
|
-
You can also directly specify the project name and the template you want to use via additional command line options. For example, to scaffold a project, run:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
$ npm create @component-hook/app@latest basic-app -- --template vue
|
|
35
|
-
|
|
36
|
-
# yarn
|
|
37
|
-
$ yarn create @component-hook/app basic-app --template vue
|
|
38
|
-
|
|
39
|
-
# pnpm
|
|
40
|
-
$ pnpm create @component-hook/app basic-app --template vue
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Currently supported template presets include:
|
|
44
|
-
|
|
45
|
-
- `vue`
|
|
46
|
-
|
|
47
|
-
## Project
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
- [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
- `
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
1
|
+
# @component-hook/create-app
|
|
2
|
+
|
|
3
|
+
Scaffolding a basic `typescript` project.
|
|
4
|
+
|
|
5
|
+
> **Compatibility Note:**
|
|
6
|
+
> Requires [Node.js](https://nodejs.org/en/) version 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
|
|
7
|
+
|
|
8
|
+
<p>
|
|
9
|
+
<a href="https://npm-stat.com/charts.html?package=@component-hook/create-app">
|
|
10
|
+
<img src="https://img.shields.io/npm/dm/@component-hook/create-app.svg" alt="npm"/>
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/@component-hook/create-app">
|
|
13
|
+
<img src="https://img.shields.io/npm/v/@component-hook/create-app.svg" alt="npm"/>
|
|
14
|
+
</a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## Create Project
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
$ npm create @component-hook/app@latest
|
|
21
|
+
|
|
22
|
+
# or use yarn
|
|
23
|
+
$ yarn create @component-hook/app
|
|
24
|
+
|
|
25
|
+
# or use pnpm
|
|
26
|
+
$ pnpm create @component-hook/app
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then follow the prompts!
|
|
30
|
+
|
|
31
|
+
You can also directly specify the project name and the template you want to use via additional command line options. For example, to scaffold a project, run:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
$ npm create @component-hook/app@latest basic-app -- --template vue
|
|
35
|
+
|
|
36
|
+
# yarn
|
|
37
|
+
$ yarn create @component-hook/app basic-app --template vue
|
|
38
|
+
|
|
39
|
+
# pnpm
|
|
40
|
+
$ pnpm create @component-hook/app basic-app --template vue
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Currently supported template presets include:
|
|
44
|
+
|
|
45
|
+
- `vue`
|
|
46
|
+
|
|
47
|
+
## Project Features Overview
|
|
48
|
+
|
|
49
|
+
This project leverages modern frontend practices and tooling, covering development experience, code quality, testing, and deployment.
|
|
50
|
+
|
|
51
|
+
### Development Experience
|
|
52
|
+
|
|
53
|
+
- **Written in TypeScript**: Provides type safety and better maintainability.
|
|
54
|
+
- **Styled with Tailwind CSS**: Utility-first CSS framework for fast and consistent UI styling.
|
|
55
|
+
- **SVG Support**: Integrated [`vite-plugin-svg-icons`](https://github.com/vbenjs/vite-plugin-svg-icons) to use SVGs as Vue components.
|
|
56
|
+
|
|
57
|
+
### API & Mocking
|
|
58
|
+
|
|
59
|
+
- Handles HTTP requests using `axios`.
|
|
60
|
+
- Uses `msw` (Mock Service Worker) for mocking APIs, enabling smooth local development and testing.
|
|
61
|
+
|
|
62
|
+
### Code Quality
|
|
63
|
+
|
|
64
|
+
- Enforces consistent code style with `ESLint` and `Prettier`.
|
|
65
|
+
- Enhanced with:
|
|
66
|
+
- `husky`: For Git hooks.
|
|
67
|
+
- `lint-staged`: Only runs linters on staged files.
|
|
68
|
+
- `commitlint`: Ensures commit messages follow conventional format.
|
|
69
|
+
|
|
70
|
+
### Testing
|
|
71
|
+
|
|
72
|
+
- Unit testing with `Vitest` + `Testing Library`.
|
|
73
|
+
- End-to-end (E2E) testing using `Playwright`.
|
|
74
|
+
|
|
75
|
+
### Optimization
|
|
76
|
+
|
|
77
|
+
- Minifies CSS with `cssnano`.
|
|
78
|
+
- Converts px to rem using `postcss-pxtorem` for responsive design.
|
|
79
|
+
- Uses `rollup-plugin-visualizer` to analyze bundle sizes.
|
|
80
|
+
|
|
81
|
+
### CI / CD
|
|
82
|
+
|
|
83
|
+
- Integrated `GitHub Actions` and `GitLab CI` for automated testing and deployment.
|
|
84
|
+
|
|
85
|
+
### Project Structure & Conventions
|
|
86
|
+
|
|
87
|
+
- The project root alias `@` points to the `src` directory (`<project_root>/src`).
|
|
88
|
+
- ESLint uses a custom plugin: [`@component-hook/eslint-plugin`](https://www.npmjs.com/package/@component-hook/eslint-plugin).
|
|
89
|
+
|
|
90
|
+
### Tip: Solving `npx: command not found`
|
|
91
|
+
|
|
92
|
+
If you encounter `npx: command not found`, run the following command to create a symbolic link:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
ln -s $(which npx) /usr/local/bin/npx
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Predefined Global Variables
|
|
99
|
+
|
|
100
|
+
These variables are injected at build time and are fully typed:
|
|
101
|
+
|
|
102
|
+
| Variable Name | Description |
|
|
103
|
+
| ---------------------- | -------------------------------------------- |
|
|
104
|
+
| `VITE_APP_VERSION` | Read from `package.json` version |
|
|
105
|
+
| `VITE_APP_BUILD_EPOCH` | Timestamp generated at build time |
|
|
106
|
+
| `VITE_APP_MOCK` | Indicates whether the mock environment is on |
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
import { readdirSync as readdirSync2, statSync } from "node:fs";
|
|
3
|
+
import { readdir, readFile, writeFile } from "node:fs/promises";
|
|
2
4
|
import path2 from "node:path";
|
|
3
5
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { readdir, readFile, writeFile } from "node:fs/promises";
|
|
5
|
-
import minimist from "minimist";
|
|
6
|
-
import colors2 from "picocolors";
|
|
7
|
-
import { copy, ensureDirSync } from "fs-extra/esm";
|
|
8
6
|
import artTemplate from "art-template";
|
|
7
|
+
import { copy, ensureDirSync } from "fs-extra/esm";
|
|
8
|
+
import minimist from "minimist";
|
|
9
9
|
import ora from "ora";
|
|
10
|
+
import colors2 from "picocolors";
|
|
11
|
+
|
|
12
|
+
// src/constants.ts
|
|
13
|
+
var DEFAULT_PROJECT_NAME = "basic-project";
|
|
14
|
+
var TEMPLATES = ["vue"];
|
|
15
|
+
var GITHUB_ACTIONS = "GitHub Actions";
|
|
16
|
+
var GITLAB_CI = "GitLab CI";
|
|
10
17
|
|
|
11
18
|
// src/prompts.ts
|
|
12
19
|
import { existsSync as existsSync2 } from "node:fs";
|
|
13
|
-
import prompts from "prompts";
|
|
14
20
|
import colors from "picocolors";
|
|
21
|
+
import prompts from "prompts";
|
|
15
22
|
|
|
16
23
|
// src/utils.ts
|
|
17
|
-
import path from "node:path";
|
|
18
24
|
import { existsSync, readdirSync } from "node:fs";
|
|
25
|
+
import path from "node:path";
|
|
19
26
|
import { remove } from "fs-extra/esm";
|
|
20
|
-
|
|
21
|
-
// src/config.ts
|
|
22
|
-
var DEFAULT_PROJECT_NAME = "basic-project";
|
|
23
|
-
var TEMPLATES = ["vue"];
|
|
24
|
-
|
|
25
|
-
// src/utils.ts
|
|
26
27
|
function formatTargetDir(targetDir) {
|
|
27
28
|
if (!targetDir) return targetDir;
|
|
28
29
|
targetDir = targetDir.trim();
|
|
@@ -46,6 +47,9 @@ function isValidPackageName(projectName) {
|
|
|
46
47
|
function toValidPackageName(projectName) {
|
|
47
48
|
return projectName.trim().toLowerCase().replaceAll(/\s+/g, "-").replace(/^[._]/, "").replaceAll(/[^a-z\d\-~]+/g, "-");
|
|
48
49
|
}
|
|
50
|
+
function toUpperCasePackageName(projectName) {
|
|
51
|
+
return projectName.split("-").map((str) => `${str[0].toUpperCase()}${str.slice(1)}`).join(" ");
|
|
52
|
+
}
|
|
49
53
|
function getPkgManagerInfo() {
|
|
50
54
|
const userAgent = process.env.npm_config_user_agent;
|
|
51
55
|
if (!userAgent) return;
|
|
@@ -108,7 +112,7 @@ function operationPrompts({ targetDir, template }) {
|
|
|
108
112
|
type: (_, { projectName: nameAnswer }) => {
|
|
109
113
|
return isValidPackageName(getProjectName(nameAnswer)) ? null : "text";
|
|
110
114
|
},
|
|
111
|
-
name: "
|
|
115
|
+
name: "packageName",
|
|
112
116
|
message: styleTitle("Package name:"),
|
|
113
117
|
initial: (_, { projectName: nameAnswer }) => toValidPackageName(getProjectName(nameAnswer)),
|
|
114
118
|
validate: (name) => {
|
|
@@ -154,7 +158,7 @@ Available templates:
|
|
|
154
158
|
${colors2.green("vue")}
|
|
155
159
|
`;
|
|
156
160
|
async function copyTemplateFolder(root, templateDir, packageName) {
|
|
157
|
-
const isGitlab = argv.
|
|
161
|
+
const isGitlab = argv.l || argv.gitlab;
|
|
158
162
|
const [files, pkgJson] = await Promise.all([
|
|
159
163
|
readdir(templateDir),
|
|
160
164
|
readFile(path2.join(templateDir, "package.json"), "utf-8")
|
|
@@ -172,11 +176,24 @@ async function copyTemplateFolder(root, templateDir, packageName) {
|
|
|
172
176
|
}
|
|
173
177
|
const templatePath = path2.join(templateDir, file);
|
|
174
178
|
if (file.endsWith(".art")) {
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
|
|
179
|
+
const isScript = file.endsWith(".js.art") || file.endsWith(".ts.art");
|
|
180
|
+
const name = isScript ? packageName : toUpperCasePackageName(packageName);
|
|
181
|
+
const replacedPath = targetPath.replace(".art", "");
|
|
182
|
+
const renderedResult = artTemplate(templatePath, {
|
|
183
|
+
projectName: name,
|
|
184
|
+
gitRepository: isGitlab ? GITLAB_CI : GITHUB_ACTIONS
|
|
185
|
+
});
|
|
186
|
+
ensureDirSync(path2.dirname(replacedPath));
|
|
187
|
+
return writeFile(replacedPath, renderedResult);
|
|
188
|
+
}
|
|
189
|
+
if (statSync(templatePath).isDirectory()) {
|
|
190
|
+
const subFiles = readdirSync2(templatePath);
|
|
191
|
+
const rewriteOrCopySubFilePromises = subFiles.map((subFile) => rewriteOrCopyFile(path2.join(file, subFile)));
|
|
192
|
+
return Promise.all(rewriteOrCopySubFilePromises).then(() => {
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
return copy(templatePath, targetPath);
|
|
178
196
|
}
|
|
179
|
-
return copy(templatePath, targetPath);
|
|
180
197
|
};
|
|
181
198
|
pkg.name = packageName;
|
|
182
199
|
return Promise.all([
|
package/package.json
CHANGED
|
@@ -1,45 +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
|
|
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
|
|
@@ -1,12 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,22 +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
|
|
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
|
|
@@ -1,27 +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
|
|
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
|
|
@@ -1,17 +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'
|
|
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'
|
|
@@ -1,18 +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
|
|
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
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
npx --no -- commitlint --edit ${1}
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
npx --no -- commitlint --edit ${1}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
npx lint-staged
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
npx lint-staged
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"recommendations": [
|
|
3
|
-
"vue.volar",
|
|
4
|
-
"bradlc.vscode-tailwindcss",
|
|
5
|
-
"esbenp.prettier-vscode",
|
|
6
|
-
"csstools.postcss",
|
|
7
|
-
"cpylua.language-postcss",
|
|
8
|
-
"streetsidesoftware.code-spell-checker"
|
|
9
|
-
]
|
|
10
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"recommendations": [
|
|
3
|
+
"vue.volar",
|
|
4
|
+
"bradlc.vscode-tailwindcss",
|
|
5
|
+
"esbenp.prettier-vscode",
|
|
6
|
+
"csstools.postcss",
|
|
7
|
+
"cpylua.language-postcss",
|
|
8
|
+
"streetsidesoftware.code-spell-checker"
|
|
9
|
+
]
|
|
10
|
+
}
|