Skip to content

Commit 0e8c279

Browse files
committed
refactor: migrate to monorepo & add e2e tests
1 parent d08908d commit 0e8c279

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+6355
-4742
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ jobs:
1919
- uses: pnpm/action-setup@v2
2020
- uses: actions/setup-node@v3
2121
with:
22-
node-version: 16.x
22+
node-version: lts/*
2323
cache: pnpm
2424

2525
- name: Install
2626
run: pnpm install
2727

2828
- name: Lint
2929
run: pnpm run lint
30-
30+
3131
typecheck:
3232
runs-on: ubuntu-latest
3333
steps:
3434
- uses: actions/checkout@v3
3535
- uses: pnpm/action-setup@v2
3636
- uses: actions/setup-node@v3
3737
with:
38-
node-version: 16.x
38+
node-version: lts/*
3939
cache: pnpm
4040

4141
- name: Install

.github/workflows/gh-pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/setup-node@v3
2121
with:
2222
node-version: ${{ matrix.node_version }}
23-
cache: 'pnpm'
23+
cache: pnpm
2424

2525
- name: Install Dependencies
2626
run: pnpm install --frozen-lockfile
@@ -32,5 +32,5 @@ jobs:
3232
uses: peaceiris/actions-gh-pages@v3
3333
with:
3434
github_token: ${{ secrets.GITHUB_TOKEN }}
35-
publish_dir: ./dist
35+
publish_dir: ./packages/react/dist
3636
force_orphan: true

.github/workflows/playwright.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Playwright Tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
test:
11+
timeout-minutes: 60
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: lts/*
19+
20+
- uses: pnpm/action-setup@v2
21+
name: Install pnpm
22+
with:
23+
run_install: true
24+
25+
- name: Install Playwright Browsers
26+
run: pnpm exec playwright install --with-deps
27+
- name: Run Playwright tests
28+
run: pnpm exec playwright test
29+
- uses: actions/upload-artifact@v4
30+
if: ${{ !cancelled() }}
31+
with:
32+
name: playwright-report
33+
path: playwright-report/
34+
retention-days: 30

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ package-lock.json
1010
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
1111

1212
# dependencies
13-
/node_modules
1413
/.pnp
1514
.pnp.js
1615

@@ -34,6 +33,11 @@ yarn-error.log*
3433
# jetbrains
3534
.idea
3635

36+
node_modules
3737
dist
3838
dist-ssr
3939
*.local
40+
/test-results/
41+
/playwright-report/
42+
/blob-report/
43+
/playwright/.cache/

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
shamefully-hoist=true
22
strict-peer-dependencies=false
3+
ignore-workspace-root-check=true

.vscode/settings.json

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,27 @@
11
{
22
"typescript.tsdk": "node_modules/typescript/lib",
33

4-
// Enable the ESlint flat config support
5-
"eslint.experimental.useFlatConfig": true,
6-
7-
// Disable the default formatter, use eslint instead
8-
"prettier.enable": false,
9-
"editor.formatOnSave": false,
10-
11-
// Auto fix
12-
"editor.codeActionsOnSave": {
13-
"source.fixAll.eslint": "explicit",
14-
"source.organizeImports": "never"
15-
},
16-
17-
18-
// Enable eslint for all supported languages
19-
"eslint.validate": [
20-
"javascript",
21-
"javascriptreact",
22-
"typescript",
23-
"typescriptreact",
24-
"vue",
25-
"html",
26-
"markdown",
27-
"json",
28-
"jsonc",
29-
"yaml",
30-
"toml"
31-
]
4+
// Enable the ESlint flat config support
5+
"eslint.experimental.useFlatConfig": true,
6+
// Disable the default formatter, use eslint instead
7+
"prettier.enable": false,
8+
"editor.formatOnSave": false,
9+
// Auto fix
10+
"editor.codeActionsOnSave": {
11+
"source.fixAll.eslint": "explicit",
12+
"source.organizeImports": "never"
13+
},
14+
// Enable eslint for all supported languages
15+
"eslint.validate": [
16+
"javascript",
17+
"javascriptreact",
18+
"typescript",
19+
"typescriptreact",
20+
"vue",
21+
"html",
22+
"markdown",
23+
"json",
24+
"jsonc",
25+
"yaml"
26+
]
3227
}

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ Air Conditioner
1919

2020
> 前世今生:[云空调,便携小空调|云游君的小站](https://www.yunyoujun.cn/posts/air-conditioner/)
2121
22-
- 裸机[main][ac.yunyoujun.cn](https://ac.yunyoujun.cn)
23-
- 测试机[dev][ac.yyj.moe](https://ac.yyj.moe)
24-
- 样板房:<https://www.yunyoujun.cn/air-conditioner-room/>
22+
| 仓库 | 类型 | 链接 |
23+
| --- | --- | --- |
24+
| 裸机 | main | [ac.yunyoujun.cn](https://ac.yunyoujun.cn) |
25+
| 测试机 | dev | [ac.yyj.moe](https://ac.yyj.moe) |
26+
| 样板房 | 空调房 | [https://www.yunyoujun.cn/air-conditioner-room/](https://www.yunyoujun.cn/air-conditioner-room/) |
2527

2628
## Features
2729

netlify.toml

Lines changed: 0 additions & 18 deletions
This file was deleted.

package.json

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
{
22
"name": "air-conditioner",
3-
"description": "云空调,便携小空调",
4-
"packageManager": "pnpm@8.15.1",
53
"type": "module",
64
"version": "0.1.3",
75
"private": true,
6+
"packageManager": "pnpm@9.14.4",
7+
"description": "云空调,便携小空调",
88
"author": {
99
"url": "https://www.yunyoujun.cn",
1010
"email": "me@yunyoujun.cn",
1111
"name": "YunYouJun"
1212
},
13+
"homepage": "https://ac.yunyoujun.cn/",
14+
"repository": {
15+
"type": "git",
16+
"url": "https://github.com/YunYouJun/air-conditioner"
17+
},
1318
"scripts": {
14-
"dev": "vite",
15-
"build": "vite build",
16-
"serve": "vite preview",
17-
"lint": "eslint \"**/*.{tsx,ts,js}\"",
18-
"lint:fix": "eslint \"**/*.{tsx,ts,js}\" --fix",
19+
"build": "pnpm -r run build",
20+
"react:dev": "pnpm -C packages/react run dev",
21+
"react:build": "pnpm -C packages/react run build",
22+
"vue:dev": "pnpm -C packages/vue run dev",
23+
"vue:build": "pnpm -C packages/vue run build",
24+
"lint": "eslint .",
1925
"typecheck": "tsc --noEmit"
2026
},
2127
"browserslist": {
@@ -30,40 +36,13 @@
3036
"last 1 safari version"
3137
]
3238
},
33-
"repository": {
34-
"type": "git",
35-
"url": "https://github.com/YunYouJun/air-conditioner"
36-
},
37-
"homepage": "https://ac.yunyoujun.cn/",
38-
"dependencies": {
39-
"react": "^18.2.0",
40-
"react-dom": "^18.2.0",
41-
"react-ga": "^3.3.1",
42-
"react-gtm-module": "2.0.11",
43-
"react-router-dom": "^6.22.0",
44-
"sass": "^1.70.0",
45-
"web-vitals": "^3.5.2"
46-
},
4739
"devDependencies": {
48-
"@antfu/eslint-config": "^2.6.3",
49-
"@emotion/react": "^11.11.3",
50-
"@emotion/styled": "^11.11.0",
51-
"@iconify-json/ic": "^1.1.17",
52-
"@iconify-json/mdi": "^1.1.64",
53-
"@mui/material": "^5.15.7",
54-
"@types/node": "^20.11.16",
55-
"@types/react": "^18.2.52",
56-
"@types/react-dom": "^18.2.18",
57-
"@types/react-gtm-module": "2.0.3",
58-
"@types/react-router-dom": "^5.3.3",
59-
"@vitejs/plugin-react": "^4.2.1",
60-
"eslint": "^8.56.0",
61-
"react-transition-group": "^4.4.5",
62-
"typescript": "^5.3.3",
63-
"unocss": "^0.58.4",
64-
"usehooks-ts": "^2.12.1",
65-
"vite": "^5.0.12",
66-
"vite-plugin-pages": "^0.32.0",
67-
"vite-plugin-pwa": "^0.17.5"
40+
"@antfu/eslint-config": "^3.11.2",
41+
"@iconify-json/ic": "^1.2.1",
42+
"@iconify-json/mdi": "^1.2.1",
43+
"@playwright/test": "^1.49.0",
44+
"@types/node": "^22.10.1",
45+
"eslint": "^9.16.0",
46+
"typescript": "^5.6.3"
6847
}
6948
}

0 commit comments

Comments
 (0)