@varlet/cli 3.14.1 → 3.15.0-alpha.1776572752298
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 +27 -42
- package/README.zh-CN.md +27 -42
- package/lib/client/index.js +1 -1
- package/lib/node/bin.js +18 -9
- package/lib/node/commands/build.js +1 -1
- package/lib/node/commands/dev.js +1 -1
- package/lib/node/commands/extension.js +1 -1
- package/lib/node/commands/test.js +2 -5
- package/lib/node/commands/vite.js +1 -1
- package/lib/node/compiler/compileModule.js +1 -1
- package/lib/node/compiler/compileScript.d.ts +2 -2
- package/lib/node/config/varlet.config.d.ts +1 -1
- package/lib/node/config/vite.config.d.ts +1 -1
- package/lib/node/config/vitest.config.d.ts +1 -1
- package/lib/node/config/vitest.config.js +2 -6
- package/lib/node/shared/logger.d.ts +1 -0
- package/lib/node/shared/logger.js +3 -0
- package/package.json +17 -18
- package/template/create/__tests__/index.spec.js.ejs +1 -1
- package/template/generators/base/README.md +15 -7
- package/template/generators/base/package.json +19 -29
- package/template/generators/base/shims/shims-md.d.ts +3 -3
- package/template/generators/base/shims/shims-vue.d.ts +4 -4
- package/template/generators/base/tsconfig.json +2 -4
- package/template/generators/base/vite.config.ts +42 -0
- package/template/generators/config/default/sfc/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/default/sfc/src/utils/components.ts +1 -1
- package/template/generators/config/default/tsx/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/default/tsx/src/utils/components.ts +1 -1
- package/template/generators/config/i18n/sfc/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/sfc/src/locale/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/sfc/src/utils/components.ts +1 -1
- package/template/generators/config/i18n/tsx/src/button/Button.tsx +2 -2
- package/template/generators/config/i18n/tsx/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/tsx/src/locale/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/tsx/src/utils/components.ts +1 -1
- package/template/generators/base/eslint.config.js +0 -15
- package/template/generators/base/prettier.config.js +0 -3
package/README.md
CHANGED
|
@@ -20,6 +20,33 @@ The out-of-the-box `Vue3 component library` rapid prototyping tool provides a se
|
|
|
20
20
|
- 🌍 Support `Internationalization`
|
|
21
21
|
- 🚀 Based on `pnpm`
|
|
22
22
|
|
|
23
|
+
### Recommended toolchain
|
|
24
|
+
|
|
25
|
+
Under Varlet’s current **component-library toolchain**, we recommend combining **`@varlet/cli`**, **[vite-plus](https://viteplus.dev/)** (`vp`), and **rattail** (`rt`, npm package `rattail`): `@varlet/cli` covers first-party library workflows (docs, compile, tests, …), `vp` covers lint/format and app/extension build entrypoints aligned with the Ox/Rolldown stack, and `rt` covers `clean`, git hooks, `changelog`, `release`, `commit-lint`, and similar automation. Use this trio for **new libraries**, **scaffold upgrades**, or whenever you re-run **`varlet-cli gen`** to match the latest template.
|
|
26
|
+
|
|
27
|
+
| Piece | Role |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| **`@varlet/cli`** | First-party Varlet workflows: `create`, `gen`, `dev`, `build`, `preview`, `compile`, `compile:style-vars`, `build:icons`, `test`, … |
|
|
30
|
+
| **[vite-plus](https://viteplus.dev/)** (`vp`) | Lint, format, app/extension `build`/`dev`/`preview`, and other toolchain entrypoints aligned with the Ox/Rolldown stack |
|
|
31
|
+
| **rattail** (`rt`, npm package `rattail`) | `clean`, git hooks, `changelog`, `release`, `commit-lint`, and other repo automation |
|
|
32
|
+
|
|
33
|
+
After upgrading `@varlet/cli`, you can align an existing app with the **latest built-in template** by running **`varlet-cli gen`** again from the parent directory (commit or back up first; `gen` may overwrite generated files).
|
|
34
|
+
|
|
35
|
+
### Legacy subcommands (prefer alternatives)
|
|
36
|
+
|
|
37
|
+
These subcommands **still run** for backward compatibility and may print a deprecation notice. **Do not rely on them in new scripts or new projects** — prefer `vp` / `rt` (or `vr` where documented). Any future changes will be called out in release notes.
|
|
38
|
+
|
|
39
|
+
| Command | Use instead |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `varlet-cli dev:vite` | `vp dev` |
|
|
42
|
+
| `varlet-cli build:vite` | `vp build` |
|
|
43
|
+
| `varlet-cli dev:extension` | `vp pack --watch` (with a local `vite.config.ts` for the extension) |
|
|
44
|
+
| `varlet-cli build:extension` | `vp pack` |
|
|
45
|
+
| `varlet-cli commit-lint` | `rt commit-lint` |
|
|
46
|
+
| `varlet-cli checklist` | _(no direct replacement; optional manual checklist in docs)_ |
|
|
47
|
+
| `varlet-cli changelog` | `rt changelog` |
|
|
48
|
+
| `varlet-cli release` | `rt release` (or `vr release` from `@varlet/release`) |
|
|
49
|
+
|
|
23
50
|
### Quickstart
|
|
24
51
|
|
|
25
52
|
`@varlet/cli` has built-in `sfc` and `tsx` style component library project templates, which can be generated directly by the `gen` command.
|
|
@@ -157,20 +184,6 @@ varlet-cli compile
|
|
|
157
184
|
varlet-cli compile:style-vars
|
|
158
185
|
```
|
|
159
186
|
|
|
160
|
-
#### Run VSCode extension development environment
|
|
161
|
-
|
|
162
|
-
```shell
|
|
163
|
-
# playground-ignore
|
|
164
|
-
varlet-cli dev:extension
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
#### Build VSCode extension for production
|
|
168
|
-
|
|
169
|
-
```shell
|
|
170
|
-
# playground-ignore
|
|
171
|
-
varlet-cli build:extension
|
|
172
|
-
```
|
|
173
|
-
|
|
174
187
|
#### Build svg to web fonts
|
|
175
188
|
|
|
176
189
|
```shell
|
|
@@ -207,34 +220,6 @@ varlet-cli test -w
|
|
|
207
220
|
varlet-cli test -cov
|
|
208
221
|
```
|
|
209
222
|
|
|
210
|
-
#### Lint git commit message
|
|
211
|
-
|
|
212
|
-
```shell
|
|
213
|
-
# playground-ignore
|
|
214
|
-
varlet-cli commit-lint
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
#### Show checklist
|
|
218
|
-
|
|
219
|
-
```shell
|
|
220
|
-
# playground-ignore
|
|
221
|
-
varlet-cli checklist
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
#### Generate changelog
|
|
225
|
-
|
|
226
|
-
```shell
|
|
227
|
-
# playground-ignore
|
|
228
|
-
varlet-cli changelog
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
#### Release component library
|
|
232
|
-
|
|
233
|
-
```shell
|
|
234
|
-
# playground-ignore
|
|
235
|
-
varlet-cli release
|
|
236
|
-
```
|
|
237
|
-
|
|
238
223
|
#### Generate a project template
|
|
239
224
|
|
|
240
225
|
```shell
|
package/README.zh-CN.md
CHANGED
|
@@ -20,6 +20,33 @@
|
|
|
20
20
|
- 🌍 支持 `国际化`
|
|
21
21
|
- 🚀 基于 `pnpm`
|
|
22
22
|
|
|
23
|
+
### 推荐技术栈
|
|
24
|
+
|
|
25
|
+
在全新的 **Varlet 组件库工具链**体系下,我们建议将 **`@varlet/cli`**、**[vite-plus](https://viteplus.dev/)**(`vp`)与 **rattail**(`rt`,npm 包 `rattail`)组合使用:前者覆盖组件库文档站与编译等一等能力,后两者承接与 Ox / Rolldown 栈一致的 lint、format、打包入口,以及 `clean`、Git 钩子、`changelog`、`release`、`commit-lint` 等工程自动化。无论是从零搭建新库,还是升级旧脚手架、需要与模板对齐时,都推荐沿用这一组合。
|
|
26
|
+
|
|
27
|
+
| 部分 | 作用 |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| **`@varlet/cli`** | Varlet 一等能力:`create`、`gen`、`dev`、`build`、`preview`、`compile`、`compile:style-vars`、`build:icons`、`test` 等 |
|
|
30
|
+
| **[vite-plus](https://viteplus.dev/)**(`vp`) | 与 Ox / Rolldown 栈一致的 lint、format、应用/扩展的 `build`/`dev`/`preview` 等入口 |
|
|
31
|
+
| **rattail**(`rt`,npm 包 `rattail`) | `clean`、Git 钩子、`changelog`、`release`、`commit-lint` 等工程自动化 |
|
|
32
|
+
|
|
33
|
+
升级 `@varlet/cli` 后,可在上级目录再次执行 **`varlet-cli gen`**,将已有工程与**当前内置的最新模板**对齐(请先提交或备份;`gen` 可能覆盖生成型文件)。
|
|
34
|
+
|
|
35
|
+
### 不建议继续使用的子命令
|
|
36
|
+
|
|
37
|
+
以下子命令**仍可执行**(会给出废弃相关提示),但**不应在新脚本或新工程中再依赖**,请优先改用 `vp` / `rt`(或文档中的 `vr`)。具体时间表以后续发布说明为准。
|
|
38
|
+
|
|
39
|
+
| 命令 | 请改用 |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `varlet-cli dev:vite` | `vp dev` |
|
|
42
|
+
| `varlet-cli build:vite` | `vp build` |
|
|
43
|
+
| `varlet-cli dev:extension` | `vp pack --watch`(扩展包内需有本地 `vite.config.ts`) |
|
|
44
|
+
| `varlet-cli build:extension` | `vp pack` |
|
|
45
|
+
| `varlet-cli commit-lint` | `rt commit-lint` |
|
|
46
|
+
| `varlet-cli checklist` | 无直接替代;见贡献文档中的提交前说明 |
|
|
47
|
+
| `varlet-cli changelog` | `rt changelog` |
|
|
48
|
+
| `varlet-cli release` | `rt release`(或 `@varlet/release` 提供的 `vr release`) |
|
|
49
|
+
|
|
23
50
|
### 快速开始
|
|
24
51
|
|
|
25
52
|
`@varlet/cli` 内置了 `sfc` 和 `tsx` 两种风格的组件库项目模板,可以通过 `gen` 命令直接生成。
|
|
@@ -156,20 +183,6 @@ varlet-cli compile
|
|
|
156
183
|
varlet-cli compile:style-vars
|
|
157
184
|
```
|
|
158
185
|
|
|
159
|
-
#### 启动 VSCode 插件开发环境
|
|
160
|
-
|
|
161
|
-
```shell
|
|
162
|
-
# playground-ignore
|
|
163
|
-
varlet-cli dev:extension
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
#### 构建 VSCode 插件
|
|
167
|
-
|
|
168
|
-
```shell
|
|
169
|
-
# playground-ignore
|
|
170
|
-
varlet-cli build:extension
|
|
171
|
-
```
|
|
172
|
-
|
|
173
186
|
#### 打包字体图标
|
|
174
187
|
|
|
175
188
|
```shell
|
|
@@ -206,34 +219,6 @@ varlet-cli test -w
|
|
|
206
219
|
varlet-cli test -cov
|
|
207
220
|
```
|
|
208
221
|
|
|
209
|
-
#### 校验提交信息
|
|
210
|
-
|
|
211
|
-
```shell
|
|
212
|
-
# playground-ignore
|
|
213
|
-
varlet-cli commit-lint
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
#### 显示检查清单
|
|
217
|
-
|
|
218
|
-
```shell
|
|
219
|
-
# playground-ignore
|
|
220
|
-
varlet-cli checklist
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
#### 生成更新日志
|
|
224
|
-
|
|
225
|
-
```shell
|
|
226
|
-
# playground-ignore
|
|
227
|
-
varlet-cli changelog
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
#### 发布组件库
|
|
231
|
-
|
|
232
|
-
```shell
|
|
233
|
-
# playground-ignore
|
|
234
|
-
varlet-cli release
|
|
235
|
-
```
|
|
236
|
-
|
|
237
222
|
#### 生成一个项目模板
|
|
238
223
|
|
|
239
224
|
```shell
|
package/lib/client/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { onMounted, onUnmounted } from 'vue';
|
|
2
1
|
import config from '@config';
|
|
3
2
|
import { StyleProvider, Themes } from '@varlet/ui';
|
|
3
|
+
import { onMounted, onUnmounted } from 'vue';
|
|
4
4
|
import AppType from './appType';
|
|
5
5
|
export function getPCLocationInfo() {
|
|
6
6
|
const [, language, path] = window.location.hash.split('/');
|
package/lib/node/bin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import { getCliVersion } from './shared/fsUtils.js';
|
|
4
|
+
import { logDeprecated } from './shared/logger.js';
|
|
4
5
|
const program = new Command();
|
|
5
6
|
program.version(`varlet-cli ${getCliVersion()}`).usage('<command> [options]');
|
|
6
7
|
program
|
|
@@ -21,29 +22,33 @@ program
|
|
|
21
22
|
});
|
|
22
23
|
program
|
|
23
24
|
.command('dev:vite')
|
|
24
|
-
.description('Use vite start server for development')
|
|
25
|
+
.description('[Deprecated] Use vite start server for development. Use `vp dev` instead.')
|
|
25
26
|
.action(async () => {
|
|
27
|
+
logDeprecated('dev:vite', 'Use `vp dev` instead.');
|
|
26
28
|
const { vite } = await import('./commands/vite.js');
|
|
27
29
|
return vite('dev');
|
|
28
30
|
});
|
|
29
31
|
program
|
|
30
32
|
.command('build:vite')
|
|
31
|
-
.description('Use vite build app for production')
|
|
33
|
+
.description('[Deprecated] Use vite build app for production. Use `vp build` instead.')
|
|
32
34
|
.action(async () => {
|
|
35
|
+
logDeprecated('build:vite', 'Use `vp build` instead.');
|
|
33
36
|
const { vite } = await import('./commands/vite.js');
|
|
34
37
|
return vite('build');
|
|
35
38
|
});
|
|
36
39
|
program
|
|
37
40
|
.command('dev:extension')
|
|
38
|
-
.description('Run VSCode extension development environment')
|
|
41
|
+
.description('[Deprecated] Run VSCode extension development environment. Use `vp pack --watch` (or `tsdown --watch`) instead.')
|
|
39
42
|
.action(async () => {
|
|
43
|
+
logDeprecated('dev:extension', 'Use `vp pack --watch` (or `tsdown --watch`) instead.');
|
|
40
44
|
const { extension } = await import('./commands/extension.js');
|
|
41
45
|
return extension('dev');
|
|
42
46
|
});
|
|
43
47
|
program
|
|
44
48
|
.command('build:extension')
|
|
45
|
-
.description('Build VSCode extension for production')
|
|
49
|
+
.description('[Deprecated] Build VSCode extension for production. Use `vp pack` (or `tsdown`) instead.')
|
|
46
50
|
.action(async () => {
|
|
51
|
+
logDeprecated('build:extension', 'Use `vp pack` (or `tsdown`) instead.');
|
|
47
52
|
const { extension } = await import('./commands/extension.js');
|
|
48
53
|
return extension('build');
|
|
49
54
|
});
|
|
@@ -57,7 +62,7 @@ program
|
|
|
57
62
|
});
|
|
58
63
|
program
|
|
59
64
|
.command('preview')
|
|
60
|
-
.description('Preview varlet site for production')
|
|
65
|
+
.description('Preview varlet site for production.')
|
|
61
66
|
.option('-p, --port <port>', 'port number')
|
|
62
67
|
.action(async (options) => {
|
|
63
68
|
const { preview } = await import('./commands/preview.js');
|
|
@@ -114,16 +119,18 @@ program
|
|
|
114
119
|
.command('changelog')
|
|
115
120
|
.option('-rc --releaseCount <releaseCount>', 'Release count')
|
|
116
121
|
.option('-f --file <file>', 'Changelog filename')
|
|
117
|
-
.description('Generate changelog')
|
|
122
|
+
.description('[Deprecated] Generate changelog. Use `rt changelog` instead.')
|
|
118
123
|
.action(async (options) => {
|
|
124
|
+
logDeprecated('changelog', 'Use `rt changelog` instead.');
|
|
119
125
|
const { changelog } = await import('@varlet/release');
|
|
120
126
|
return changelog(options);
|
|
121
127
|
});
|
|
122
128
|
program
|
|
123
129
|
.command('release')
|
|
124
130
|
.option('-r --remote <remote>', 'Remote name')
|
|
125
|
-
.description('Release all packages and generate changelogs')
|
|
131
|
+
.description('[Deprecated] Release all packages and generate changelogs. Use `rt release` instead.')
|
|
126
132
|
.action(async (options) => {
|
|
133
|
+
logDeprecated('release', 'Use `rt release` instead.');
|
|
127
134
|
const { release } = await import('@varlet/release');
|
|
128
135
|
return release(options);
|
|
129
136
|
});
|
|
@@ -133,15 +140,17 @@ program
|
|
|
133
140
|
.option('-r --commitMessageRe <reg>', 'Validate the regular of whether the commit message passes')
|
|
134
141
|
.option('-e --errorMessage <message>', 'Validation failed to display error messages')
|
|
135
142
|
.option('-w --warningMessage <message>', 'Validation failed to display warning messages')
|
|
136
|
-
.description('Lint commit message')
|
|
143
|
+
.description('[Deprecated] Lint commit message. Use `rt commit-lint` instead.')
|
|
137
144
|
.action(async (options) => {
|
|
145
|
+
logDeprecated('commit-lint', 'Use `rt commit-lint` instead.');
|
|
138
146
|
const { commitLint } = await import('@varlet/release');
|
|
139
147
|
return commitLint(options);
|
|
140
148
|
});
|
|
141
149
|
program
|
|
142
150
|
.command('checklist <gitParams>')
|
|
143
|
-
.description('Display a checklist for confirmation')
|
|
151
|
+
.description('[Deprecated] Display a checklist for confirmation. No direct replacement; will be removed in the next major.')
|
|
144
152
|
.action(async (options) => {
|
|
153
|
+
logDeprecated('checklist', 'No direct replacement; will be removed in the next major.');
|
|
145
154
|
const { checklist } = await import('./commands/checklist.js');
|
|
146
155
|
return checklist(options);
|
|
147
156
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fse from 'fs-extra';
|
|
2
|
-
import { build as buildVite } from 'vite';
|
|
2
|
+
import { build as buildVite } from 'vite-plus';
|
|
3
3
|
import { buildSiteEntry } from '../compiler/compileSiteEntry.js';
|
|
4
4
|
import { getVarletConfig } from '../config/varlet.config.js';
|
|
5
5
|
import { getBuildConfig } from '../config/vite.config.js';
|
package/lib/node/commands/dev.js
CHANGED
|
@@ -2,7 +2,7 @@ import { resolve } from 'path';
|
|
|
2
2
|
import { kebabCase } from '@varlet/shared';
|
|
3
3
|
import chokidar from 'chokidar';
|
|
4
4
|
import fse from 'fs-extra';
|
|
5
|
-
import { createServer } from 'vite';
|
|
5
|
+
import { createServer } from 'vite-plus';
|
|
6
6
|
import { generateEsEntryTemplate, getScriptExtname } from '../compiler/compileScript.js';
|
|
7
7
|
import { buildSiteEntry } from '../compiler/compileSiteEntry.js';
|
|
8
8
|
import { getVarletConfig } from '../config/varlet.config.js';
|
|
@@ -2,15 +2,12 @@ import { x } from 'tinyexec';
|
|
|
2
2
|
import { VITEST_CONFIG } from '../shared/constant.js';
|
|
3
3
|
export async function test({ component, watch, coverage }) {
|
|
4
4
|
process.env.NODE_ENV = 'test';
|
|
5
|
-
const args = ['--config', VITEST_CONFIG];
|
|
6
|
-
if (!watch) {
|
|
7
|
-
args.unshift('run');
|
|
8
|
-
}
|
|
5
|
+
const args = [watch ? 'watch' : 'run', '--config', VITEST_CONFIG];
|
|
9
6
|
if (coverage) {
|
|
10
7
|
args.push('--coverage');
|
|
11
8
|
}
|
|
12
9
|
if (component) {
|
|
13
10
|
args.push('--dir', `src/${component.trim()}`);
|
|
14
11
|
}
|
|
15
|
-
await x('
|
|
12
|
+
await x('vp', ['test', ...args], { nodeOptions: { stdio: 'inherit' }, throwOnError: true });
|
|
16
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import vue from '@vitejs/plugin-vue';
|
|
2
2
|
import jsx from '@vitejs/plugin-vue-jsx';
|
|
3
|
-
import { build, createServer } from 'vite';
|
|
3
|
+
import { build, createServer } from 'vite-plus';
|
|
4
4
|
export async function vite(mode) {
|
|
5
5
|
process.env.NODE_ENV = mode === 'dev' ? 'development' : 'production';
|
|
6
6
|
const run = mode === 'build' ? build : createServer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { kebabCase } from '@varlet/shared';
|
|
3
3
|
import fse from 'fs-extra';
|
|
4
|
-
import { build } from 'vite';
|
|
4
|
+
import { build } from 'vite-plus';
|
|
5
5
|
import { getVarletConfig } from '../config/varlet.config.js';
|
|
6
6
|
import { getBundleConfig } from '../config/vite.config.js';
|
|
7
7
|
import { DOCS_DIR_NAME, ES_DIR, EXAMPLE_DIR_NAME, LIB_DIR, SRC_DIR, STYLE_DIR_NAME, TESTS_DIR_NAME, UMD_DIR, } from '../shared/constant.js';
|
|
@@ -7,8 +7,8 @@ export declare const styleExtNames: string[];
|
|
|
7
7
|
export declare const scriptIndexes: string[];
|
|
8
8
|
export declare const styleIndexes: string[];
|
|
9
9
|
export declare const tryMatchExtname: (file: string, extname: string[]) => string | undefined;
|
|
10
|
-
export declare const resolveAlias: (dependence: string, file: string, alias?: VarletConfig[
|
|
11
|
-
export declare const resolveDependence: (file: string, script: string, alias?: VarletConfig[
|
|
10
|
+
export declare const resolveAlias: (dependence: string, file: string, alias?: VarletConfig["alias"]) => string;
|
|
11
|
+
export declare const resolveDependence: (file: string, script: string, alias?: VarletConfig["alias"]) => string;
|
|
12
12
|
export declare function compileScriptByBabel(script: string, file: string): Promise<string>;
|
|
13
13
|
export declare function compileScriptByEsbuild(script: string): Promise<string>;
|
|
14
14
|
export declare function compileScript(script: string, file: string): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type VIConfig } from '@varlet/icon-builder';
|
|
2
2
|
import { type CopyOptions } from '@varlet/vite-plugins';
|
|
3
|
-
import { Plugin, ProxyOptions } from 'vite';
|
|
3
|
+
import { Plugin, ProxyOptions } from 'vite-plus';
|
|
4
4
|
export interface VarletConfigIcons extends VIConfig {
|
|
5
5
|
/**
|
|
6
6
|
* @default true
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vite").
|
|
1
|
+
declare const _default: import("vite-plus").ViteUserConfig;
|
|
2
2
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cpus } from 'os';
|
|
2
2
|
import vue from '@vitejs/plugin-vue';
|
|
3
3
|
import jsx from '@vitejs/plugin-vue-jsx';
|
|
4
|
-
import { defineConfig } from '
|
|
4
|
+
import { defineConfig } from 'vite-plus';
|
|
5
5
|
import { VITE_RESOLVE_EXTENSIONS } from '../shared/constant.js';
|
|
6
6
|
const cpuNum = Math.max(cpus().length - 1, 1);
|
|
7
7
|
export default defineConfig({
|
|
@@ -32,10 +32,6 @@ export default defineConfig({
|
|
|
32
32
|
],
|
|
33
33
|
},
|
|
34
34
|
globals: true,
|
|
35
|
-
|
|
36
|
-
vmThreads: {
|
|
37
|
-
memoryLimit: Math.min((1 / cpuNum) * 2, 0.2),
|
|
38
|
-
},
|
|
39
|
-
},
|
|
35
|
+
vmMemoryLimit: Math.min((1 / cpuNum) * 2, 0.2),
|
|
40
36
|
},
|
|
41
37
|
});
|
|
@@ -16,3 +16,6 @@ export default {
|
|
|
16
16
|
console.log(pico.cyan(text));
|
|
17
17
|
},
|
|
18
18
|
};
|
|
19
|
+
export function logDeprecated(command, replacement) {
|
|
20
|
+
console.warn(pico.yellow(`[Deprecated] \`varlet-cli ${command}\` is deprecated and will be removed in the next major version. ${replacement}`));
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0-alpha.1776572752298",
|
|
4
4
|
"description": "cli of varlet",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"@babel/preset-typescript": "^7.24.7",
|
|
34
34
|
"@inquirer/prompts": "^6.0.1",
|
|
35
35
|
"@varlet/icon-builder": "0.2.14",
|
|
36
|
-
"@varlet/release": "^
|
|
37
|
-
"@vitejs/plugin-vue": "6.0.
|
|
38
|
-
"@vitejs/plugin-vue-jsx": "5.1.
|
|
36
|
+
"@varlet/release": "^2.2.1",
|
|
37
|
+
"@vitejs/plugin-vue": "6.0.6",
|
|
38
|
+
"@vitejs/plugin-vue-jsx": "5.1.5",
|
|
39
39
|
"@vue/babel-plugin-jsx": "1.5.0",
|
|
40
40
|
"@vue/compiler-sfc": "3.5.21",
|
|
41
41
|
"@vue/runtime-core": "3.5.21",
|
|
42
42
|
"chokidar": "^3.5.2",
|
|
43
43
|
"commander": "^8.3.0",
|
|
44
44
|
"ejs": "^3.1.8",
|
|
45
|
-
"esbuild": "0.
|
|
45
|
+
"esbuild": "0.27.7",
|
|
46
46
|
"fs-extra": "^9.0.1",
|
|
47
47
|
"glob": "^7.2.0",
|
|
48
48
|
"hash-sum": "^2.0.0",
|
|
@@ -53,12 +53,11 @@
|
|
|
53
53
|
"sass": "^1.77.4",
|
|
54
54
|
"sharp": "0.31.1",
|
|
55
55
|
"tinyexec": "^0.3.0",
|
|
56
|
-
"typescript": "5.
|
|
57
|
-
"vite": "
|
|
58
|
-
"vitest": "3.2.4",
|
|
56
|
+
"typescript": "5.6.3",
|
|
57
|
+
"vite-plus": "0.1.18",
|
|
59
58
|
"vue": "3.5.21",
|
|
60
|
-
"@varlet/
|
|
61
|
-
"@varlet/
|
|
59
|
+
"@varlet/vite-plugins": "3.15.0-alpha.1776572752298",
|
|
60
|
+
"@varlet/shared": "3.15.0-alpha.1776572752298"
|
|
62
61
|
},
|
|
63
62
|
"devDependencies": {
|
|
64
63
|
"@types/babel__core": "^7.20.1",
|
|
@@ -67,15 +66,15 @@
|
|
|
67
66
|
"@types/glob": "^7.1.3",
|
|
68
67
|
"@types/hash-sum": "^1.0.0",
|
|
69
68
|
"@types/markdown-it": "^12.2.3",
|
|
70
|
-
"@types/node": "^
|
|
69
|
+
"@types/node": "^20.19.0",
|
|
71
70
|
"@types/sharp": "0.31.1",
|
|
72
71
|
"rimraf": "^5.0.1",
|
|
73
|
-
"@varlet/icons": "3.
|
|
74
|
-
"@varlet/touch-emulator": "3.
|
|
75
|
-
"@varlet/ui": "3.
|
|
72
|
+
"@varlet/icons": "3.15.0-alpha.1776572752298",
|
|
73
|
+
"@varlet/touch-emulator": "3.15.0-alpha.1776572752298",
|
|
74
|
+
"@varlet/ui": "3.15.0-alpha.1776572752298"
|
|
76
75
|
},
|
|
77
76
|
"peerDependencies": {
|
|
78
|
-
"@vitest/coverage-istanbul": "
|
|
77
|
+
"@vitest/coverage-istanbul": "4.1.4",
|
|
79
78
|
"@vue/runtime-core": "3.5.21",
|
|
80
79
|
"@vue/test-utils": "2.4.6",
|
|
81
80
|
"clipboard": "^2.0.6",
|
|
@@ -83,9 +82,9 @@
|
|
|
83
82
|
"live-server": "^1.2.1",
|
|
84
83
|
"vue": "3.5.21",
|
|
85
84
|
"vue-router": "4.5.1",
|
|
86
|
-
"@varlet/icons": "3.
|
|
87
|
-
"@varlet/
|
|
88
|
-
"@varlet/
|
|
85
|
+
"@varlet/icons": "3.15.0-alpha.1776572752298",
|
|
86
|
+
"@varlet/touch-emulator": "3.15.0-alpha.1776572752298",
|
|
87
|
+
"@varlet/ui": "3.15.0-alpha.1776572752298"
|
|
89
88
|
},
|
|
90
89
|
"engines": {
|
|
91
90
|
"node": "^14.18.0 || >=16.0.0"
|
|
@@ -2,7 +2,7 @@ import <%- bigCamelizeName %> from '..'
|
|
|
2
2
|
import <%- bigCamelizeNamespace + bigCamelizeName %> from '../<%- bigCamelizeName %>'
|
|
3
3
|
import { createApp } from 'vue'
|
|
4
4
|
import { mount } from '@vue/test-utils'
|
|
5
|
-
import { expect, test } from '
|
|
5
|
+
import { expect, test } from 'vite-plus/test'
|
|
6
6
|
|
|
7
7
|
test('test <%- kebabCaseName %> plugin', () => {
|
|
8
8
|
const app = createApp({}).use(<%- bigCamelizeName %>)
|
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
### Reference
|
|
4
4
|
|
|
5
|
-
[@varlet/cli 中文文档](https://github.com/varletjs/varlet/blob/dev/packages/varlet-cli/README.md)
|
|
6
|
-
[@varlet/cli documentation](https://github.com/varletjs/varlet/blob/dev/packages/varlet-cli/README.
|
|
5
|
+
[@varlet/cli 中文文档](https://github.com/varletjs/varlet/blob/dev/packages/varlet-cli/README.zh-CN.md)
|
|
6
|
+
[@varlet/cli documentation](https://github.com/varletjs/varlet/blob/dev/packages/varlet-cli/README.md)
|
|
7
|
+
|
|
8
|
+
### Recommended stack
|
|
9
|
+
|
|
10
|
+
This template is aligned with the **Varlet + vite-plus + rattail** setup:
|
|
11
|
+
|
|
12
|
+
- **`@varlet/cli`** — first-party Varlet workflows (`dev`, `build`, `preview`, `compile`, `test`, `create`, …).
|
|
13
|
+
- **`vite-plus` (`vp`)** — lint, format, and other toolchain entrypoints (see root `vite.config.ts`).
|
|
14
|
+
- **`rattail` (`rt`)** — hooks, `clean`, `changelog`, `release`, etc.
|
|
15
|
+
|
|
16
|
+
To refresh generated files from the latest built-in template after upgrading `@varlet/cli`, run **`varlet-cli gen`** from the parent directory (use git or a backup first; `gen` may overwrite generated scaffolding).
|
|
7
17
|
|
|
8
18
|
### Quickstart
|
|
9
19
|
|
|
@@ -56,11 +66,9 @@ pnpm test:watch
|
|
|
56
66
|
pnpm test:coverage
|
|
57
67
|
```
|
|
58
68
|
|
|
59
|
-
####
|
|
69
|
+
#### Git hooks
|
|
60
70
|
|
|
61
|
-
|
|
62
|
-
npx simple-git-hooks
|
|
63
|
-
```
|
|
71
|
+
Hooks are installed via `pnpm install` (`prepare` runs `vp config` + `rt hook`). Use `rt commit-lint` through the configured `commit-msg` hook.
|
|
64
72
|
|
|
65
73
|
#### Generate changelog
|
|
66
74
|
|
|
@@ -70,7 +78,7 @@ pnpm changelog
|
|
|
70
78
|
|
|
71
79
|
#### Release
|
|
72
80
|
|
|
73
|
-
tips:
|
|
81
|
+
tips:
|
|
74
82
|
- 1.The registry of npm must be the official source of npm
|
|
75
83
|
- 2.The npm must be logged in
|
|
76
84
|
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"preinstall": "npx only-allow pnpm",
|
|
23
|
-
"
|
|
23
|
+
"prepare": "vp config --hooks-dir .vite-hooks && rt hook",
|
|
24
24
|
"dev": "varlet-cli dev",
|
|
25
25
|
"build": "varlet-cli build",
|
|
26
26
|
"preview": "varlet-cli preview",
|
|
27
27
|
"compile": "varlet-cli compile",
|
|
28
|
-
"lint": "
|
|
29
|
-
"format": "
|
|
30
|
-
"changelog": "
|
|
31
|
-
"release": "pnpm compile &&
|
|
28
|
+
"lint": "vp lint --fix",
|
|
29
|
+
"format": "vp fmt",
|
|
30
|
+
"changelog": "rt changelog",
|
|
31
|
+
"release": "pnpm compile && rt release",
|
|
32
32
|
"test": "varlet-cli test",
|
|
33
33
|
"test:watch": "varlet-cli test -w",
|
|
34
34
|
"test:coverage": "varlet-cli test -cov",
|
|
35
|
-
"create": "varlet-cli create"
|
|
35
|
+
"create": "varlet-cli create",
|
|
36
|
+
"clean": "rt clean"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"vue": "^3.2.0"
|
|
@@ -44,32 +45,21 @@
|
|
|
44
45
|
"@varlet/shared": "workspace:*",
|
|
45
46
|
"@varlet/ui": "workspace:*",
|
|
46
47
|
"@vue/test-utils": "2.4.6",
|
|
47
|
-
"@vue/runtime-core": "3.5.
|
|
48
|
-
"@vitest/coverage-istanbul": "
|
|
49
|
-
"
|
|
50
|
-
"@configurajs/prettier": "*",
|
|
51
|
-
"jsdom": "24.1.1",
|
|
52
|
-
"vitest": "3.0.6",
|
|
48
|
+
"@vue/runtime-core": "3.5.21",
|
|
49
|
+
"@vitest/coverage-istanbul": "4.1.4",
|
|
50
|
+
"vitest": "npm:@voidzero-dev/vite-plus-test@0.1.18",
|
|
53
51
|
"clipboard": "^2.0.6",
|
|
54
|
-
"
|
|
55
|
-
"lint-staged": "^10.5.0",
|
|
52
|
+
"jsdom": "26.1.0",
|
|
56
53
|
"live-server": "^1.2.1",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"vue": "3.5.
|
|
61
|
-
"vue-router": "4.5.
|
|
54
|
+
"rattail": "^2.0.3",
|
|
55
|
+
"typescript": "5.6.3",
|
|
56
|
+
"vite-plus": "0.1.18",
|
|
57
|
+
"vue": "3.5.21",
|
|
58
|
+
"vue-router": "4.5.1"
|
|
62
59
|
},
|
|
63
|
-
"
|
|
64
|
-
"*.{ts,tsx,js,vue,less}": "prettier --write",
|
|
65
|
-
"*.{ts,tsx,js,vue}": "eslint --fix"
|
|
66
|
-
},
|
|
67
|
-
"simple-git-hooks": {
|
|
68
|
-
"pre-commit": "pnpm exec lint-staged --allow-empty --concurrent false",
|
|
69
|
-
"commit-msg": "pnpm exec varlet-cli commit-lint -p $1"
|
|
70
|
-
},
|
|
71
|
-
"packageManager": "pnpm@9.1.1",
|
|
60
|
+
"packageManager": "pnpm@9.15.9",
|
|
72
61
|
"engines": {
|
|
73
|
-
"
|
|
62
|
+
"node": "^20.19.0 || >=22.12.0",
|
|
63
|
+
"pnpm": ">=9.0.0"
|
|
74
64
|
}
|
|
75
65
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
const content: string
|
|
3
|
-
export default content
|
|
1
|
+
declare module '*.md' {
|
|
2
|
+
const content: string
|
|
3
|
+
export default content
|
|
4
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
import { defineComponent } from
|
|
1
|
+
declare module '*.vue' {
|
|
2
|
+
import { defineComponent } from 'vue'
|
|
3
3
|
|
|
4
|
-
const component: ReturnType<typeof defineComponent
|
|
5
|
-
export default component
|
|
4
|
+
const component: ReturnType<typeof defineComponent>
|
|
5
|
+
export default component
|
|
6
6
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"strict": true,
|
|
4
|
-
"downlevelIteration": true,
|
|
5
4
|
"declaration": true,
|
|
6
5
|
"skipLibCheck": true,
|
|
7
6
|
"esModuleInterop": true,
|
|
@@ -10,7 +9,6 @@
|
|
|
10
9
|
"allowSyntheticDefaultImports": true,
|
|
11
10
|
"jsxImportSource": "vue",
|
|
12
11
|
"jsx": "preserve",
|
|
13
|
-
"types": ["
|
|
14
|
-
}
|
|
15
|
-
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
|
12
|
+
"types": ["vite-plus/test/globals"]
|
|
13
|
+
}
|
|
16
14
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { clean, defineConfig, fmt, hook, lint, staged } from 'rattail/vite-plus'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
lint: lint({
|
|
5
|
+
ignores: ['es/**', 'lib/**', 'umd/**', 'site/**', 'coverage/**', 'highlight/**', 'types/**', 'node_modules/**'],
|
|
6
|
+
}),
|
|
7
|
+
|
|
8
|
+
fmt: fmt({
|
|
9
|
+
ignores: [
|
|
10
|
+
'es/**',
|
|
11
|
+
'lib/**',
|
|
12
|
+
'umd/**',
|
|
13
|
+
'site/**',
|
|
14
|
+
'coverage/**',
|
|
15
|
+
'highlight/**',
|
|
16
|
+
'types/**',
|
|
17
|
+
'**/*.md',
|
|
18
|
+
'**/package.json',
|
|
19
|
+
],
|
|
20
|
+
}),
|
|
21
|
+
|
|
22
|
+
staged: staged(),
|
|
23
|
+
|
|
24
|
+
rattail: {
|
|
25
|
+
clean: clean({
|
|
26
|
+
patterns: [
|
|
27
|
+
'es',
|
|
28
|
+
'lib',
|
|
29
|
+
'umd',
|
|
30
|
+
'site',
|
|
31
|
+
'coverage',
|
|
32
|
+
'highlight',
|
|
33
|
+
'.varlet',
|
|
34
|
+
'.eslintcache',
|
|
35
|
+
'**/.vite',
|
|
36
|
+
'.vite-hooks',
|
|
37
|
+
],
|
|
38
|
+
}),
|
|
39
|
+
|
|
40
|
+
hook: hook(),
|
|
41
|
+
},
|
|
42
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent, PropType } from 'vue'
|
|
2
|
-
import { createNamespace } from '../utils/components'
|
|
3
|
-
import './button.less'
|
|
4
2
|
// i18n for component's internal
|
|
5
3
|
import { t } from '../locale'
|
|
4
|
+
import './button.less'
|
|
5
|
+
import { createNamespace } from '../utils/components'
|
|
6
6
|
|
|
7
7
|
const { name, n, classes } = createNamespace('button')
|
|
8
8
|
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const { defineConfig } = require("@configurajs/eslint");
|
|
2
|
-
|
|
3
|
-
module.export = defineConfig({
|
|
4
|
-
ignores: [
|
|
5
|
-
"lib/**",
|
|
6
|
-
"es/**",
|
|
7
|
-
"umd/**",
|
|
8
|
-
"site/**",
|
|
9
|
-
"public/**",
|
|
10
|
-
"coverage/**",
|
|
11
|
-
"highlight/**",
|
|
12
|
-
"types/index.d.ts",
|
|
13
|
-
".varlet/**",
|
|
14
|
-
],
|
|
15
|
-
});
|