@varlet/cli 2.0.0 → 2.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.en-US.md CHANGED
@@ -42,7 +42,7 @@ Also refer to `@varlet/ui` [varlet.config.js](https://github.com/varletjs/varlet
42
42
  | -- | -------------- | -------- | ---------- |
43
43
  | `name` | The full name of the component library, which will be used as the package name | _string_ | `Varlet` |
44
44
  | `namespace` | Component library namespace, which will be used as a component prefix | _string_ | `var` |
45
- | `host` | Development server host | _number_ | `localhost` |
45
+ | `host` | Development server host | _string_ | `localhost` |
46
46
  | `port` | Development server port | _number_ | `8080` |
47
47
  | `title` | The title of the component library in the documentation | _string_ | `VARLET` |
48
48
  | `logo` | The logo of the component library in the documentation | _string_ | `-` |
package/README.md CHANGED
@@ -40,7 +40,7 @@ varlet-cli gen
40
40
  | ----- | -------------- | -------- | ---------- |
41
41
  | `name` | 组件库全名,会作为包名 | _string_ | `Varlet` |
42
42
  | `namespace` | 组件库命名空间, 会作为组件前缀 | _string_ | `var` |
43
- | `host` | 开发服务器主机 | _number_ | `localhost` |
43
+ | `host` | 开发服务器主机 | _string_ | `localhost` |
44
44
  | `port` | 开发服务器端口 | _number_ | `8080` |
45
45
  | `title` | 文档中组件库的标题 | _string_ | `VARLET` |
46
46
  | `logo` | 文档中组件库的logo | _string_ | `-` |
package/lib/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/lib/bin.js ADDED
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __read = (this && this.__read) || function (o, n) {
4
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
5
+ if (!m) return o;
6
+ var i = m.call(o), r, ar = [], e;
7
+ try {
8
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
9
+ }
10
+ catch (error) { e = { error: error }; }
11
+ finally {
12
+ try {
13
+ if (r && !r.done && (m = i["return"])) m.call(i);
14
+ }
15
+ finally { if (e) throw e.error; }
16
+ }
17
+ return ar;
18
+ };
19
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20
+ return (mod && mod.__esModule) ? mod : { "default": mod };
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ var logger_1 = __importDefault(require("./shared/logger"));
24
+ var commander_1 = require("commander");
25
+ var dev_1 = require("./commands/dev");
26
+ var build_1 = require("./commands/build");
27
+ var vite_1 = require("./commands/vite");
28
+ var compile_1 = require("./commands/compile");
29
+ var create_1 = require("./commands/create");
30
+ var jest_1 = require("./commands/jest");
31
+ var lint_1 = require("./commands/lint");
32
+ var gen_1 = require("./commands/gen");
33
+ var preview_1 = require("./commands/preview");
34
+ var changelog_1 = require("./commands/changelog");
35
+ var release_1 = require("./commands/release");
36
+ var commitLint_1 = require("./commands/commitLint");
37
+ var program = new commander_1.Command();
38
+ program.version("varlet-cli ".concat(require('../package.json').version)).usage('<command> [options]');
39
+ program
40
+ .command('dev')
41
+ .option('-f --force', 'Force dep pre-optimization regardless of whether deps have changed')
42
+ .description('Run varlet development environment')
43
+ .action(dev_1.dev);
44
+ program.command('build').description('Build varlet site for production').action(build_1.build);
45
+ program
46
+ .command('build:vite')
47
+ .description('Use vite build app for production')
48
+ .action(function () { return (0, vite_1.vite)('build'); });
49
+ program
50
+ .command('dev:vite')
51
+ .description('Use vite start server for development')
52
+ .action(function () { return (0, vite_1.vite)('dev'); });
53
+ program.command('preview').description('Preview varlet site for production').action(preview_1.preview);
54
+ program
55
+ .command('compile')
56
+ .description('Compile varlet components library code')
57
+ .option('-nu, --noUmd', 'Do not compile umd target code')
58
+ .action(compile_1.compile);
59
+ program.command('lint').description('Lint code').action(lint_1.lint);
60
+ program
61
+ .command('create')
62
+ .description('Create a component directory')
63
+ .option('-n, --name <componentName>', 'Component name')
64
+ .option('-s, --sfc', 'Generate files in sfc format')
65
+ .option('-t, --tsx', 'Generate files in tsx format')
66
+ .option('-l, --locale', 'Generator internationalized files')
67
+ .action(create_1.create);
68
+ program
69
+ .command('jest')
70
+ .description('Run Jest in work directory')
71
+ .option('-w, --watch', 'Watch files for changes and rerun tests related to changed files')
72
+ .option('-wa, --watchAll', 'Watch files for changes and rerun all tests when something changes')
73
+ .option('-c, --component <componentName>', 'Test a specific component')
74
+ .option('-cc --clearCache', 'Clear test cache')
75
+ .action(jest_1.jest);
76
+ program
77
+ .command('gen')
78
+ .description('Generate cli application')
79
+ .option('-n, --name <applicationName>', 'Application name')
80
+ .option('-s, --sfc', 'Generate files in sfc format')
81
+ .option('-t, --tsx', 'Generate files in tsx format')
82
+ .option('-l, --locale', 'Generator internationalized files')
83
+ .action(gen_1.gen);
84
+ program
85
+ .command('changelog')
86
+ .option('-rc --releaseCount <releaseCount>', 'Release count')
87
+ .option('-f --file <file>', 'Changelog filename')
88
+ .description('Generate changelog')
89
+ .action(changelog_1.changelog);
90
+ program
91
+ .command('release')
92
+ .option('-r --remote <remote>', 'Remote name')
93
+ .description('Release all packages and generate changelogs')
94
+ .action(release_1.release);
95
+ program.command('commit-lint <gitParams>').description('Lint commit message').action(commitLint_1.commitLint);
96
+ program.on('command:*', function (_a) {
97
+ var _b = __read(_a, 1), cmd = _b[0];
98
+ program.outputHelp();
99
+ logger_1.default.error("\nUnknown command ".concat(cmd, ".\n"));
100
+ process.exitCode = 1;
101
+ });
102
+ program.parse();
@@ -1 +1,43 @@
1
- export declare function getVarletConfig(emit?: boolean): Record<string, any>;
1
+ interface VarletConfig {
2
+ /**
3
+ * @default `Varlet`
4
+ * UI library name.
5
+ */
6
+ name?: string;
7
+ /**
8
+ * @default `var`
9
+ * Component class name preffix
10
+ */
11
+ namespace?: string;
12
+ /**
13
+ * @default `localhost`
14
+ * Local dev server host
15
+ */
16
+ host?: string;
17
+ /**
18
+ * @default `8080`
19
+ * Local dev server protcol
20
+ */
21
+ port?: number;
22
+ logo?: string;
23
+ defaultLanguage?: 'zh-CN' | 'en-US';
24
+ /**
25
+ * @default `false`
26
+ * Show mobile component on the right.
27
+ */
28
+ useMobile?: boolean;
29
+ lightTheme?: Record<string, string>;
30
+ darkTheme?: Record<string, string>;
31
+ highlight?: {
32
+ style: string;
33
+ };
34
+ analysis?: {
35
+ baidu: string;
36
+ };
37
+ pc?: Record<string, any>;
38
+ mobile?: Record<string, any>;
39
+ moduleCompatible?: Record<string, string>;
40
+ }
41
+ export declare const defineConfig: (conf: VarletConfig) => VarletConfig;
42
+ export declare function getVarletConfig(emit?: boolean): any;
43
+ export {};
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVarletConfig = void 0;
3
+ exports.getVarletConfig = exports.defineConfig = void 0;
4
4
  var fs_extra_1 = require("fs-extra");
5
5
  var lodash_1 = require("lodash");
6
6
  var constant_1 = require("../shared/constant");
7
7
  var fsUtils_1 = require("../shared/fsUtils");
8
+ var defineConfig = function (conf) { return conf; };
9
+ exports.defineConfig = defineConfig;
8
10
  function getVarletConfig(emit) {
9
11
  if (emit === void 0) { emit = false; }
10
12
  var config = {};
package/lib/index.d.ts CHANGED
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
- export {};
1
+ export { defineConfig } from './config/varlet.config';
package/lib/index.js CHANGED
@@ -1,102 +1,5 @@
1
- #!/usr/bin/env node
2
1
  "use strict";
3
- var __read = (this && this.__read) || function (o, n) {
4
- var m = typeof Symbol === "function" && o[Symbol.iterator];
5
- if (!m) return o;
6
- var i = m.call(o), r, ar = [], e;
7
- try {
8
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
9
- }
10
- catch (error) { e = { error: error }; }
11
- finally {
12
- try {
13
- if (r && !r.done && (m = i["return"])) m.call(i);
14
- }
15
- finally { if (e) throw e.error; }
16
- }
17
- return ar;
18
- };
19
- var __importDefault = (this && this.__importDefault) || function (mod) {
20
- return (mod && mod.__esModule) ? mod : { "default": mod };
21
- };
22
2
  Object.defineProperty(exports, "__esModule", { value: true });
23
- var logger_1 = __importDefault(require("./shared/logger"));
24
- var commander_1 = require("commander");
25
- var dev_1 = require("./commands/dev");
26
- var build_1 = require("./commands/build");
27
- var vite_1 = require("./commands/vite");
28
- var compile_1 = require("./commands/compile");
29
- var create_1 = require("./commands/create");
30
- var jest_1 = require("./commands/jest");
31
- var lint_1 = require("./commands/lint");
32
- var gen_1 = require("./commands/gen");
33
- var preview_1 = require("./commands/preview");
34
- var changelog_1 = require("./commands/changelog");
35
- var release_1 = require("./commands/release");
36
- var commitLint_1 = require("./commands/commitLint");
37
- var program = new commander_1.Command();
38
- program.version("varlet-cli ".concat(require('../package.json').version)).usage('<command> [options]');
39
- program
40
- .command('dev')
41
- .option('-f --force', 'Force dep pre-optimization regardless of whether deps have changed')
42
- .description('Run varlet development environment')
43
- .action(dev_1.dev);
44
- program.command('build').description('Build varlet site for production').action(build_1.build);
45
- program
46
- .command('build:vite')
47
- .description('Use vite build app for production')
48
- .action(function () { return (0, vite_1.vite)('build'); });
49
- program
50
- .command('dev:vite')
51
- .description('Use vite start server for development')
52
- .action(function () { return (0, vite_1.vite)('dev'); });
53
- program.command('preview').description('Preview varlet site for production').action(preview_1.preview);
54
- program
55
- .command('compile')
56
- .description('Compile varlet components library code')
57
- .option('-nu, --noUmd', 'Do not compile umd target code')
58
- .action(compile_1.compile);
59
- program.command('lint').description('Lint code').action(lint_1.lint);
60
- program
61
- .command('create')
62
- .description('Create a component directory')
63
- .option('-n, --name <componentName>', 'Component name')
64
- .option('-s, --sfc', 'Generate files in sfc format')
65
- .option('-t, --tsx', 'Generate files in tsx format')
66
- .option('-l, --locale', 'Generator internationalized files')
67
- .action(create_1.create);
68
- program
69
- .command('jest')
70
- .description('Run Jest in work directory')
71
- .option('-w, --watch', 'Watch files for changes and rerun tests related to changed files')
72
- .option('-wa, --watchAll', 'Watch files for changes and rerun all tests when something changes')
73
- .option('-c, --component <componentName>', 'Test a specific component')
74
- .option('-cc --clearCache', 'Clear test cache')
75
- .action(jest_1.jest);
76
- program
77
- .command('gen')
78
- .description('Generate cli application')
79
- .option('-n, --name <applicationName>', 'Application name')
80
- .option('-s, --sfc', 'Generate files in sfc format')
81
- .option('-t, --tsx', 'Generate files in tsx format')
82
- .option('-l, --locale', 'Generator internationalized files')
83
- .action(gen_1.gen);
84
- program
85
- .command('changelog')
86
- .option('-rc --releaseCount <releaseCount>', 'Release count')
87
- .option('-f --file <file>', 'Changelog filename')
88
- .description('Generate changelog')
89
- .action(changelog_1.changelog);
90
- program
91
- .command('release')
92
- .option('-r --remote <remote>', 'Remote name')
93
- .description('Release all packages and generate changelogs')
94
- .action(release_1.release);
95
- program.command('commit-lint <gitParams>').description('Lint commit message').action(commitLint_1.commitLint);
96
- program.on('command:*', function (_a) {
97
- var _b = __read(_a, 1), cmd = _b[0];
98
- program.outputHelp();
99
- logger_1.default.error("\nUnknown command ".concat(cmd, ".\n"));
100
- process.exitCode = 1;
101
- });
102
- program.parse();
3
+ exports.defineConfig = void 0;
4
+ var varlet_config_1 = require("./config/varlet.config");
5
+ Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return varlet_config_1.defineConfig; } });
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "cli of varlet",
5
5
  "bin": {
6
- "varlet-cli": "./lib/index.js"
6
+ "varlet-cli": "./lib/bin.js"
7
7
  },
