create-lve 0.1.3 → 0.1.5

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 CHANGED
@@ -11,15 +11,25 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
11
  async function main() {
12
12
  console.clear();
13
13
 
14
- p.intro(`${pc.bgCyan(pc.black(' LVE-CLI '))}${pc.gray(' - 快速构建 React + Tailwind 项目')}`);
14
+ p.intro(
15
+ `${pc.bgCyan(pc.black(' LVE-CLI '))} ` +
16
+ pc.gray('The Ultra-Fast React Stack (') +
17
+ pc.blue('Vite') + pc.gray(' + ') +
18
+ pc.yellow('Oxc') + pc.gray(' + ') +
19
+ pc.cyan('Tailwind') + pc.gray(')')
20
+ );
15
21
 
16
22
  const project = await p.group(
17
23
  {
18
24
  path: () =>
19
25
  p.text({
20
- message: '项目存储路径?',
21
- placeholder: './lve-project',
22
- defaultValue: 'lve-project',
26
+ message: '你的项目叫什么名字?',
27
+ placeholder: 'react-app',
28
+ defaultValue: 'react-app',
29
+ validate: (value) => {
30
+ if (!value || value.length === 0) return;
31
+ if (value.match(/[<>:"|?*]/)) return '路径包含非法字符';
32
+ }
23
33
  }),
24
34
  shouldOverwrite: ({ results }) => {
25
35
  const targetDir = path.resolve(process.cwd(), results.path);
@@ -62,6 +72,9 @@ async function main() {
62
72
  const renameMap = {
63
73
  '_package.json': 'package.json',
64
74
  '_gitignore': '.gitignore',
75
+ '_oxfmtrc.json': '.oxfmtrc.json',
76
+ '_oxlintrc.json': '.oxlintrc.json',
77
+ '_vscode': '.vscode',
65
78
  };
66
79
 
67
80
  for (const [oldFile, newFile] of Object.entries(renameMap)) {
@@ -78,7 +91,8 @@ async function main() {
78
91
  await fs.writeJson(pkgPath, pkg, { spaces: 2 });
79
92
  }
80
93
 
81
- await fs.remove(path.join(targetDir, 'pnpm-lock.yaml'));
94
+ const toRemove = ['pnpm-lock.yaml', 'node_modules', 'dist'];
95
+ await Promise.all(toRemove.map(file => fs.remove(path.join(targetDir, file))));
82
96
 
83
97
  s.stop(pc.green('项目准备就绪!'));
84
98
 
@@ -90,7 +104,10 @@ async function main() {
90
104
  '快速开始指南'
91
105
  );
92
106
 
93
- p.outro(pc.magenta('✨ Happy Coding with LVE + Tailwind!'));
107
+ p.outro(
108
+ `${pc.magenta('✨ Happy Coding!')}\n` +
109
+ `${pc.gray('已为你配置 OXC 规则:享受秒级校验与格式化。')}`
110
+ );
94
111
 
95
112
  } catch (err) {
96
113
  s.stop('失败');
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "create-lve",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-lve": "index.js"
7
7
  },
8
8
  "files": [
9
9
  "index.js",
10
- "template",
11
- "dist"
10
+ "template"
12
11
  ],
13
12
  "dependencies": {
14
13
  "@clack/prompts": "^1.1.0",
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
+ "semi": false,
4
+ "singleQuote": true,
5
+ "bracketSpacing": true,
6
+ "tabWidth": 2,
7
+ "useTabs": false,
8
+ "ignorePatterns": ["node_modules/**", "dist/**", "public/**", "*.min.js"]
9
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "categories": {
4
+ "correctness": "warn",
5
+ "perf": "warn",
6
+ "suspicious": "warn",
7
+ "pedantic": "allow"
8
+ },
9
+ "rules": {
10
+ "eslint/no-unused-vars": "error",
11
+ "react/jsx-no-target-blank": "error",
12
+ "react-hooks/rules-of-hooks": "error"
13
+ },
14
+ "ignorePatterns": ["dist/**", "coverage/**", "vendor/**", "test/snapshots/**"]
15
+ }
@@ -10,7 +10,7 @@
10
10
  "preview": "vite preview",
11
11
  "lint": "oxlint",
12
12
  "lint:fix": "oxlint --fix",
13
- "format": "oxfmt src/",
13
+ "format": "oxfmt .",
14
14
  "format:check": "oxfmt --check"
15
15
  },
16
16
  "dependencies": {
@@ -24,7 +24,6 @@
24
24
  "@types/react": "^19.2.7",
25
25
  "@types/react-dom": "^19.2.3",
26
26
  "@vitejs/plugin-react": "^5.1.1",
27
- "globals": "^16.5.0",
28
27
  "oxfmt": "^0.36.0",
29
28
  "oxlint": "^1.52.0",
30
29
  "typescript": "~5.9.3",
@@ -0,0 +1,10 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.defaultFormatter": "oxc.oxc-vscode",
4
+ "[json]": {
5
+ "editor.defaultFormatter": "oxc.oxc-vscode"
6
+ },
7
+ "[jsonc]": {
8
+ "editor.defaultFormatter": "oxc.oxc-vscode"
9
+ }
10
+ }
@@ -1,5 +1,21 @@
1
+ import { useState } from 'react'
2
+
1
3
  function App() {
2
- return <div className="text-5xl font-semibold text-center">You did it!</div>
4
+ const [count, setCount] = useState(0)
5
+
6
+ console.log(`%cApp Comp re-render`, 'background-color:blue;color:white;padding:20px;')
7
+ return (
8
+ <div className="min-h-screen flex flex-col gap-6 justify-center items-center">
9
+ <p className="text-6xl">{count}</p>
10
+ <button
11
+ className="px-6 py-2 text-white bg-zinc-900 hover:bg-zinc-900/60 rounded-3xl"
12
+ disabled={count < 0}
13
+ onClick={() => setCount((pre) => pre + 1)}
14
+ >
15
+ increment
16
+ </button>
17
+ </div>
18
+ )
3
19
  }
4
20
 
5
21
  export default App
@@ -1,10 +1,10 @@
1
- import { StrictMode } from "react";
2
- import { createRoot } from "react-dom/client";
3
- import "./index.css";
4
- import App from "./App.tsx";
1
+ import { StrictMode } from 'react'
2
+ import { createRoot } from 'react-dom/client'
3
+ import './index.css'
4
+ import App from './App.tsx'
5
5
 
6
- createRoot(document.getElementById("root")!).render(
6
+ createRoot(document.getElementById('root')!).render(
7
7
  <StrictMode>
8
8
  <App />
9
9
  </StrictMode>,
10
- );
10
+ )
@@ -1,8 +1,8 @@
1
- import { defineConfig } from "vite";
2
- import react from "@vitejs/plugin-react";
3
- import tailwindcss from "@tailwindcss/vite";
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+ import tailwindcss from '@tailwindcss/vite'
4
4
 
5
5
  // https://vite.dev/config/
6
6
  export default defineConfig({
7
7
  plugins: [react(), tailwindcss()],
8
- });
8
+ })
@@ -1,5 +0,0 @@
1
- {
2
- "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
- "semi": false,
4
- "singleQuote": true
5
- }