create-lve 0.2.2 → 0.2.4
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/index.js +121 -97
- package/package.json +3 -2
- package/template-react/.vite-hooks/pre-commit +1 -0
- package/template-react/.vscode/extensions.json +3 -0
- package/template-react/.vscode/settings.json +8 -0
- package/{template → template-react}/index.html +1 -1
- package/{template/_package.json → template-react/package.json} +1 -3
- package/template-react/public/favicon.svg +1 -0
- package/template-react/src/App.tsx +51 -0
- package/{template → template-react}/src/main.tsx +1 -2
- package/template-react/src/style.css +0 -0
- package/{template → template-react}/vite.config.ts +1 -3
- package/template-vue/.vite-hooks/pre-commit +1 -0
- package/template-vue/.vscode/extensions.json +3 -0
- package/template-vue/index.html +13 -0
- package/template-vue/package.json +31 -0
- package/template-vue/pnpm-lock.yaml +1608 -0
- package/template-vue/public/favicon.svg +1 -0
- package/template-vue/public/icons.svg +24 -0
- package/template-vue/src/App.vue +61 -0
- package/template-vue/src/assets/hero.png +0 -0
- package/template-vue/src/assets/vite.svg +1 -0
- package/template-vue/src/assets/vue.svg +1 -0
- package/template-vue/src/main.ts +4 -0
- package/template-vue/src/style.css +0 -0
- package/template-vue/tsconfig.app.json +14 -0
- package/template-vue/tsconfig.json +4 -0
- package/template-vue/tsconfig.node.json +24 -0
- package/template-vue/vite.config.ts +12 -0
- package/template/_vscode/settings.json +0 -30
- package/template/public/vite.svg +0 -1
- package/template/src/App.tsx +0 -21
- package/template/src/index.css +0 -1
- /package/{template → template-react}/_gitignore +0 -0
- /package/{template → template-react}/src/assets/react.svg +0 -0
- /package/{template → template-react}/tsconfig.app.json +0 -0
- /package/{template → template-react}/tsconfig.json +0 -0
- /package/{template → template-react}/tsconfig.node.json +0 -0
package/index.js
CHANGED
|
@@ -1,140 +1,164 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import * as p from
|
|
4
|
-
import pc from
|
|
5
|
-
import fs from
|
|
6
|
-
import path from
|
|
7
|
-
import { fileURLToPath } from
|
|
3
|
+
import * as p from "@clack/prompts";
|
|
4
|
+
import pc from "picocolors";
|
|
5
|
+
import fs from "fs-extra";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
|
|
11
11
|
async function main() {
|
|
12
12
|
console.clear();
|
|
13
13
|
const logo = `
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
${pc.cyan("█ █ █ █▀▀▀")}
|
|
15
|
+
${pc.cyan("█ █ █ █▀▀ ")}
|
|
16
|
+
${pc.cyan("█▄▄▄ ▀▄▀ █▄▄▄")} ${pc.gray("THE ULTRA-FAST FRONTEND STACK")}
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
19
|
console.log(logo);
|
|
20
|
-
p.intro(
|
|
21
|
-
`${pc.bgCyan(pc.black(' LVE-CLI '))} ` +
|
|
22
|
-
pc.gray('The Ultra-Fast React Stack (') +
|
|
23
|
-
pc.blue('Vite') + pc.gray(' + ') +
|
|
24
|
-
pc.yellow('Oxc') + pc.gray(' + ') +
|
|
25
|
-
pc.cyan('Tailwind') + pc.gray(')')
|
|
26
|
-
);
|
|
20
|
+
p.intro(`${pc.bgCyan(pc.black(" LVE-CLI "))}`);
|
|
27
21
|
|
|
28
22
|
const project = await p.group(
|
|
29
23
|
{
|
|
30
|
-
path: () =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}),
|
|
24
|
+
path: () => p.text({
|
|
25
|
+
message: "项目名称",
|
|
26
|
+
placeholder: "my-app",
|
|
27
|
+
defaultValue: "my-app",
|
|
28
|
+
validate: (value) => {
|
|
29
|
+
if (!value || value.length === 0) return;
|
|
30
|
+
if (value.match(/[<>:"|?*]/)) return "路径包含非法字符";
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
40
33
|
shouldOverwrite: ({ results }) => {
|
|
41
34
|
const targetDir = path.resolve(process.cwd(), results.path);
|
|
42
35
|
if (fs.existsSync(targetDir) && fs.readdirSync(targetDir).length > 0) {
|
|
43
|
-
return p.confirm({
|
|
44
|
-
message: `⚠️ 目录 ${pc.yellow(results.path)} 已存在且不为空,是否清空?`,
|
|
45
|
-
initialValue: false,
|
|
46
|
-
});
|
|
36
|
+
return p.confirm({ message: `目录已存在,是否清空?`, initialValue: false });
|
|
47
37
|
}
|
|
48
38
|
},
|
|
39
|
+
framework: () => p.select({
|
|
40
|
+
message: "选择框架",
|
|
41
|
+
options: [
|
|
42
|
+
{ value: "react", label: "React 19", hint: "VitePlus + Compiler" },
|
|
43
|
+
{ value: "vue", label: "Vue 3", hint: "VitePlus + Optimized" },
|
|
44
|
+
],
|
|
45
|
+
}),
|
|
46
|
+
cssEngine: () => p.select({
|
|
47
|
+
message: "选择 CSS 引擎",
|
|
48
|
+
options: [
|
|
49
|
+
{ value: "unocss", label: "UnoCSS", hint: "⚡️ 战机级性能:动态代码注入,实现源码级‘无感’混淆" },
|
|
50
|
+
{ value: "tailwind", label: "Tailwind v4", hint: "🛡️ 装甲级稳定:v4 引擎重构,完美适配所有主流 UI 库" },
|
|
51
|
+
],
|
|
52
|
+
}),
|
|
49
53
|
},
|
|
50
|
-
{
|
|
51
|
-
onCancel: () => {
|
|
52
|
-
p.cancel('已取消操作');
|
|
53
|
-
process.exit(0);
|
|
54
|
-
},
|
|
55
|
-
}
|
|
54
|
+
{ onCancel: () => { p.cancel("操作取消"); process.exit(0); } }
|
|
56
55
|
);
|
|
57
56
|
|
|
58
|
-
if (project.shouldOverwrite === false) {
|
|
59
|
-
p.cancel('操作终止:请更换目录名后再试');
|
|
60
|
-
process.exit(0);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
57
|
const targetDir = path.resolve(process.cwd(), project.path);
|
|
64
|
-
const templateDir = path.resolve(__dirname,
|
|
65
|
-
|
|
58
|
+
const templateDir = path.resolve(__dirname, `template-${project.framework}`);
|
|
59
|
+
const isUno = project.cssEngine === "unocss";
|
|
66
60
|
const s = p.spinner();
|
|
67
|
-
|
|
61
|
+
|
|
62
|
+
s.start("🛠️ 正在按需装配架构...");
|
|
68
63
|
|
|
69
64
|
try {
|
|
70
|
-
if (project.shouldOverwrite)
|
|
71
|
-
|
|
72
|
-
} else {
|
|
73
|
-
await fs.ensureDir(targetDir);
|
|
74
|
-
}
|
|
65
|
+
if (project.shouldOverwrite) await fs.emptyDir(targetDir);
|
|
66
|
+
else await fs.ensureDir(targetDir);
|
|
75
67
|
|
|
76
68
|
await fs.copy(templateDir, targetDir);
|
|
77
69
|
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
'_gitignore': '.gitignore',
|
|
81
|
-
'_vscode': '.vscode',
|
|
82
|
-
};
|
|
70
|
+
const oldGit = path.join(targetDir, "_gitignore");
|
|
71
|
+
if (fs.existsSync(oldGit)) await fs.move(oldGit, path.join(targetDir, ".gitignore"));
|
|
83
72
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
73
|
+
const pkgPath = path.join(targetDir, "package.json");
|
|
74
|
+
const pkg = await fs.readJson(pkgPath);
|
|
75
|
+
pkg.name = path.basename(targetDir);
|
|
76
|
+
|
|
77
|
+
if (isUno) {
|
|
78
|
+
pkg.devDependencies["unocss"] = "latest";
|
|
79
|
+
} else {
|
|
80
|
+
pkg.devDependencies["tailwindcss"] = "latest";
|
|
81
|
+
pkg.devDependencies["@tailwindcss/vite"] = "latest";
|
|
89
82
|
}
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
...pkg.dependencies,
|
|
98
|
-
"react": "latest",
|
|
99
|
-
"react-dom": "latest",
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
pkg.devDependencies = {
|
|
103
|
-
...pkg.devDependencies,
|
|
104
|
-
"vite-plus": "latest",
|
|
105
|
-
"tailwindcss": "latest",
|
|
106
|
-
"@tailwindcss/vite": "latest",
|
|
107
|
-
"babel-plugin-react-compiler": "latest"
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
if (pkg.pnpm && pkg.pnpm.overrides) {
|
|
111
|
-
pkg.pnpm.overrides.vite = "npm:@voidzero-dev/vite-plus-core@latest";
|
|
112
|
-
pkg.pnpm.overrides.vitest = "npm:@voidzero-dev/vite-plus-test@latest";
|
|
84
|
+
pkg.pnpm = {
|
|
85
|
+
...pkg.pnpm,
|
|
86
|
+
overrides: {
|
|
87
|
+
...pkg.pnpm?.overrides,
|
|
88
|
+
vite: "npm:@voidzero-dev/vite-plus-core@latest",
|
|
89
|
+
vitest: "npm:@voidzero-dev/vite-plus-test@latest",
|
|
113
90
|
}
|
|
114
|
-
|
|
115
|
-
}
|
|
91
|
+
};
|
|
92
|
+
await fs.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
93
|
+
|
|
94
|
+
const mainFile = project.framework === "vue" ? "src/main.ts" : "src/main.tsx";
|
|
95
|
+
const mainPath = path.join(targetDir, mainFile);
|
|
96
|
+
const viteConfigPath = path.join(targetDir, "vite.config.ts");
|
|
97
|
+
const stylePath = path.join(targetDir, "src/style.css");
|
|
98
|
+
|
|
99
|
+
let mainContent = await fs.readFile(mainPath, "utf-8");
|
|
100
|
+
let viteContent = await fs.readFile(viteConfigPath, "utf-8");
|
|
101
|
+
|
|
102
|
+
if (isUno) {
|
|
103
|
+
const unoConfig = `import { defineConfig, presetWind3, transformerCompileClass } from 'unocss'
|
|
104
|
+
|
|
105
|
+
export default defineConfig({
|
|
106
|
+
presets: [presetWind3()],
|
|
107
|
+
transformers: [
|
|
108
|
+
{
|
|
109
|
+
name: 'auto-uno-injector',
|
|
110
|
+
enforce: 'pre',
|
|
111
|
+
idFilter(id) {
|
|
112
|
+
return id.match(/\\.[tj]sx$|\\.vue$/)
|
|
113
|
+
},
|
|
114
|
+
async transform(code) {
|
|
115
|
+
const classRegex = /(?:class|className)=["']([^"']+)["']/g
|
|
116
|
+
let match
|
|
117
|
+
while ((match = classRegex.exec(code.original))) {
|
|
118
|
+
const content = match[1]
|
|
119
|
+
if (content.trim() && !content.includes(':uno:')) {
|
|
120
|
+
const insertPos = match.index + match[0].indexOf(content)
|
|
121
|
+
code.appendLeft(insertPos, ':uno: ')
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
transformerCompileClass({
|
|
127
|
+
classPrefix: 'kfc-',
|
|
128
|
+
}),
|
|
129
|
+
],
|
|
130
|
+
})\n
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
await fs.writeFile(path.join(targetDir, "uno.config.ts"), unoConfig);
|
|
134
|
+
|
|
135
|
+
mainContent = `import 'virtual:uno.css'\n` + mainContent;
|
|
136
|
+
viteContent = `import UnoCSS from 'unocss/vite'\n` + viteContent;
|
|
137
|
+
viteContent = viteContent.replace(/plugins:\s*\[/, "plugins: [UnoCSS(), ");
|
|
138
|
+
|
|
139
|
+
if (fs.existsSync(stylePath)) await fs.remove(stylePath);
|
|
140
|
+
} else {
|
|
141
|
+
await fs.writeFile(stylePath, `@import "tailwindcss";`);
|
|
116
142
|
|
|
117
|
-
|
|
118
|
-
|
|
143
|
+
mainContent = `import './style.css'\n` + mainContent;
|
|
144
|
+
viteContent = `import tailwindcss from '@tailwindcss/vite'\n` + viteContent;
|
|
145
|
+
viteContent = viteContent.replace(/plugins:\s*\[/, "plugins: [tailwindcss(), ");
|
|
146
|
+
}
|
|
119
147
|
|
|
120
|
-
|
|
148
|
+
await fs.writeFile(mainPath, mainContent);
|
|
149
|
+
await fs.writeFile(viteConfigPath, viteContent);
|
|
121
150
|
|
|
122
|
-
const
|
|
123
|
-
|
|
151
|
+
const toRemove = ["pnpm-lock.yaml", "node_modules", "dist"];
|
|
152
|
+
await Promise.all(toRemove.map((file) => fs.remove(path.join(targetDir, file))));
|
|
124
153
|
|
|
125
|
-
|
|
126
|
-
pc.cyan(`${cdCmd}vp install\nvp dev`),
|
|
127
|
-
'快速开始指南'
|
|
128
|
-
);
|
|
154
|
+
s.stop(pc.green("装配完成!"));
|
|
129
155
|
|
|
130
|
-
p.
|
|
131
|
-
|
|
132
|
-
`${pc.gray(' ==== VitePlus + OXC + React ====')}`
|
|
133
|
-
);
|
|
156
|
+
p.note(pc.cyan(`cd ${project.path}\nvp install\nvp dev`), "快速开始");
|
|
157
|
+
p.outro(`${pc.magenta("✨ 已经为你准备好了极致的开发环境!")}\n${pc.gray(`==== ${project.framework} + ${project.cssEngine} ====`)}`);
|
|
134
158
|
|
|
135
159
|
} catch (err) {
|
|
136
|
-
s.stop(
|
|
137
|
-
console.error(
|
|
160
|
+
s.stop(pc.red("手术失败"));
|
|
161
|
+
console.error(err);
|
|
138
162
|
process.exit(1);
|
|
139
163
|
}
|
|
140
164
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-lve",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-lve": "index.js"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"index.js",
|
|
10
|
-
"template"
|
|
10
|
+
"template-react",
|
|
11
|
+
"template-vue"
|
|
11
12
|
],
|
|
12
13
|
"dependencies": {
|
|
13
14
|
"@clack/prompts": "^1.1.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vp staged
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>react-project</title>
|
|
8
8
|
</head>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="46" fill="none" viewBox="0 0 48 46"><path fill="#863bff" d="M25.946 44.938c-.664.845-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.287c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.497 0-3.578-1.842-3.578H1.237c-.92 0-1.456-1.04-.92-1.788L10.013.474c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.579 1.842 3.579h11.377c.943 0 1.473 1.088.89 1.83L25.947 44.94z" style="fill:#863bff;fill:color(display-p3 .5252 .23 1);fill-opacity:1"/><mask id="a" width="48" height="46" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M25.842 44.938c-.664.844-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.183c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.498 0-3.579-1.842-3.579H1.133c-.92 0-1.456-1.04-.92-1.787L9.91.473c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.578 1.842 3.578h11.377c.943 0 1.473 1.088.89 1.832L25.843 44.94z" style="fill:#000;fill-opacity:1"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#ede6ff" rx="5.508" ry="14.704" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -4.47 31.516)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#ede6ff" rx="10.399" ry="29.851" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -39.328 7.883)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#7e14ff" rx="5.508" ry="30.487" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -25.913 -14.639)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -32.644 -3.334)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -34.34 30.47)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#ede6ff" rx="14.072" ry="22.078" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="rotate(93.35 24.506 48.493)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx=".387" cy="8.972" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(39.51 .387 8.972)"/></g><g filter="url(#k)"><ellipse cx="47.523" cy="-6.092" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 47.523 -6.092)"/></g><g filter="url(#l)"><ellipse cx="41.412" cy="6.333" fill="#47bfff" rx="5.971" ry="9.665" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 41.412 6.333)"/></g><g filter="url(#m)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#n)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#o)"><ellipse cx="35.651" cy="29.907" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 35.651 29.907)"/></g><g filter="url(#p)"><ellipse cx="38.418" cy="32.4" fill="#47bfff" rx="5.971" ry="15.297" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 38.418 32.4)"/></g></g><defs><filter id="b" width="60.045" height="41.654" x="-19.77" y="16.149" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-54.613" y="-7.533" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="d" width="79.355" height="29.4" x="-49.64" y="2.03" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="e" width="79.579" height="29.4" x="-45.045" y="20.029" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="f" width="79.579" height="29.4" x="-43.513" y="21.178" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="g" width="74.749" height="58.852" x="15.756" y="-17.901" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="h" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="i" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="j" width="56.045" height="63.649" x="-27.636" y="-22.853" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="k" width="54.814" height="64.646" x="20.116" y="-38.415" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="l" width="33.541" height="35.313" x="24.641" y="-11.323" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="m" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="n" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="o" width="54.814" height="64.646" x="8.244" y="-2.416" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="p" width="39.409" height="43.623" x="18.713" y="10.588" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter></defs></svg>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import reactLogo from './assets/react.svg'
|
|
3
|
+
|
|
4
|
+
export function App() {
|
|
5
|
+
const [count, setCount] = useState(0)
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div className="max-w-7xl mx-auto p-8 text-center font-sans antialiased text-[#213547] dark:text-zinc-200 min-h-dvh flex flex-col justify-center items-center">
|
|
9
|
+
<div className="flex justify-center gap-12 mb-12">
|
|
10
|
+
<a
|
|
11
|
+
href="https://viteplus.dev"
|
|
12
|
+
target="_blank"
|
|
13
|
+
rel="noreferrer"
|
|
14
|
+
className="transition-all duration-300 hover:drop-shadow-[0_0_2em_#646cffaa]"
|
|
15
|
+
>
|
|
16
|
+
<img src="/favicon.svg" className="h-24 p-6" alt="VitePlus logo" />
|
|
17
|
+
</a>
|
|
18
|
+
<a
|
|
19
|
+
href="https://react.dev"
|
|
20
|
+
target="_blank"
|
|
21
|
+
rel="noreferrer"
|
|
22
|
+
className="transition-all duration-300 hover:drop-shadow-[0_0_2em_#61dafbaa]"
|
|
23
|
+
>
|
|
24
|
+
<img src={reactLogo} className="h-24 p-6 animate-[spin_20s_linear_infinite]" alt="React logo" />
|
|
25
|
+
</a>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<h1 className="text-5xl font-bold leading-[1.1] mb-8">VitePlus + React</h1>
|
|
29
|
+
|
|
30
|
+
<div className="p-8 space-y-4 flex flex-col items-center">
|
|
31
|
+
<button
|
|
32
|
+
onClick={() => setCount((count) => count + 1)}
|
|
33
|
+
className="rounded-lg border border-transparent px-5 py-2.5 text-base font-medium bg-[#f9f9f9] dark:bg-zinc-800 cursor-pointer transition-colors hover:border-[#646cff] outline-none"
|
|
34
|
+
>
|
|
35
|
+
count is {count}
|
|
36
|
+
</button>
|
|
37
|
+
<p className="text-zinc-500">
|
|
38
|
+
Edit <code className="bg-[#f1f1f1] dark:bg-zinc-800 px-1.5 py-0.5 rounded font-mono">src/App.tsx</code> to test HMR
|
|
39
|
+
</p>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<p className="text-[#888] mt-8">
|
|
43
|
+
Check out <a href="https://github.com/voidzero-dev/vite-plus" target="_blank" rel="noreferrer" className="font-medium text-[#646cff] hover:text-[#535bf2]">VitePlus</a>, the unified toolchain for the web.
|
|
44
|
+
</p>
|
|
45
|
+
|
|
46
|
+
<p className="text-[#888] mt-4 text-sm">
|
|
47
|
+
Click on the VitePlus and React logos to learn more
|
|
48
|
+
</p>
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
File without changes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineConfig } from "vite-plus"
|
|
2
2
|
import react from "@vitejs/plugin-react"
|
|
3
|
-
import tailwindcss from '@tailwindcss/vite'
|
|
4
3
|
|
|
5
4
|
// https://vite.dev/config/
|
|
6
5
|
export default defineConfig({
|
|
@@ -16,7 +15,6 @@ export default defineConfig({
|
|
|
16
15
|
["babel-plugin-react-compiler", { target: "19" }]
|
|
17
16
|
],
|
|
18
17
|
},
|
|
19
|
-
} as any),
|
|
20
|
-
tailwindcss()
|
|
18
|
+
} as any),
|
|
21
19
|
],
|
|
22
20
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vp staged
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>vite-project</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-app",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vp dev",
|
|
8
|
+
"build": "vue-tsc -b && vp build",
|
|
9
|
+
"preview": "vp preview",
|
|
10
|
+
"prepare": "vp config"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"vue": "latest"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/node": "^24.12.2",
|
|
17
|
+
"@vitejs/plugin-vue": "^6.0.5",
|
|
18
|
+
"@vue/tsconfig": "^0.9.1",
|
|
19
|
+
"typescript": "~6.0.2",
|
|
20
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
21
|
+
"vite-plus": "latest",
|
|
22
|
+
"vue-tsc": "^3.2.6"
|
|
23
|
+
},
|
|
24
|
+
"packageManager": "pnpm@10.33.0",
|
|
25
|
+
"pnpm": {
|
|
26
|
+
"overrides": {
|
|
27
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
28
|
+
"vitest": "npm:@voidzero-dev/vite-plus-test@latest"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|