8
+ "main": "./lib/index.js",
9
+ "module": "./lib/index.js",
8
10
  "keywords": [
9
11
  "cli",
10
12
  "varlet"
@@ -32,10 +34,10 @@
32
34
  "@babel/helper-plugin-utils": "^7.14.5",
33
35
  "@babel/preset-env": "^7.14.8",
34
36
  "@babel/preset-typescript": "^7.14.5",
35
- "@varlet/icons": "2.0.0",
36
- "@varlet/markdown-vite-plugin": "2.0.0",
37
- "@varlet/shared": "2.0.0",
38
- "@varlet/touch-emulator": "2.0.0",
37
+ "@varlet/icons": "2.0.1",
38
+ "@varlet/markdown-vite-plugin": "2.0.1",
39
+ "@varlet/shared": "2.0.1",
40
+ "@varlet/touch-emulator": "2.0.1",
39
41
  "@vitejs/plugin-vue": "3.0.1",
40
42
  "@vitejs/plugin-vue-jsx": "2.0.0",
41
43
  "@vue/babel-plugin-jsx": "1.1.1",
@@ -80,7 +82,7 @@
80
82
  "@types/semver": "^7.3.9"
81
83
  },
82
84
  "peerDependencies": {
83
- "@varlet/touch-emulator": "2.0.0",
85
+ "@varlet/touch-emulator": "2.0.1",
84
86
  "@vue/runtime-core": "3.2.16",
85
87
  "@vue/test-utils": "^2.0.2",
86
88
  "clipboard": "^2.0.6",
@@ -19,11 +19,8 @@
19
19
  "es/**/style/*",
20
20
  "lib/**/style/*",
21
21
  "es/style.js",
22
- "es/less.js",
23
22
  "lib/style.js",
24
- "lib/less.js",
25
- "*.css",
26
- "*.less"
23
+ "*.css"
27
24
  ],
