@varlet/cli 3.5.0 → 3.5.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.
@@ -2,13 +2,12 @@ import ejs from 'ejs';
2
2
  import fse from 'fs-extra';
3
3
  import logger from '../shared/logger.js';
4
4
  import { bigCamelize, camelize, kebabCase } from '@varlet/shared';
5
- import inquirer from 'inquirer';
5
+ import { input, confirm, select } from '@inquirer/prompts';
6
6
  import { resolve } from 'path';
7
7
  import { glob } from '../shared/fsUtils.js';
8
8
  import { getVarletConfig } from '../config/varlet.config.js';
9
9
  import { SRC_DIR, dirname } from '../shared/constant.js';
10
10
  const { removeSync, readFileSync, copySync, pathExistsSync, writeFileSync, renameSync } = fse;
11
- const { prompt } = inquirer;
12
11
  async function renderTemplates(componentFolder, componentFolderName, renderData) {
13
12
  const templates = await glob(`${componentFolder}/**/*.ejs`);
14
13
  templates.forEach((template) => {
@@ -33,10 +32,9 @@ export async function create(options) {
33
32
  camelizeName: 'componentName',
34
33
  style: 'vue',
35
34
  };
36
- const { name } = options.name
37
- ? options
38
- : await prompt({
39
- name: 'name',
35
+ const name = options.name
36
+ ? options.name
37
+ : await input({
40
38
  message: 'Name of the component created: ',
41
39
  default: renderData.kebabCaseName,
42
40
  });
@@ -49,11 +47,9 @@ export async function create(options) {
49
47
  logger.warning(`${componentFolderName} already exist and cannot be recreated...`);
50
48
  return;
51
49
  }
52
- const { locale } = options.locale
53
- ? options
54
- : await prompt({
55
- name: 'locale',
56
- type: 'confirm',
50
+ const locale = options.locale
51
+ ? options.locale
52
+ : await confirm({
57
53
  message: 'Whether to use i18n?',
58
54
  default: false,
59
55
  });
@@ -63,9 +59,7 @@ export async function create(options) {
63
59
  renderData.style = options.sfc ? 'vue' : 'tsx';
64
60
  }
65
61
  else {
66
- const { style } = await prompt({
67
- name: 'style',
68
- type: 'list',
62
+ const style = await select({
69
63
  message: 'Which style do you use to write your component ?',
70
64
  choices: [
71
65
  { name: 'sfc', value: 'vue' },
@@ -1,10 +1,9 @@
1
1
  import logger from '../shared/logger.js';
2
2
  import fse from 'fs-extra';
3
- import inquirer from 'inquirer';
3
+ import { input, confirm, select } from '@inquirer/prompts';
4
4
  import { resolve } from 'path';
5
5
  import { CLI_PACKAGE_JSON, CWD, GENERATORS_DIR } from '../shared/constant.js';
6
6
  const { copy, pathExistsSync, readFileSync, writeFileSync, rename } = fse;
7
- const { prompt } = inquirer;
8
7
  function syncVersion(name) {
9
8
  const file = resolve(CWD, name, 'package.json');
10
9
  const pkg = JSON.parse(readFileSync(file, 'utf-8'));
@@ -19,10 +18,9 @@ function syncVersion(name) {
19
18
  }
20
19
  export async function gen(options) {
21
20
  logger.title('\nšŸ“¦šŸ“¦ Generate cli application ! \n');
22
- const { name } = options.name
23
- ? options
24
- : await prompt({
25
- name: 'name',
21
+ const name = options.name
22
+ ? options.name
23
+ : await input({
26
24
  message: 'Name of the generate application: ',
27
25
  default: 'varlet-cli-app',
28
26
  });
@@ -37,19 +35,18 @@ export async function gen(options) {
37
35
  codeStyle = options.sfc ? 'sfc' : 'tsx';
38
36
  }
39
37
  else {
40
- const { style } = await prompt({
41
- name: 'style',
42
- type: 'list',
38
+ const style = await select({
43
39
  message: 'Please select your component library programming format',
44
- choices: ['sfc', 'tsx'],
40
+ choices: [
41
+ { name: 'sfc', value: 'sfc' },
42
+ { name: 'tsx', value: 'tsx' },
43
+ ],
45
44
  });
46
45
  codeStyle = style;
47
46
  }
48
- const { i18n } = options.i18n
49
- ? options
50
- : await prompt({
51
- name: 'i18n',
52
- type: 'confirm',
47
+ const i18n = options.i18n
48
+ ? options.i18n
49
+ : await confirm({
53
50
  message: 'Whether to use i18n?',
54
51
  default: false,
55
52
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "type": "module",
5
5
  "description": "cli of varlet",
6
6
  "bin": {
@@ -33,24 +33,24 @@
33
33
  "url": "https://github.com/varletjs/varlet/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@babel/core": "^7.24.7",
36
+ "@babel/core": "^7.25.2",
37
37
  "@babel/preset-typescript": "^7.24.7",
38
+ "@inquirer/prompts": "^6.0.1",
38
39
  "@varlet/icon-builder": "0.2.14",
39
40
  "@varlet/release": "^0.2.5",
40
- "@vitejs/plugin-vue": "5.0.4",
41
- "@vitejs/plugin-vue-jsx": "3.1.0",
42
- "@vue/babel-plugin-jsx": "1.2.2",
43
- "@vue/compiler-sfc": "3.4.21",
44
- "@vue/runtime-core": "3.4.21",
41
+ "@vitejs/plugin-vue": "5.1.4",
42
+ "@vitejs/plugin-vue-jsx": "4.0.1",
43
+ "@vue/babel-plugin-jsx": "1.2.5",
44
+ "@vue/compiler-sfc": "3.5.6",
45
+ "@vue/runtime-core": "3.5.6",
45
46
  "chokidar": "^3.5.2",
46
47
  "commander": "^8.3.0",
47
48
  "ejs": "^3.1.8",
48
- "esbuild": "0.19.3",
49
+ "esbuild": "0.23.1",
49
50
  "tinyexec": "^0.3.0",
50
51
  "fs-extra": "^9.0.1",
51
52
  "glob": "^7.2.0",
52
53
  "hash-sum": "^2.0.0",
53
- "inquirer": "^9.1.4",
54
54
  "less": "^3.12.2",
55
55
  "markdown-it": "^12.2.3",
56
56
  "nanospinner": "^1.1.0",
@@ -58,11 +58,11 @@
58
58
  "sass": "^1.77.4",
59
59
  "sharp": "0.31.1",
60
60
  "typescript": "^5.1.5",
61
- "vite": "5.0.10",
62
- "vitest": "2.0.5",
61
+ "vite": "5.4.6",
62
+ "vitest": "2.1.1",
63
63
  "vue": "3.4.21",
64
- "@varlet/shared": "3.5.0",
65
- "@varlet/vite-plugins": "3.5.0"
64
+ "@varlet/shared": "3.5.1",
65
+ "@varlet/vite-plugins": "3.5.1"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/babel__core": "^7.20.1",
@@ -70,14 +70,13 @@
70
70
  "@types/fs-extra": "^9.0.2",
71
71
  "@types/glob": "^7.1.3",
72
72
  "@types/hash-sum": "^1.0.0",
73
- "@types/inquirer": "^9.0.2",
74
73
  "@types/markdown-it": "^12.2.3",
75
74
  "@types/node": "^18.7.20",
76
75
  "@types/sharp": "0.31.1",
77
76
  "rimraf": "^5.0.1",
78
- "@varlet/icons": "3.5.0",
79
- "@varlet/ui": "3.5.0",
80
- "@varlet/touch-emulator": "3.5.0"
77
+ "@varlet/icons": "3.5.1",
78
+ "@varlet/ui": "3.5.1",
79
+ "@varlet/touch-emulator": "3.5.1"
81
80
  },
82
81
  "peerDependencies": {
83
82
  "@vitest/coverage-istanbul": "2.0.5",
@@ -88,9 +87,9 @@
88
87
  "live-server": "^1.2.1",
89
88
  "vue": "3.4.21",
90
89
  "vue-router": "4.2.0",
91
- "@varlet/ui": "3.5.0",
92
- "@varlet/icons": "3.5.0",
93
- "@varlet/touch-emulator": "3.5.0"
90
+ "@varlet/ui": "3.5.1",
91
+ "@varlet/icons": "3.5.1",
92
+ "@varlet/touch-emulator": "3.5.1"
94
93
  },
95
94
  "scripts": {
96
95
  "dev": "tsc --watch",