@varlet/cli 3.14.2 → 3.15.0-alpha.1776606769606

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.
Files changed (47) hide show
  1. package/README.md +27 -42
  2. package/README.zh-CN.md +27 -42
  3. package/lib/client/index.js +1 -1
  4. package/lib/node/bin.js +18 -9
  5. package/lib/node/commands/build.js +1 -1
  6. package/lib/node/commands/dev.js +1 -1
  7. package/lib/node/commands/extension.js +1 -1
  8. package/lib/node/commands/gen.js +4 -0
  9. package/lib/node/commands/test.js +2 -5
  10. package/lib/node/commands/vite.js +1 -1
  11. package/lib/node/compiler/compileModule.js +1 -1
  12. package/lib/node/compiler/compileScript.d.ts +2 -2
  13. package/lib/node/config/varlet.config.d.ts +1 -1
  14. package/lib/node/config/vite.config.d.ts +1 -1
  15. package/lib/node/config/vitest.config.d.ts +1 -1
  16. package/lib/node/config/vitest.config.js +2 -6
  17. package/lib/node/shared/logger.d.ts +1 -0
  18. package/lib/node/shared/logger.js +3 -0
  19. package/package.json +17 -18
  20. package/template/create/__tests__/index.spec.js.ejs +1 -1
  21. package/template/generators/base/.vscode/extensions.json +3 -0
  22. package/template/generators/base/.vscode/settings.json +5 -0
  23. package/template/generators/base/README.md +15 -7
  24. package/template/generators/base/package.json +19 -30
  25. package/template/generators/base/shims/shims-md.d.ts +3 -3
  26. package/template/generators/base/shims/shims-vue.d.ts +4 -4
  27. package/template/generators/base/tsconfig.template.json +20 -0
  28. package/template/generators/base/vite.config.mts +42 -0
  29. package/template/generators/config/default/base/varlet.config.mjs +85 -2
  30. package/template/generators/config/default/sfc/src/button/__tests__/index.spec.js +1 -1
  31. package/template/generators/config/default/sfc/src/utils/components.ts +1 -1
  32. package/template/generators/config/default/tsx/src/button/__tests__/index.spec.js +1 -1
  33. package/template/generators/config/default/tsx/src/utils/components.ts +1 -1
  34. package/template/generators/config/i18n/sfc/src/button/__tests__/index.spec.js +1 -1
  35. package/template/generators/config/i18n/sfc/src/locale/__tests__/index.spec.js +1 -1
  36. package/template/generators/config/i18n/sfc/src/locale/en-US.d.ts +2 -2
  37. package/template/generators/config/i18n/sfc/src/locale/zh-CN.d.ts +2 -2
  38. package/template/generators/config/i18n/sfc/src/utils/components.ts +1 -1
  39. package/template/generators/config/i18n/tsx/src/button/Button.tsx +2 -2
  40. package/template/generators/config/i18n/tsx/src/button/__tests__/index.spec.js +1 -1
  41. package/template/generators/config/i18n/tsx/src/locale/__tests__/index.spec.js +1 -1
  42. package/template/generators/config/i18n/tsx/src/locale/en-US.d.ts +2 -2
  43. package/template/generators/config/i18n/tsx/src/locale/zh-CN.d.ts +2 -2
  44. package/template/generators/config/i18n/tsx/src/utils/components.ts +1 -1
  45. package/template/generators/base/eslint.config.js +0 -15
  46. package/template/generators/base/prettier.config.js +0 -3
  47. package/template/generators/base/tsconfig.json +0 -16
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
@@ -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';
@@ -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';
@@ -1,4 +1,4 @@
1
- import { build } from 'vite';
1
+ import { build } from 'vite-plus';
2
2
  import { getExtensionConfig } from '../config/vite.config.js';
