@luxkit/cli 1.0.0 → 1.0.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 +82 -86
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,45 +4,41 @@
|
|
|
4
4
|
|
|
5
5
|
**One-click project formatting & VSCode config CLI**
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/@luxkit/cli)
|
|
8
8
|
[](https://nodejs.org/)
|
|
9
9
|
[](https://opensource.org/licenses/ISC)
|
|
10
10
|
[](https://www.typescriptlang.org/)
|
|
11
11
|
[](https://nodejs.org/api/esm.html)
|
|
12
12
|
|
|
13
|
-
<br />
|
|
14
|
-
|
|
15
13
|
<a href="#-english">English</a> | <a href="#-中文">中文</a>
|
|
16
14
|
|
|
17
15
|
</div>
|
|
18
16
|
|
|
19
17
|
---
|
|
20
18
|
|
|
21
|
-
<br />
|
|
22
|
-
|
|
23
19
|
## 🇬🇧 English
|
|
24
20
|
|
|
25
|
-
<br />
|
|
26
|
-
|
|
27
21
|
### What is lux?
|
|
28
22
|
|
|
29
23
|
`lux` is a CLI tool that initializes project formatting configs and VSCode workspace settings with a single command. It generates ESLint, Prettier, Stylelint, CSpell, EditorConfig files and VSCode settings from battle-tested presets — with smart merge and conflict resolution.
|
|
30
24
|
|
|
31
|
-
<
|
|
25
|
+
<div align="center">
|
|
26
|
+
<img src="demo.gif" alt="lux demo" width="640" />
|
|
27
|
+
</div>
|
|
32
28
|
|
|
33
29
|
### ✨ Key Highlights
|
|
34
30
|
|
|
35
|
-
| Feature
|
|
36
|
-
|
|
37
|
-
| 🎯 **One Command Setup**
|
|
38
|
-
| 🔧 **5 Fmt Presets**
|
|
39
|
-
| 🖥️ **6 VSCode Presets**
|
|
40
|
-
| 🔀 **Smart Merge**
|
|
41
|
-
| 🛡️ **Conflict Resolution** | `neverOverwrite` / `forceOverwrite` lists + `--force` flag
|
|
42
|
-
| 📦 **Auto Install**
|
|
43
|
-
| 🔍 **Fuzzy Matching**
|
|
44
|
-
| 🧪 **Dry Run**
|
|
45
|
-
| 🔗 **Script Injection**
|
|
31
|
+
| Feature | Description |
|
|
32
|
+
| :------------------------- | :----------------------------------------------------------------------------- |
|
|
33
|
+
| 🎯 **One Command Setup** | `lux fmt init web` generates all linting & formatting configs instantly |
|
|
34
|
+
| 🔧 **5 Fmt Presets** | `web` · `electron` · `uniapp` · `node` · `nest` — each with curated rules |
|
|
35
|
+
| 🖥️ **6 VSCode Presets** | `web` · `electron` · `uniapp` · `node` · `nest` · `go` — settings + extensions |
|
|
36
|
+
| 🔀 **Smart Merge** | Preset wins for linting keys; user wins for personal preferences |
|
|
37
|
+
| 🛡️ **Conflict Resolution** | `neverOverwrite` / `forceOverwrite` lists + `--force` flag |
|
|
38
|
+
| 📦 **Auto Install** | Detects bun / pnpm / yarn / npm and installs devDependencies |
|
|
39
|
+
| 🔍 **Fuzzy Matching** | Typo a preset name? Levenshtein distance finds the closest match |
|
|
40
|
+
| 🧪 **Dry Run** | Preview all changes with `--dry-run` before writing anything |
|
|
41
|
+
| 🔗 **Script Injection** | Auto-injects `<pm> lint` / `<pm> format` scripts into package.json |
|
|
46
42
|
|
|
47
43
|
<br />
|
|
48
44
|
|
|
@@ -50,9 +46,9 @@
|
|
|
50
46
|
|
|
51
47
|
```bash
|
|
52
48
|
# Install globally (pick your package manager)
|
|
53
|
-
npm install -g
|
|
49
|
+
npm install -g @luxkit/cli
|
|
54
50
|
# or
|
|
55
|
-
bun add -g
|
|
51
|
+
bun add -g @luxkit/cli
|
|
56
52
|
|
|
57
53
|
# Initialize formatting configs
|
|
58
54
|
lux fmt init web # Generate ESLint, Prettier, Stylelint, CSpell, EditorConfig
|
|
@@ -69,27 +65,27 @@ lux vscode list
|
|
|
69
65
|
|
|
70
66
|
### CLI Commands
|
|
71
67
|
|
|
72
|
-
| Command
|
|
73
|
-
|
|
74
|
-
| `lux fmt init <preset>`
|
|
75
|
-
| `lux fmt list`
|
|
76
|
-
| `lux vscode init <preset>` | Initialize VSCode workspace settings
|
|
77
|
-
| `lux vscode list`
|
|
78
|
-
| `lux vpn cmd`
|
|
79
|
-
| `lux vpn pw`
|
|
68
|
+
| Command | Description |
|
|
69
|
+
| :------------------------- | :------------------------------------------ |
|
|
70
|
+
| `lux fmt init <preset>` | Initialize formatting config files |
|
|
71
|
+
| `lux fmt list` | List available fmt presets |
|
|
72
|
+
| `lux vscode init <preset>` | Initialize VSCode workspace settings |
|
|
73
|
+
| `lux vscode list` | List available VSCode presets |
|
|
74
|
+
| `lux vpn cmd` | Copy CMD proxy env-vars to clipboard |
|
|
75
|
+
| `lux vpn pw` | Copy PowerShell proxy env-vars to clipboard |
|
|
80
76
|
|
|
81
77
|
<br />
|
|
82
78
|
|
|
83
79
|
### Available Presets
|
|
84
80
|
|
|
85
|
-
| Preset
|
|
86
|
-
|
|
87
|
-
| `web`
|
|
88
|
-
| `electron` | ✅
|
|
89
|
-
| `uniapp`
|
|
90
|
-
| `node`
|
|
91
|
-
| `nest`
|
|
92
|
-
| `go`
|
|
81
|
+
| Preset | Fmt | VSCode | Stack |
|
|
82
|
+
| :--------- | :-: | :----: | :--------------------------- |
|
|
83
|
+
| `web` | ✅ | ✅ | Vue / React / TS / CSS |
|
|
84
|
+
| `electron` | ✅ | ✅ | Electron + Web stack |
|
|
85
|
+
| `uniapp` | ✅ | ✅ | UniApp / WeChat Mini Program |
|
|
86
|
+
| `node` | ✅ | ✅ | Node.js backend |
|
|
87
|
+
| `nest` | ✅ | ✅ | NestJS backend |
|
|
88
|
+
| `go` | — | ✅ | Go backend |
|
|
93
89
|
|
|
94
90
|
<br />
|
|
95
91
|
|
|
@@ -132,15 +128,15 @@ lux fmt init web
|
|
|
132
128
|
|
|
133
129
|
### Tech Stack
|
|
134
130
|
|
|
135
|
-
| Category | Technology
|
|
136
|
-
|
|
137
|
-
| Language | TypeScript 6.0 (ESM-only)
|
|
138
|
-
| Runtime
|
|
139
|
-
| Build
|
|
140
|
-
| Test
|
|
141
|
-
| CLI
|
|
142
|
-
| Output
|
|
143
|
-
| Bundle
|
|
131
|
+
| Category | Technology |
|
|
132
|
+
| :------- | :----------------------------------------- |
|
|
133
|
+
| Language | TypeScript 6.0 (ESM-only) |
|
|
134
|
+
| Runtime | Node.js 18+ |
|
|
135
|
+
| Build | tsup |
|
|
136
|
+
| Test | Vitest (unit + acceptance) |
|
|
137
|
+
| CLI | Commander.js |
|
|
138
|
+
| Output | Chalk |
|
|
139
|
+
| Bundle | Zero runtime deps (chalk + commander only) |
|
|
144
140
|
|
|
145
141
|
<br />
|
|
146
142
|
|
|
@@ -175,27 +171,27 @@ bun code:check:all # lint + format + spell check
|
|
|
175
171
|
|
|
176
172
|
## 🇨🇳 中文
|
|
177
173
|
|
|
178
|
-
<br />
|
|
179
|
-
|
|
180
174
|
### lux 是什么?
|
|
181
175
|
|
|
182
176
|
`lux` 是一个 CLI 工具,只需一条命令即可初始化项目格式化配置和 VSCode 工作区设置。它从经过实战检验的预设中生成 ESLint、Prettier、Stylelint、CSpell、EditorConfig 配置文件以及 VSCode 设置 —— 并带有智能合并和冲突解决机制。
|
|
183
177
|
|
|
184
|
-
<
|
|
178
|
+
<div align="center">
|
|
179
|
+
<img src="demo.gif" alt="lux 演示" width="640" />
|
|
180
|
+
</div>
|
|
185
181
|
|
|
186
182
|
### ✨ 核心亮点
|
|
187
183
|
|
|
188
|
-
| 特性
|
|
189
|
-
|
|
190
|
-
| 🎯 **一键配置**
|
|
191
|
-
| 🔧 **5 种格式化预设**
|
|
184
|
+
| 特性 | 说明 |
|
|
185
|
+
| :---------------------- | :----------------------------------------------------------------------- |
|
|
186
|
+
| 🎯 **一键配置** | `lux fmt init web` 即可生成所有 lint 与格式化配置 |
|
|
187
|
+
| 🔧 **5 种格式化预设** | `web` · `electron` · `uniapp` · `node` · `nest` — 各配备精选规则 |
|
|
192
188
|
| 🖥️ **6 种 VSCode 预设** | `web` · `electron` · `uniapp` · `node` · `nest` · `go` — 设置 + 扩展推荐 |
|
|
193
|
-
| 🔀 **智能合并**
|
|
194
|
-
| 🛡️ **冲突解决**
|
|
195
|
-
| 📦 **自动安装**
|
|
196
|
-
| 🔍 **模糊匹配**
|
|
197
|
-
| 🧪 **Dry Run**
|
|
198
|
-
| 🔗 **脚本注入**
|
|
189
|
+
| 🔀 **智能合并** | 预设优先覆盖 linting 相关键;用户配置优先保留个人偏好 |
|
|
190
|
+
| 🛡️ **冲突解决** | `neverOverwrite` / `forceOverwrite` 列表 + `--force` 标志 |
|
|
191
|
+
| 📦 **自动安装** | 自动检测 bun / pnpm / yarn / npm 并安装 devDependencies |
|
|
192
|
+
| 🔍 **模糊匹配** | 预设名拼错了?Levenshtein 距离帮你找到最接近的匹配 |
|
|
193
|
+
| 🧪 **Dry Run** | 使用 `--dry-run` 预览所有变更,不写入任何文件 |
|
|
194
|
+
| 🔗 **脚本注入** | 自动将 `<pm> lint` / `<pm> format` 脚本注入 package.json |
|
|
199
195
|
|
|
200
196
|
<br />
|
|
201
197
|
|
|
@@ -203,9 +199,9 @@ bun code:check:all # lint + format + spell check
|
|
|
203
199
|
|
|
204
200
|
```bash
|
|
205
201
|
# 全局安装(选择你的包管理器)
|
|
206
|
-
npm install -g
|
|
202
|
+
npm install -g @luxkit/cli
|
|
207
203
|
# 或
|
|
208
|
-
bun add -g
|
|
204
|
+
bun add -g @luxkit/cli
|
|
209
205
|
|
|
210
206
|
# 初始化格式化配置
|
|
211
207
|
lux fmt init web # 生成 ESLint、Prettier、Stylelint、CSpell、EditorConfig
|
|
@@ -222,27 +218,27 @@ lux vscode list
|
|
|
222
218
|
|
|
223
219
|
### CLI 命令
|
|
224
220
|
|
|
225
|
-
| 命令
|
|
226
|
-
|
|
227
|
-
| `lux fmt init <preset>`
|
|
228
|
-
| `lux fmt list`
|
|
229
|
-
| `lux vscode init <preset>` | 初始化 VSCode 工作区设置
|
|
230
|
-
| `lux vscode list`
|
|
231
|
-
| `lux vpn cmd`
|
|
232
|
-
| `lux vpn pw`
|
|
221
|
+
| 命令 | 说明 |
|
|
222
|
+
| :------------------------- | :----------------------------------- |
|
|
223
|
+
| `lux fmt init <preset>` | 初始化格式化配置文件 |
|
|
224
|
+
| `lux fmt list` | 列出可用的格式化预设 |
|
|
225
|
+
| `lux vscode init <preset>` | 初始化 VSCode 工作区设置 |
|
|
226
|
+
| `lux vscode list` | 列出可用的 VSCode 预设 |
|
|
227
|
+
| `lux vpn cmd` | 复制 CMD 代理环境变量到剪贴板 |
|
|
228
|
+
| `lux vpn pw` | 复制 PowerShell 代理环境变量到剪贴板 |
|
|
233
229
|
|
|
234
230
|
<br />
|
|
235
231
|
|
|
236
232
|
### 可用预设
|
|
237
233
|
|
|
238
|
-
| 预设
|
|
239
|
-
|
|
240
|
-
| `web`
|
|
241
|
-
| `electron` |
|
|
242
|
-
| `uniapp`
|
|
243
|
-
| `node`
|
|
244
|
-
| `nest`
|
|
245
|
-
| `go`
|
|
234
|
+
| 预设 | 格式化 | VSCode | 技术栈 |
|
|
235
|
+
| :--------- | :----: | :----: | :--------------------- |
|
|
236
|
+
| `web` | ✅ | ✅ | Vue / React / TS / CSS |
|
|
237
|
+
| `electron` | ✅ | ✅ | Electron + Web 技术栈 |
|
|
238
|
+
| `uniapp` | ✅ | ✅ | UniApp / 微信小程序 |
|
|
239
|
+
| `node` | ✅ | ✅ | Node.js 后端 |
|
|
240
|
+
| `nest` | ✅ | ✅ | NestJS 后端 |
|
|
241
|
+
| `go` | — | ✅ | Go 后端 |
|
|
246
242
|
|
|
247
243
|
<br />
|
|
248
244
|
|
|
@@ -285,15 +281,15 @@ lux fmt init web
|
|
|
285
281
|
|
|
286
282
|
### 技术栈
|
|
287
283
|
|
|
288
|
-
| 分类
|
|
289
|
-
|
|
290
|
-
| 语言
|
|
291
|
-
| 运行时 | Node.js 18+
|
|
292
|
-
| 构建
|
|
293
|
-
| 测试
|
|
294
|
-
| CLI
|
|
295
|
-
| 输出
|
|
296
|
-
| 依赖
|
|
284
|
+
| 分类 | 技术 |
|
|
285
|
+
| :----- | :----------------------------------- |
|
|
286
|
+
| 语言 | TypeScript 6.0(纯 ESM) |
|
|
287
|
+
| 运行时 | Node.js 18+ |
|
|
288
|
+
| 构建 | tsup |
|
|
289
|
+
| 测试 | Vitest(单元测试 + 验收测试) |
|
|
290
|
+
| CLI | Commander.js |
|
|
291
|
+
| 输出 | Chalk |
|
|
292
|
+
| 依赖 | 零运行时依赖(仅 chalk + commander) |
|
|
297
293
|
|
|
298
294
|
<br />
|
|
299
295
|
|