28
25
  "scripts": {
29
26
  "preinstall": "npx only-allow pnpm",
@@ -1,4 +1,6 @@
1
- module.exports = {
1
+ const { defineConfig } = require('@varlet/cli')
2
+
3
+ module.exports = defineConfig({
2
4
  logo: './logo.svg',
3
5
  useMobile: true,
4
6
  pc: {
@@ -41,5 +43,5 @@ module.exports = {
41
43
  i18n: null,
42
44
  darkMode: null,
43
45
  },
44
- },
45
- }
46
+ }
47
+ })
@@ -19,11 +19,8 @@
19
19
  "es/**/style/*",
20
20
  "lib/**/style/*",
21
21
  "es/style.js",
22
- "es/less.js",
23
22
  "lib/style.js",
24
- "lib/less.js",
25
- "*.css",
26
- "*.less"
23
+ "*.css"
27
24
  ],
28
25
  "scripts": {
29
26
  "preinstall": "npx only-allow pnpm",
@@ -1,4 +1,6 @@
1
- module.exports = {
1
+ const { defineConfig } = require('@varlet/cli')
2
+
3
+ module.exports = defineConfig({
2
4
  logo: './logo.svg',
3
5
  useMobile: true,
4
6
  pc: {
@@ -44,4 +46,4 @@ module.exports = {
44
46
  darkMode: null,
45
47
  },
46
48
  },
47
- }
49
+ })