3
3
  export async function extension(mode) {
4
4
  await build(getExtensionConfig(mode));
@@ -58,6 +58,10 @@ export async function gen(options) {
58
58
  await copy(configBase, dest);
59
59
  await copy(code, dest);
60
60
  await rename(resolve(dest, '_gitignore'), resolve(dest, '.gitignore'));
61
+ const scaffoldTsconfigPath = resolve(dest, 'tsconfig.template.json');
62
+ if (pathExistsSync(scaffoldTsconfigPath)) {
63
+ await rename(scaffoldTsconfigPath, resolve(dest, 'tsconfig.json'));
64
+ }
61
65
  syncVersion(name);
62
66
  logger.success('✨ Application generated successfully!');
63
67
  logger.info(`\
@@ -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('vitest', args, { nodeOptions: { stdio: 'inherit' }, throwOnError: true });
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['alias']) => string;
11
- export declare const resolveDependence: (file: string, script: string, alias?: VarletConfig['alias']) => string;
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,4 +1,4 @@
1
- import { InlineConfig, Plugin } from 'vite';
1
+ import { InlineConfig, Plugin } from 'vite-plus';
2
2
  import { VarletConfig, type VarletConfigHtmlInject } from './varlet.config.js';
3
3
  export declare function getHtmlInject(inject: VarletConfigHtmlInject): {
4
4
  head: {
@@ -1,2 +1,2 @@
1
- declare const _default: import("vite").UserConfig;
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 'vitest/config';
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
- poolOptions: {
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
  });
@@ -6,3 +6,4 @@ declare const _default: {
6
6
  title(text: string): void;
7
7
  };
8
8
  export default _default;
9
+ export declare function logDeprecated(command: string, replacement: string): void;
@@ -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.14.2",
3
+ "version": "3.15.0-alpha.1776606769606",
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": "^0.3.3",
37
- "@vitejs/plugin-vue": "6.0.1",
38
- "@vitejs/plugin-vue-jsx": "5.1.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.23.1",
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.3.3",
57
- "vite": "7.1.5",
58
- "vitest": "3.2.4",
56
+ "typescript": "5.6.3",
57
+ "vite-plus": "0.1.18",
59
58
  "vue": "3.5.21",
60
- "@varlet/shared": "3.14.2",
61
- "@varlet/vite-plugins": "3.14.2"
59
+ "@varlet/vite-plugins": "3.15.0-alpha.1776606769606",
60
+ "@varlet/shared": "3.15.0-alpha.1776606769606"
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": "^18.7.20",
69
+ "@types/node": "^20.19.0",
71
70
  "@types/sharp": "0.31.1",
72
71
  "rimraf": "^5.0.1",
73
- "@varlet/touch-emulator": "3.14.2",
74
- "@varlet/icons": "3.14.2",
75
- "@varlet/ui": "3.14.2"
72
+ "@varlet/ui": "3.15.0-alpha.1776606769606",
73
+ "@varlet/icons": "3.15.0-alpha.1776606769606",
74
+ "@varlet/touch-emulator": "3.15.0-alpha.1776606769606"
76
75
  },
77
76
  "peerDependencies": {
78
- "@vitest/coverage-istanbul": "3.2.4",
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.14.2",
87
- "@varlet/ui": "3.14.2",
88
- "@varlet/touch-emulator": "3.14.2"
85
+ "@varlet/icons": "3.15.0-alpha.1776606769606",
86
+ "@varlet/touch-emulator": "3.15.0-alpha.1776606769606",
87
+ "@varlet/ui": "3.15.0-alpha.1776606769606"
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 'vitest'
5
+ import { expect, test } from 'vite-plus/test'
6
6
 
7
7
  test('test <%- kebabCaseName %> plugin', () => {
8
8
  const app = createApp({}).use(<%- bigCamelizeName %>)
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["VoidZero.vite-plus-extension-pack"]
3
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "eslint.enable": false,
3
+ "prettier.enable": false,
4
+ "editor.defaultFormatter": "oxc.oxc-vscode"
5
+ }
@@ -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.en-US.md)
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
- #### Mount Git Hooks
69
+ #### Git hooks
60
70
 
61
- ```shell
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
 
@@ -19,20 +19,20 @@
19
19
  "*.css"
20
20
  ],
21
21
  "scripts": {
22
- "preinstall": "npx only-allow pnpm",
23
- "postinstall": "simple-git-hooks",
22
+ "prepare": "vp config --hooks-dir .vite-hooks && rt hook",
24
23
  "dev": "varlet-cli dev",
25
24
  "build": "varlet-cli build",
26
25
  "preview": "varlet-cli preview",
27
26
  "compile": "varlet-cli compile",
28
- "lint": "eslint . --fix",
29
- "format": "prettier --write .",
30
- "changelog": "varlet-cli changelog",
31
- "release": "pnpm compile && varlet-cli release",
27
+ "lint": "vp lint --fix",
28
+ "format": "vp fmt",
29
+ "changelog": "rt changelog",
30
+ "release": "pnpm compile && rt release",
32
31
  "test": "varlet-cli test",
33
32
  "test:watch": "varlet-cli test -w",
34
33
  "test:coverage": "varlet-cli test -cov",
35
- "create": "varlet-cli create"
34
+ "create": "varlet-cli create",
35
+ "clean": "rt clean"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "vue": "^3.2.0"
@@ -44,32 +44,21 @@
44
44
  "@varlet/shared": "workspace:*",
45
45
  "@varlet/ui": "workspace:*",
46
46
  "@vue/test-utils": "2.4.6",
47
- "@vue/runtime-core": "3.5.13",
48
- "@vitest/coverage-istanbul": "3.0.6",
49
- "@configurajs/eslint": "*",
50
- "@configurajs/prettier": "*",
51
- "jsdom": "24.1.1",
52
- "vitest": "3.0.6",
47
+ "@vue/runtime-core": "3.5.21",
48
+ "@vitest/coverage-istanbul": "4.1.4",
49
+ "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.18",
53
50
  "clipboard": "^2.0.6",
54
- "eslint": "^9.17.0",
55
- "lint-staged": "^10.5.0",
51
+ "jsdom": "26.1.0",
56
52
  "live-server": "^1.2.1",
57
- "prettier": "^3.5.2",
58
- "simple-git-hooks": "^2.8.0",
59
- "typescript": "5.3.3",
60
- "vue": "3.5.13",
61
- "vue-router": "4.5.0"
53
+ "rattail": "^2.0.3",
54
+ "typescript": "5.6.3",
55
+ "vite-plus": "0.1.18",
56
+ "vue": "3.5.21",
57
+ "vue-router": "4.5.1"
62
58
  },
63
- "lint-staged": {
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",
59
+ "packageManager": "pnpm@9.15.9",
72
60
  "engines": {
73
- "pnpm": ">=9.0"
61
+ "node": "^20.19.0 || >=22.12.0",
62
+ "pnpm": ">=9.0.0"
74
63
  }
75
64
  }
@@ -1,4 +1,4 @@
1
- declare module "*.md" {
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 "*.vue" {
2
- import { defineComponent } from "vue";
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
  }
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "strict": true,
6
+ "declaration": true,
7
+ "noEmit": true,
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+ "allowJs": true,
11
+ "lib": ["esnext", "dom"],
12
+ "allowSyntheticDefaultImports": true,
13
+ "jsxImportSource": "vue",
14
+ "jsx": "preserve",
15
+ "types": ["vite-plus/test/globals"],
16
+ "moduleResolution": "bundler"
17
+ },
18
+ "include": ["src", "types", "shims", "vite.config.mts", "varlet.config.mjs"],
19
+ "exclude": ["node_modules", "es", "lib", "umd", "site", "coverage", "highlight", ".varlet", ".vite-hooks"]
20
+ }
@@ -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
+ })
@@ -3,23 +3,99 @@ import { defineConfig } from '@varlet/cli'
3
3
  export default defineConfig({
4
4
  logo: './logo.svg',
5
5
  useMobile: true,
6
+ title: 'Varlet X',
6
7
  pc: {
8
+ description: {
9
+ 'zh-CN':
10
+ 'Varlet X 是一个基于 Vue3 开发的 Material design 组件库,支持移动端和桌面端,由 varletjs 组织开发和维护。支持 Typescript、按需引入、暗黑模式、主题定制、国际化,并提供 VSCode 插件以保证良好的开发体验。',
11
+ 'en-US':
12
+ 'Varlet X is a Material design component library developed based on Vue3, supporting mobile and desktop, developed and maintained by varletjs organization. Support Typescript, import on demand, dark mode, theme customization, internationalization, and provide VSCode plugin to ensure a good development experience.',
13
+ },
7
14
  header: {
8
15
  darkMode: null,
9
- i18n: null,
10
16
  playground: null,
11
17
  versions: null,
18
+ changelog: null,
19
+ },
20
+ indexPage: {
21
+ sponsors: null,
22
+ contributors: null,
23
+ teamMembers: null,
24
+ features: [
25
+ {
26
+ name: {
27
+ 'zh-CN': '特性',
28
+ 'en-US': 'Feature',
29
+ },
30
+ description: {
31
+ 'zh-CN': '特性描述',
32
+ 'en-US': 'Feature description',
33
+ },
34
+ },
35
+ {
36
+ name: {
37
+ 'zh-CN': '特性',
38
+ 'en-US': 'Feature',
39
+ },
40
+ description: {
41
+ 'zh-CN': '特性描述',
42
+ 'en-US': 'Feature description',
43
+ },
44
+ },
45
+ {
46
+ name: {
47
+ 'zh-CN': '特性',
48
+ 'en-US': 'Feature',
49
+ },
50
+ description: {
51
+ 'zh-CN': '特性描述',
52
+ 'en-US': 'Feature description',
53
+ },
54
+ },
55
+ {
56
+ name: {
57
+ 'zh-CN': '特性',
58
+ 'en-US': 'Feature',
59
+ },
60
+ description: {
61
+ 'zh-CN': '特性描述',
62
+ 'en-US': 'Feature description',
63
+ },
64
+ },
65
+ {
66
+ name: {
67
+ 'zh-CN': '特性',
68
+ 'en-US': 'Feature',
69
+ },
70
+ description: {
71
+ 'zh-CN': '特性描述',
72
+ 'en-US': 'Feature description',
73
+ },
74
+ },
75
+ {
76
+ name: {
77
+ 'zh-CN': '特性',
78
+ 'en-US': 'Feature',
79
+ },
80
+ description: {
81
+ 'zh-CN': '特性描述',
82
+ 'en-US': 'Feature description',
83
+ },
84
+ },
85
+ ],
12
86
  },
13
87
  menu: [
14
88
  {
15
89
  text: {
16
90
  'zh-CN': '开发指南',
91
+ 'en-US': 'Developer Guide',
17
92
  },
18
93
  type: 1,
19
94
  },
20
95
  {
21
96
  text: {
22
97
  'zh-CN': '基本介绍',
98
+ 'en-US': 'Basic Introduce',
23
99
  },
24
100
  doc: 'home',
25
101
  type: 3,
@@ -27,12 +103,14 @@ export default defineConfig({
27
103
  {
28
104
  text: {
29
105
  'zh-CN': '基础组件',
106
+ 'en-US': 'Basic Components',
30
107
  },
31
108
  type: 1,
32
109
  },
33
110
  {
34
111
  text: {
35
112
  'zh-CN': 'Button 按钮',
113
+ 'en-US': 'Button',
36
114
  },
37
115
  doc: 'button',
38
116
  type: 2,
@@ -41,8 +119,13 @@ export default defineConfig({
41
119
  },
42
120
  mobile: {
43
121
  header: {
44
- i18n: null,
45
122
  darkMode: null,
46
123
  },
124
+ title: {
125
+ 'zh-CN':
126
+ 'Varlet X 是一个基于 Vue3 开发的 Material design 组件库,支持移动端和桌面端,由 varletjs 组织开发和维护。支持 Typescript、按需引入、暗黑模式、主题定制、国际化,并提供 VSCode 插件以保证良好的开发体验。',
127
+ 'en-US':
128
+ 'Varlet X is a Material design component library developed based on Vue3, supporting mobile and desktop, developed and maintained by varletjs organization. Support Typescript, import on demand, dark mode, theme customization, internationalization, and provide VSCode plugin to ensure a good development experience.',
129
+ },
47
130
  },
48
131
  })
@@ -1,5 +1,5 @@
1
+ import { expect, test } from 'vite-plus/test'
1
2
  import { createApp } from 'vue'
2
- import { expect, test } from 'vitest'
3
3
  import Button from '..'
4
4
 
5
5
  test('test button use', () => {
@@ -1,5 +1,5 @@
1
- import type { App, Component, Plugin } from 'vue'
2
1
  import { createNamespaceFn } from '@varlet/shared'
2
+ import type { App, Component, Plugin } from 'vue'
3
3
 
4
4
  export type ComponentWithInstall<T> = T & Plugin
5
5
 
@@ -1,5 +1,5 @@
1
+ import { expect, test } from 'vite-plus/test'
1
2
  import { createApp } from 'vue'
2
- import { expect, test } from 'vitest'
3
3
  import Button from '..'
4
4
 
5
5
  test('test button use', () => {
@@ -1,5 +1,5 @@
1
- import type { App, Component, Plugin } from 'vue'
2
1
  import { createNamespaceFn } from '@varlet/shared'
2
+ import type { App, Component, Plugin } from 'vue'
3
3
 
4
4
  export type ComponentWithInstall<T> = T & Plugin
5
5
 
@@ -1,5 +1,5 @@
1
+ import { expect, test } from 'vite-plus/test'
1
2
  import { createApp } from 'vue'
2
- import { expect, test } from 'vitest'
3
3
  import Button from '../index'
4
4
 
5
5
  test('test button use', () => {
@@ -1,4 +1,4 @@
1
- import { expect, test, vi } from 'vitest'
1
+ import { expect, test, vi } from 'vite-plus/test'
2
2
  import enUS from '../en-US'
3
3
  import { useLocale } from '../index'
4
4
 
@@ -1,5 +1,5 @@
1
- import type { Pack } from '../../types'
1
+ import type { Message } from './index'
2
2
 
3
- declare const enUS: Pack
3
+ declare const enUS: Message
4
4
 
5
5
  export default enUS
@@ -1,5 +1,5 @@
1
- import type { Pack } from '../../types'
1
+ import type { Message } from './index'
2
2
 
3
- declare const zhCN: Pack
3
+ declare const zhCN: Message
4
4
 
5
5
  export default zhCN
@@ -1,5 +1,5 @@
1
- import type { App, Component, Plugin } from 'vue'
2
1
  import { createNamespaceFn } from '@varlet/shared'
2
+ import type { App, Component, Plugin } from 'vue'
3
3
 
4
4
  export type ComponentWithInstall<T> = T & Plugin
5
5
 
@@ -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,5 +1,5 @@
1
+ import { expect, test } from 'vite-plus/test'
1
2
  import { createApp } from 'vue'
2
- import { expect, test } from 'vitest'
3
3
  import Button from '../index'
4
4
 
5
5
  test('test button use', () => {
@@ -1,4 +1,4 @@
1
- import { expect, test, vi } from 'vitest'
1
+ import { expect, test, vi } from 'vite-plus/test'
2
2
  import enUS from '../en-US'
3
3
  import { useLocale } from '../index'
4
4
 
@@ -1,5 +1,5 @@
1
- import type { Pack } from '../../types'
1
+ import type { Message } from './index'
2
2
 
3
- declare const enUS: Pack
3
+ declare const enUS: Message
4
4
 
5
5
  export default enUS
@@ -1,5 +1,5 @@
1
- import type { Pack } from '../../types'
1
+ import type { Message } from './index'
2
2
 
3
- declare const zhCN: Pack
3
+ declare const zhCN: Message
4
4
 
5
5
  export default zhCN
@@ -1,5 +1,5 @@
1
- import type { App, Component, Plugin } from 'vue'
2
1
  import { createNamespaceFn } from '@varlet/shared'
2
+ import type { App, Component, Plugin } from 'vue'
3
3
 
4
4
  export type ComponentWithInstall<T> = T & Plugin
5
5
 
@@ -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
- });
@@ -1,3 +0,0 @@
1
- const { defineConfig } = require("@configurajs/prettier");
2
-
3
- module.export = defineConfig();
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "strict": true,
4
- "downlevelIteration": true,
5
- "declaration": true,
6
- "skipLibCheck": true,
7
- "esModuleInterop": true,
8
- "allowJs": true,
9
- "lib": ["esnext", "dom"],
10
- "allowSyntheticDefaultImports": true,
11
- "jsxImportSource": "vue",
12
- "jsx": "preserve",
13
- "types": ["vitest/globals"]
14
- },
15
- "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
16
- }