feat(vscode): 增强开发调试配置支持
This commit is contained in:
13
.vscode/launch.json
vendored
13
.vscode/launch.json
vendored
@@ -8,7 +8,18 @@
|
|||||||
"url": "http://localhost:4730/",
|
"url": "http://localhost:4730/",
|
||||||
"webRoot": "${workspaceFolder}",
|
"webRoot": "${workspaceFolder}",
|
||||||
"firefoxExecutable": "/Applications/Firefox Nightly.app/Contents/MacOS/firefox",
|
"firefoxExecutable": "/Applications/Firefox Nightly.app/Contents/MacOS/firefox",
|
||||||
"preLaunchTask": "🚀 dev"
|
"preLaunchTask": "🚀 dev",
|
||||||
|
"pathMappings": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost:4730",
|
||||||
|
"path": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"reAttach": true,
|
||||||
|
"reloadOnChange": {
|
||||||
|
"watch": "${workspaceFolder}/src/**/*.{js,jsx,ts,tsx,vue}",
|
||||||
|
"ignore": "**/node_modules/**"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
50
.vscode/tasks.json
vendored
50
.vscode/tasks.json
vendored
@@ -2,32 +2,48 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "dev",
|
||||||
"label": "🚀 dev",
|
"label": "🚀 dev",
|
||||||
"type": "shell",
|
"detail": "启动开发服务器",
|
||||||
"command": "pnpm run dev",
|
|
||||||
"isBackground": true,
|
|
||||||
"problemMatcher": {
|
"problemMatcher": {
|
||||||
"owner": "vite",
|
"pattern": { "regexp": "." },
|
||||||
"pattern": {
|
|
||||||
"regexp": "."
|
|
||||||
},
|
|
||||||
"background": {
|
"background": {
|
||||||
"activeOnStart": true,
|
"activeOnStart": true,
|
||||||
"beginsPattern": ".*VITE.*",
|
"beginsPattern": "VITE.*ready in",
|
||||||
"endsPattern": ".*ready in.*"
|
"endsPattern": "(Local|Network):.*http"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"group": {
|
"isBackground": true,
|
||||||
"kind": "build",
|
"presentation": { "reveal": "always", "panel": "dedicated" },
|
||||||
"isDefault": true
|
"group": { "kind": "build", "isDefault": false }
|
||||||
},
|
},
|
||||||
"presentation": {
|
{
|
||||||
"reveal": "always",
|
"type": "npm",
|
||||||
"panel": "new"
|
"script": "build-only",
|
||||||
|
"label": "🔨 build-only",
|
||||||
|
"detail": "" /* 如果为空或省略,VSCode 将自动使用 package.json 中 scripts[scriptName] 的值作为 detail */,
|
||||||
|
"problemMatcher": ["$tsc"],
|
||||||
|
"presentation": { "reveal": "always", "panel": "shared" },
|
||||||
|
"group": { "kind": "none", "isDefault": false }
|
||||||
},
|
},
|
||||||
"runOptions": {
|
{
|
||||||
"instanceLimit": 1
|
"type": "npm",
|
||||||
|
"script": "wrangler:dev",
|
||||||
|
"label": "☁️ wrangler:dev",
|
||||||
|
"detail": "启动 Cloudflare Workers 开发服务器,相当于预览",
|
||||||
|
"dependsOn": ["🔨 build-only"],
|
||||||
|
"problemMatcher": {
|
||||||
|
"pattern": { "regexp": "." },
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": "wrangler dev",
|
||||||
|
"endsPattern": "Ready on"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"isBackground": true,
|
||||||
|
"presentation": { "reveal": "always", "panel": "dedicated" },
|
||||||
|
"group": { "kind": "build", "isDefault": false }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
73
README-command.md
Normal file
73
README-command.md
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
## 依赖管理
|
||||||
|
|
||||||
|
```shell
|
||||||
|
pnpm dedupe
|
||||||
|
```
|
||||||
|
|
||||||
|
去除重复的依赖包。当你的项目中存在多个版本的同一个包时,pnpm dedupe 会尝试将它们合并成尽可能少的版本,从而减少 node_modules 的体积。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm dlx taze major --interactive
|
||||||
|
```
|
||||||
|
|
||||||
|
交互式地将项目依赖升级到最新的主要版本,可以逐个选择要升级哪些包。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm dlx knip
|
||||||
|
```
|
||||||
|
|
||||||
|
检测项目中未使用的依赖、导出和文件,帮助清理冗余代码。
|
||||||
|
|
||||||
|
## Playwright
|
||||||
|
|
||||||
|
```bash
|
||||||
|
playwright test
|
||||||
|
```
|
||||||
|
|
||||||
|
- `HEADLESS=true`:强制无头模式
|
||||||
|
- `--ui`:启动 Playwright 的图形用户界面,方便调试测试用例
|
||||||
|
- `--project=chromium`:指定使用 Chromium 浏览器进行测试
|
||||||
|
- `--quiet`:减少输出信息,只显示必要的内容
|
||||||
|
|
||||||
|
## Oxlint
|
||||||
|
|
||||||
|
```bash
|
||||||
|
oxlint . --fix --ignore-path=.gitignore --print-config
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
oxlint . --fix --deny=correctness
|
||||||
|
```
|
||||||
|
|
||||||
|
## Wrangler
|
||||||
|
|
||||||
|
### Pages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wrangler pages deploy dist --project-name=vue-ts-example-2025 --branch=preview
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wrangler pages deploy dist --project-name=vue-ts-example-2025
|
||||||
|
```
|
||||||
|
|
||||||
|
### Workers
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wrangler deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wrangler versions upload
|
||||||
|
```
|
||||||
|
|
||||||
|
## 拆包体积分析
|
||||||
|
|
||||||
|
- https://github.com/nonzzz/vite-bundle-analyzer
|
||||||
|
- https://github.com/KusStar/vite-bundle-visualizer
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm dlx vite-bundle-visualizer -t treemap
|
||||||
|
pnpm dlx vite-bundle-visualizer -t sunburst
|
||||||
|
pnpm dlx vite-bundle-visualizer -t network
|
||||||
|
```
|
||||||
33
package.json
33
package.json
@@ -8,41 +8,21 @@
|
|||||||
"node": "^20.19.0 || >=22.12.0"
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"_all": "run-p build-only format type-check lint",
|
"_all": "run-p build-only format:prettier type-check lint test:unit:DisableWatch",
|
||||||
"dev": "vite --port 4730 --host --strictPort",
|
"dev": "vite --port 4730 --host --strictPort",
|
||||||
"build": "run-p type-check \"build-only {@}\" --",
|
"build": "run-p type-check \"build-only {@}\" --",
|
||||||
"build-only": "vite build",
|
"build-only": "vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview --port 4731 --host --strictPort",
|
||||||
"preview:wrangler": "run-s build-only wrangler:dev",
|
"wrangler:dev": "wrangler dev --port 4732",
|
||||||
"wrangler:dev": "wrangler dev",
|
"format:prettier": "prettier --write src/",
|
||||||
"lint": "run-s lint:*",
|
|
||||||
"format": "prettier --write src/",
|
|
||||||
"type-check": "vue-tsc --build",
|
"type-check": "vue-tsc --build",
|
||||||
|
"lint": "run-s lint:*",
|
||||||
"lint:stylelint": "stylelint \"**/*.{css,less,scss,vue}\" --fix --ignore-path .gitignore",
|
"lint:stylelint": "stylelint \"**/*.{css,less,scss,vue}\" --fix --ignore-path .gitignore",
|
||||||
"lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
|
"lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
|
||||||
"lint:eslint": "eslint . --fix",
|
"lint:eslint": "eslint . --fix",
|
||||||
"test:unit": "vitest",
|
|
||||||
"test:unit:DisableWatch": "vitest --run",
|
"test:unit:DisableWatch": "vitest --run",
|
||||||
"test:playwright": "playwright test",
|
"test:playwright:headless": "HEADLESS=true playwright test --quiet",
|
||||||
"test:playwright:headless": "HEADLESS=true playwright test",
|
|
||||||
"test:playwright:ui": "playwright test --ui",
|
|
||||||
"test:playwright:chromium": "playwright test --project=chromium --quiet",
|
|
||||||
"_oxlint_cfg": "oxlint . --fix --ignore-path=.gitignore --print-config",
|
|
||||||
"__oxlint_-D": "oxlint . --fix --deny=correctness",
|
|
||||||
"-wrangler:pages:deploy:preview": "wrangler pages deploy dist --project-name=vue-ts-example-2025 --branch=preview",
|
|
||||||
"-wrangler:pages:deploy:prod": "wrangler pages deploy dist --project-name=vue-ts-example-2025",
|
|
||||||
"-deploy:preview": "run-s build-only wrangler:pages:deploy:preview",
|
|
||||||
"-deploy:prod": "run-s build-only wrangler:pages:deploy:prod",
|
|
||||||
"wrangler:deploy": "pnpm run build && wrangler deploy",
|
|
||||||
"wrangler:versions:upload": "pnpm run build && wrangler versions upload",
|
|
||||||
"cf-typegen": "wrangler types",
|
|
||||||
"postinstall": "wrangler types",
|
"postinstall": "wrangler types",
|
||||||
"_dep:dedupe": "pnpm dedupe",
|
|
||||||
"_dep:update": "pnpm dlx taze major --interactive",
|
|
||||||
"_sizecheck:Treemap": "pnpm dlx vite-bundle-visualizer -t treemap",
|
|
||||||
"_sizecheck:Sunburst": "pnpm dlx vite-bundle-visualizer -t sunburst",
|
|
||||||
"_sizecheck:Network": "pnpm dlx vite-bundle-visualizer -t network",
|
|
||||||
"_knip": "pnpm dlx knip",
|
|
||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
@@ -108,7 +88,6 @@
|
|||||||
"happy-dom": "^20.0.1",
|
"happy-dom": "^20.0.1",
|
||||||
"html-minifier-terser": "^7.2.0",
|
"html-minifier-terser": "^7.2.0",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"jiti": "^2.5.1",
|
|
||||||
"jsdom": "^27.0.0",
|
"jsdom": "^27.0.0",
|
||||||
"lint-staged": "^16.1.6",
|
"lint-staged": "^16.1.6",
|
||||||
"npm-run-all2": "^8.0.4",
|
"npm-run-all2": "^8.0.4",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { defineConfig, devices } from '@playwright/test';
|
|||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
|
|
||||||
// const runningInVSCode = process.env.TERM_PROGRAM === 'vscode'
|
// const runningInVSCode = process.env.TERM_PROGRAM === 'vscode'
|
||||||
const baseURL = 'http://localhost:4173';
|
const baseURL = 'http://localhost:4731';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read environment variables from file.
|
* Read environment variables from file.
|
||||||
|
|||||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -147,9 +147,6 @@ importers:
|
|||||||
husky:
|
husky:
|
||||||
specifier: ^9.1.7
|
specifier: ^9.1.7
|
||||||
version: 9.1.7
|
version: 9.1.7
|
||||||
jiti:
|
|
||||||
specifier: ^2.5.1
|
|
||||||
version: 2.6.1
|
|
||||||
jsdom:
|
jsdom:
|
||||||
specifier: ^27.0.0
|
specifier: ^27.0.0
|
||||||
version: 27.0.0(postcss@8.5.6)
|
version: 27.0.0(postcss@8.5.6)
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
|
devSourcemap: true,
|
||||||
preprocessorOptions: {
|
preprocessorOptions: {
|
||||||
scss: {
|
scss: {
|
||||||
// 使用 Sass 的现代编译器 API,提供更好的性能和新功能支持
|
// 使用 Sass 的现代编译器 API,提供更好的性能和新功能支持
|
||||||
|
|||||||
7
worker-configuration.d.ts
vendored
7
worker-configuration.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
// Generated by Wrangler by running `wrangler types` (hash: c8d566f9236103c3d936718f23f1bb71)
|
// Generated by Wrangler by running `wrangler types` (hash: 7094267439eea3789640d49ba1e25377)
|
||||||
// Runtime types generated with workerd@1.20250927.0 2025-09-09
|
// Runtime types generated with workerd@1.20250927.0 2025-09-09
|
||||||
declare namespace Cloudflare {
|
declare namespace Cloudflare {
|
||||||
interface GlobalProps {
|
interface GlobalProps {
|
||||||
@@ -7,11 +7,6 @@ declare namespace Cloudflare {
|
|||||||
}
|
}
|
||||||
interface Env {
|
interface Env {
|
||||||
KV: KVNamespace;
|
KV: KVNamespace;
|
||||||
VITE_APP_TITLE: string;
|
|
||||||
VITE_APP_BASE: string;
|
|
||||||
VITE_APP_BUILD_SOURCE_MAP: string;
|
|
||||||
VITE_APP_BUILD_COMMIT: string;
|
|
||||||
VITE_APP_BUILD_TIME: string;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
interface Env extends Cloudflare.Env {}
|
interface Env extends Cloudflare.Env {}
|
||||||
|
|||||||
Reference in New Issue
Block a user