@varlet/cli 1.24.0 → 1.24.2-alpha.1640861757955

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.
@@ -26,7 +26,7 @@
26
26
  "lint": "varlet-cli lint",
27
27
  "genlog": "conventional-changelog -p angular -i CHANGELOG.md -s",
28
28
  "genAllLog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
29
- "release": "yarn compile && release-it",
29
+ "release": "pnpm compile && release-it",
30
30
  "test": "varlet-cli jest",
31
31
  "test:watch": "varlet-cli jest -w",
32
32
  "test:watchAll": "varlet-cli jest -wa"
@@ -35,7 +35,7 @@
35
35
  "vue": "^3.2.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@varlet/cli": "^1.20.0-alpha.0",
38
+ "@varlet/cli": "workspace:*",
39
39
  "vue": "3.2.16"
40
40
  },
41
41
  "release-it": {
@@ -0,0 +1,6 @@
1
+ interface ChangelogCommandOptions {
2
+ file?: string;
3
+ releaseCount?: number;
4
+ }
5
+ export declare function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>;
6
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.changelog = void 0;
7
+ var ora_1 = __importDefault(require("ora"));
8
+ var conventional_changelog_1 = __importDefault(require("conventional-changelog"));
9
+ var fs_extra_1 = require("fs-extra");
10
+ var path_1 = require("path");
11
+ var constant_1 = require("../shared/constant");
12
+ function changelog(_a) {
13
+ var _b = _a === void 0 ? {} : _a, _c = _b.releaseCount, releaseCount = _c === void 0 ? 0 : _c, _d = _b.file, file = _d === void 0 ? 'CHANGELOG.md' : _d;
14
+ var s = (0, ora_1.default)().start("Generating changelog");
15
+ return new Promise(function (resolve) {
16
+ (0, conventional_changelog_1.default)({
17
+ preset: 'angular',
18
+ releaseCount: releaseCount,
19
+ })
20
+ .pipe((0, fs_extra_1.createWriteStream)((0, path_1.resolve)(constant_1.CWD, file)))
21
+ .on('close', function () {
22
+ s.succeed("Changelog generated success!");
23
+ resolve();
24
+ });
25
+ });
26
+ }
27
+ exports.changelog = changelog;
@@ -0,0 +1 @@
1
+ export declare function commitLint(gitParams: string): void;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.commitLint = void 0;
7
+ var logger_1 = __importDefault(require("../shared/logger"));
8
+ var semver_1 = __importDefault(require("semver"));
9
+ function isVersion(message) {
10
+ return message.startsWith('v') && semver_1.default.valid(message.slice(1));
11
+ }
12
+ function commitLint(gitParams) {
13
+ var message = require('fs').readFileSync(gitParams, 'utf-8').trim();
14
+ var COMMIT_MESSAGE_RE = /^(revert|fix|feat|docs|perf|test|types|style|build|chore|release|refactor)(\(.+\))?: (.|\n)+/;
15
+ if (!isVersion(message) && !COMMIT_MESSAGE_RE.test(message)) {
16
+ logger_1.default.error("Commit message invalid");
17
+ logger_1.default.warning("The rules for commit messages are as follows\n\nExample:\n\nfeat: added a new feature\nfeat(ui/button): added a new feature in the ui/button scope\n\nfix: fixed a bug\nfix(ui/button): fixed a bug in the ui/button scope\n\ndocs: fixed an error in the documentation\ndocs(ui/button): fixed a documentation error in the ui/button scope\n\nAllowed types:\n- fix\n- feat\n- docs\n- perf\n- test\n- types\n- style\n- build\n- chore\n- release\n- refactor\n\nCommit message reference: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y\n\u53C2\u8003\u962E\u4E00\u5CF0Commit message\u7F16\u5199\u6307\u5357: https://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html");
18
+ process.exit(1);
19
+ }
20
+ }
21
+ exports.commitLint = commitLint;
@@ -57,18 +57,18 @@ function runTask(taskName, task) {
57
57
  return __generator(this, function (_a) {
58
58
  switch (_a.label) {
59
59
  case 0:
60
- s = (0, ora_1.default)().start("Compiling " + taskName);
60
+ s = (0, ora_1.default)().start("Compiling ".concat(taskName));
61
61
  _a.label = 1;
62
62
  case 1:
63
63
  _a.trys.push([1, 3, , 4]);
64
64
  return [4 /*yield*/, task()];
65
65
  case 2:
66
66
  _a.sent();
67
- s.succeed("Compilation " + taskName + " completed!");
67
+ s.succeed("Compilation ".concat(taskName, " completed!"));
68
68
  return [3 /*break*/, 4];
69
69
  case 3:
70
70
  e_1 = _a.sent();
71
- s.fail("Compilation " + taskName + " failed!");
71
+ s.fail("Compilation ".concat(taskName, " failed!"));
72
72
  logger_1.default.error(e_1.toString());
73
73
  return [3 /*break*/, 4];
74
74
  case 4: return [2 /*return*/];
@@ -56,10 +56,10 @@ function create(name) {
56
56
  case 0:
57
57
  namespace = (0, lodash_1.get)(varletConfig, 'namespace');
58
58
  bigCamelizeName = (0, fsUtils_1.bigCamelize)(name);
59
- vueTemplate = "<template>\n <div class=\"" + namespace + "-" + name + "\"></div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: '" + (0, fsUtils_1.bigCamelize)(namespace) + bigCamelizeName + "'\n})\n</script>\n\n<style lang=\"less\">\n." + namespace + "-" + name + " {\n display: flex;\n}\n</style>\n";
60
- indexTemplate = "import " + bigCamelizeName + " from './" + bigCamelizeName + ".vue'\nimport type { App } from 'vue'\n\n" + bigCamelizeName + ".install = function(app: App) {\n app.component(" + bigCamelizeName + ".name, " + bigCamelizeName + ")\n}\n\nexport const _" + bigCamelizeName + "Component = " + bigCamelizeName + "\n\nexport default " + bigCamelizeName + "\n";
61
- testsTemplate = "import example from '../example'\nimport " + bigCamelizeName + " from '..'\nimport { createApp } from 'vue'\nimport { mount } from '@vue/test-utils'\n\ntest('test " + name + " example', () => {\n const wrapper = mount(example)\n expect(wrapper.html()).toMatchSnapshot()\n})\n\ntest('test " + name + " plugin', () => {\n const app = createApp({}).use(" + bigCamelizeName + ")\n expect(app.component(" + bigCamelizeName + ".name)).toBeTruthy()\n})\n";
62
- exampleTemplate = "<template>\n <app-type></app-type>\n <" + namespace + "-" + name + "/>\n</template>\n\n<script>\nimport " + bigCamelizeName + " from '..'\nimport AppType from '@varlet/cli/site/mobile/components/AppType'\nimport { watchLang } from '@varlet/cli/site/utils'\nimport { use, pack } from './locale'\n\nexport default {\n name: '" + bigCamelizeName + "Example',\n components: {\n [" + bigCamelizeName + ".name]: " + bigCamelizeName + ",\n AppType\n },\n setup() {\n\n watchLang(use)\n\n return {\n pack\n }\n }\n}\n</script>\n";
59
+ vueTemplate = "<template>\n <div class=\"".concat(namespace, "-").concat(name, "\"></div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: '").concat((0, fsUtils_1.bigCamelize)(namespace)).concat(bigCamelizeName, "'\n})\n</script>\n\n<style lang=\"less\">\n.").concat(namespace, "-").concat(name, " {\n display: flex;\n}\n</style>\n");
60
+ indexTemplate = "import ".concat(bigCamelizeName, " from './").concat(bigCamelizeName, ".vue'\nimport type { App } from 'vue'\n\n").concat(bigCamelizeName, ".install = function(app: App) {\n app.component(").concat(bigCamelizeName, ".name, ").concat(bigCamelizeName, ")\n}\n\nexport const _").concat(bigCamelizeName, "Component = ").concat(bigCamelizeName, "\n\nexport default ").concat(bigCamelizeName, "\n");
61
+ testsTemplate = "import example from '../example'\nimport ".concat(bigCamelizeName, " from '..'\nimport { createApp } from 'vue'\nimport { mount } from '@vue/test-utils'\n\ntest('test ").concat(name, " example', () => {\n const wrapper = mount(example)\n expect(wrapper.html()).toMatchSnapshot()\n})\n\ntest('test ").concat(name, " plugin', () => {\n const app = createApp({}).use(").concat(bigCamelizeName, ")\n expect(app.component(").concat(bigCamelizeName, ".name)).toBeTruthy()\n})\n");
62
+ exampleTemplate = "<template>\n <app-type></app-type>\n <".concat(namespace, "-").concat(name, "/>\n</template>\n\n<script>\nimport ").concat(bigCamelizeName, " from '..'\nimport AppType from '@varlet/cli/site/mobile/components/AppType'\nimport { watchLang } from '@varlet/cli/site/utils'\nimport { use, pack } from './locale'\n\nexport default {\n name: '").concat(bigCamelizeName, "Example',\n components: {\n [").concat(bigCamelizeName, ".name]: ").concat(bigCamelizeName, ",\n AppType\n },\n setup() {\n\n watchLang(use)\n\n return {\n pack\n }\n }\n}\n</script>\n");
63
63
  localeIndexTemplate = "// lib\nimport _zhCN from '../../../locale/zh-CN'\nimport _enCN from '../../../locale/en-US'\n// mobile example doc\nimport zhCN from './zh-CN'\nimport enUS from './en-US'\nimport { useLocale, add as _add, use as _use } from '../../../locale'\n\nconst { add, use: exampleUse, pack, packs, merge } = useLocale()\n\nconst use = (lang: string) => {\n _use(lang)\n exampleUse(lang)\n}\n\nexport { add, pack, packs, merge, use }\n\n// lib\n_add('zh-CN', _zhCN)\n_add('en-US', _enCN)\n// mobile example doc\nadd('zh-CN', zhCN as any)\nadd('en-US', enUS as any)\n";
64
64
  localTemplate = "export default {\n\n}\n";
65
65
  componentDir = (0, path_1.resolve)(constant_1.SRC_DIR, name);
@@ -72,7 +72,7 @@ function create(name) {
72
72
  return [2 /*return*/];
73
73
  }
74
74
  return [4 /*yield*/, Promise.all([
75
- (0, fs_extra_1.outputFile)((0, path_1.resolve)(componentDir, bigCamelizeName + ".vue"), vueTemplate),
75
+ (0, fs_extra_1.outputFile)((0, path_1.resolve)(componentDir, "".concat(bigCamelizeName, ".vue")), vueTemplate),
76
76
  (0, fs_extra_1.outputFile)((0, path_1.resolve)(componentDir, 'index.ts'), indexTemplate),
77
77
  (0, fs_extra_1.outputFile)((0, path_1.resolve)(testsDir, 'index.spec.js'), testsTemplate),
78
78
  (0, fs_extra_1.outputFile)((0, path_1.resolve)(exampleDir, 'index.vue'), exampleTemplate),
@@ -84,14 +84,14 @@ function create(name) {
84
84
  ])];
85
85
  case 1:
86
86
  _a.sent();
87
- logger_1.default.success("Create " + name + " success!");
87
+ logger_1.default.success("Create ".concat(name, " success!"));
88
88
  logger_1.default.success("----------------------------");
89
- logger_1.default.success(name + "/");
89
+ logger_1.default.success("".concat(name, "/"));
90
90
  logger_1.default.success("|- __tests__/ # Unit test folder");
91
91
  logger_1.default.success("|- docs/ # Internationalized document folder");
92
92
  logger_1.default.success("|- example/ # Mobile phone example code");
93
93
  logger_1.default.success("|- example/locale # Example locale");
94
- logger_1.default.success("|- " + bigCamelizeName + ".vue # Sfc component, You can also use jsx or tsx");
94
+ logger_1.default.success("|- ".concat(bigCamelizeName, ".vue # Sfc component, You can also use jsx or tsx"));
95
95
  logger_1.default.success("|- index.ts # Component entry, the folder where the file exists will be exposed to the user");
96
96
  return [2 /*return*/];
97
97
  }
@@ -58,7 +58,7 @@ function startServer(force) {
58
58
  switch (_c.label) {
59
59
  case 0:
60
60
  isRestart = Boolean(server);
61
- logger_1.default.info((isRestart ? 'Res' : 'S') + "tarting server...");
61
+ logger_1.default.info("".concat(isRestart ? 'Res' : 'S', "tarting server..."));
62
62
  // close all instance
63
63
  _a = server;
64
64
  if (!_a)
@@ -99,7 +99,7 @@ function startServer(force) {
99
99
  watcher = chokidar_1.default.watch(constant_1.VARLET_CONFIG);
100
100
  watcher.on('change', function () { return startServer(force); });
101
101
  }
102
- logger_1.default.success("\n" + (isRestart ? 'Res' : 'S') + "tart successfully!!!");
102
+ logger_1.default.success("\n".concat(isRestart ? 'Res' : 'S', "tart successfully!!!"));
103
103
  return [2 /*return*/];
104
104
  }
105
105
  });
@@ -53,7 +53,7 @@ function syncVersion(name) {
53
53
  var file = (0, path_1.resolve)(constant_1.CWD, name, 'package.json');
54
54
  var pkg = JSON.parse((0, fs_extra_1.readFileSync)(file, 'utf-8'));
55
55
  var cliPkg = JSON.parse((0, fs_extra_1.readFileSync)(constant_1.CLI_PACKAGE_JSON, 'utf-8'));
56
- pkg.devDependencies['@varlet/cli'] = "^" + cliPkg.version;
56
+ pkg.devDependencies['@varlet/cli'] = "^".concat(cliPkg.version);
57
57
  pkg.files = ['es', 'lib', 'umd', 'highlight', 'types', 'README.md'];
58
58
  (0, fs_extra_1.writeFileSync)(file, JSON.stringify(pkg, null, 2));
59
59
  }
@@ -65,7 +65,7 @@ function gen(name) {
65
65
  case 0:
66
66
  dest = (0, path_1.resolve)(constant_1.CWD, name);
67
67
  if ((0, fs_extra_1.pathExistsSync)(dest)) {
68
- logger_1.default.warning(name + " already exists and cannot be recreated...");
68
+ logger_1.default.warning("".concat(name, " already exists and cannot be recreated..."));
69
69
  return [2 /*return*/];
70
70
  }
71
71
  return [4 /*yield*/, inquirer_1.default.prompt([
@@ -89,7 +89,7 @@ function gen(name) {
89
89
  removeFiles(dest);
90
90
  syncVersion(name);
91
91
  logger_1.default.success('Application generated successfully!');
92
- logger_1.default.info(" cd " + name + "\n yarn\n yarn dev");
92
+ logger_1.default.info(" cd ".concat(name, "\n yarn\n yarn dev"));
93
93
  logger_1.default.success("=======================\n Good luck have fun\n======================= ");
94
94
  return [2 /*return*/];
95
95
  }
@@ -56,7 +56,7 @@ function jest(cmd) {
56
56
  watchAll: cmd.watchAll,
57
57
  clearCache: cmd.clearCache,
58
58
  config: constant_1.JEST_CONFIG,
59
- testRegex: cmd.component && cmd.component + "/__tests__/.*.spec.[jt]s?$",
59
+ testRegex: cmd.component && "".concat(cmd.component, "/__tests__/.*.spec.[jt]s?$"),
60
60
  };
61
61
  _a.label = 1;
62
62
  case 1:
@@ -0,0 +1 @@
1
+ export declare function release(): Promise<void>;
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.release = void 0;
43
+ var inquirer_1 = __importDefault(require("inquirer"));
44
+ var ora_1 = __importDefault(require("ora"));
45
+ var execa_1 = __importDefault(require("execa"));
46
+ var logger_1 = __importDefault(require("../shared/logger"));
47
+ var semver_1 = __importDefault(require("semver"));
48
+ var glob_1 = __importDefault(require("glob"));
49
+ var constant_1 = require("../shared/constant");
50
+ var path_1 = require("path");
51
+ var fs_extra_1 = require("fs-extra");
52
+ var changelog_1 = require("./changelog");
53
+ var releaseTypes = ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch'];
54
+ function isWorktreeEmpty() {
55
+ return __awaiter(this, void 0, void 0, function () {
56
+ var ret;
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0: return [4 /*yield*/, (0, execa_1.default)('git', ['status', '--porcelain'])];
60
+ case 1:
61
+ ret = _a.sent();
62
+ return [2 /*return*/, !ret.stdout];
63
+ }
64
+ });
65
+ });
66
+ }
67
+ function publish() {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var s, ret;
70
+ return __generator(this, function (_a) {
71
+ switch (_a.label) {
72
+ case 0:
73
+ s = (0, ora_1.default)().start('Publishing all packages');
74
+ return [4 /*yield*/, (0, execa_1.default)('pnpm', ['-r', 'publish', '--no-git-checks', '--access', 'public'])];
75
+ case 1:
76
+ ret = _a.sent();
77
+ s.succeed('Publish all packages successfully');
78
+ ret.stdout && logger_1.default.info(ret.stdout);
79
+ return [2 /*return*/];
80
+ }
81
+ });
82
+ });
83
+ }
84
+ function pushGit(version, message) {
85
+ return __awaiter(this, void 0, void 0, function () {
86
+ var s, ret;
87
+ return __generator(this, function (_a) {
88
+ switch (_a.label) {
89
+ case 0:
90
+ s = (0, ora_1.default)().start('Pushing to remote git repository');
91
+ return [4 /*yield*/, (0, execa_1.default)('git', ['add', '.'])];
92
+ case 1:
93
+ _a.sent();
94
+ return [4 /*yield*/, (0, execa_1.default)('git', ['commit', '-m', message])];
95
+ case 2:
96
+ _a.sent();
97
+ return [4 /*yield*/, (0, execa_1.default)('git', ['tag', version])];
98
+ case 3:
99
+ _a.sent();
100
+ return [4 /*yield*/, (0, execa_1.default)('git', ['push'])];
101
+ case 4:
102
+ ret = _a.sent();
103
+ s.succeed('Push remote repository successfully');
104
+ ret.stdout && logger_1.default.info(ret.stdout);
105
+ return [2 /*return*/];
106
+ }
107
+ });
108
+ });
109
+ }
110
+ function updateVersion(version) {
111
+ var packageJsons = glob_1.default.sync('packages/*/package.json');
112
+ packageJsons.push('package.json');
113
+ return packageJsons.map(function (path) {
114
+ var file = (0, path_1.resolve)(constant_1.CWD, path);
115
+ var config = require(file);
116
+ var currentVersion = config.version;
117
+ config.version = version;
118
+ (0, fs_extra_1.writeFileSync)(file, JSON.stringify(config, null, 2));
119
+ config.version = currentVersion;
120
+ return { file: file, content: JSON.stringify(config, null, 2) };
121
+ });
122
+ }
123
+ function release() {
124
+ return __awaiter(this, void 0, void 0, function () {
125
+ var currentVersion, name_1, ret, type, isPreRelease, expectVersion, confirm_1, packageJsonMaps, error_1;
126
+ return __generator(this, function (_a) {
127
+ switch (_a.label) {
128
+ case 0:
129
+ _a.trys.push([0, 8, , 9]);
130
+ currentVersion = require((0, path_1.resolve)(constant_1.CWD, 'package.json')).version;
131
+ if (!currentVersion) {
132
+ logger_1.default.error('Your package is missing the version field');
133
+ return [2 /*return*/];
134
+ }
135
+ return [4 /*yield*/, isWorktreeEmpty()];
136
+ case 1:
137
+ if (!(_a.sent())) {
138
+ logger_1.default.error('Git worktree is not empty, please commit changed');
139
+ return [2 /*return*/];
140
+ }
141
+ name_1 = 'Please select release type';
142
+ return [4 /*yield*/, inquirer_1.default.prompt([
143
+ {
144
+ name: name_1,
145
+ type: 'list',
146
+ choices: releaseTypes,
147
+ },
148
+ ])];
149
+ case 2:
150
+ ret = _a.sent();
151
+ type = ret[name_1];
152
+ isPreRelease = type.startsWith('pre');
153
+ expectVersion = semver_1.default.inc(currentVersion, type, "alpha.".concat(Date.now()));
154
+ expectVersion = isPreRelease ? expectVersion.slice(0, -2) : expectVersion;
155
+ name_1 = 'version confirm';
156
+ return [4 /*yield*/, inquirer_1.default.prompt([
157
+ {
158
+ name: name_1,
159
+ type: 'confirm',
160
+ message: "All packages version ".concat(currentVersion, " -> ").concat(expectVersion, ":"),
161
+ },
162
+ ])];
163
+ case 3:
164
+ confirm_1 = _a.sent();
165
+ if (!confirm_1[name_1]) {
166
+ return [2 /*return*/];
167
+ }
168
+ packageJsonMaps = updateVersion(expectVersion);
169
+ if (!!isPreRelease) return [3 /*break*/, 6];
170
+ return [4 /*yield*/, (0, changelog_1.changelog)()];
171
+ case 4:
172
+ _a.sent();
173
+ return [4 /*yield*/, pushGit(expectVersion, "v".concat(expectVersion))];
174
+ case 5:
175
+ _a.sent();
176
+ _a.label = 6;
177
+ case 6: return [4 /*yield*/, publish()];
178
+ case 7:
179
+ _a.sent();
180
+ if (isPreRelease) {
181
+ packageJsonMaps.forEach(function (_a) {
182
+ var file = _a.file, content = _a.content;
183
+ return (0, fs_extra_1.writeFileSync)(file, content);
184
+ });
185
+ }
186
+ logger_1.default.success("Release version ".concat(expectVersion, " successfully!"));
187
+ return [3 /*break*/, 9];
188
+ case 8:
189
+ error_1 = _a.sent();
190
+ logger_1.default.error(error_1.toString());
191
+ return [3 /*break*/, 9];
192
+ case 9: return [2 /*return*/];
193
+ }
194
+ });
195
+ });
196
+ }
197
+ exports.release = release;
@@ -51,10 +51,10 @@ var NORMAL_EXPORT_START_RE = /export\s+default\s+{/;
51
51
  var DEFINE_EXPORT_START_RE = /export\s+default\s+defineComponent\s*\(\s*{/;
52
52
  function injectRender(script, render) {
53
53
  if (DEFINE_EXPORT_START_RE.test(script.trim())) {
54
- return script.trim().replace(DEFINE_EXPORT_START_RE, render + "\nexport default defineComponent({\n render, ");
54
+ return script.trim().replace(DEFINE_EXPORT_START_RE, "".concat(render, "\nexport default defineComponent({\n render, "));
55
55
  }
56
56
  if (NORMAL_EXPORT_START_RE.test(script.trim())) {
57
- return script.trim().replace(NORMAL_EXPORT_START_RE, render + "\nexport default {\n render, ");
57
+ return script.trim().replace(NORMAL_EXPORT_START_RE, "".concat(render, "\nexport default {\n render, "));
58
58
  }
59
59
  return script;
60
60
  }
@@ -70,12 +70,12 @@ function compileSFC(sfc) {
70
70
  descriptor = (0, compiler_sfc_1.parse)(sources, { sourceMap: false }).descriptor;
71
71
  script = descriptor.script, scriptSetup = descriptor.scriptSetup, template = descriptor.template, styles = descriptor.styles;
72
72
  if (scriptSetup) {
73
- logger_1.default.warning("\n Varlet Cli does not support compiling script setup syntax \n The error in " + sfc);
73
+ logger_1.default.warning("\n Varlet Cli does not support compiling script setup syntax \n The error in ".concat(sfc));
74
74
  return [2 /*return*/];
75
75
  }
76
76
  hasScope = styles.some(function (style) { return style.scoped; });
77
77
  id = (0, hash_sum_1.default)(sources);
78
- scopeId = hasScope ? "data-v-" + id : '';
78
+ scopeId = hasScope ? "data-v-".concat(id) : '';
79
79
  if (!script) return [3 /*break*/, 7];
80
80
  render = template &&
81
81
  (0, compiler_sfc_1.compileTemplate)({
@@ -103,7 +103,7 @@ function compileSFC(sfc) {
103
103
  case 3:
104
104
  if (!(index < styles.length)) return [3 /*break*/, 7];
105
105
  style = styles[index];
106
- file = (0, fsUtils_1.replaceExt)(sfc, "Sfc" + (index || '') + "." + (style.lang || 'css'));
106
+ file = (0, fsUtils_1.replaceExt)(sfc, "Sfc".concat(index || '', ".").concat(style.lang || 'css'));
107
107
  code = (0, compiler_sfc_1.compileStyle)({
108
108
  source: style.content,
109
109
  filename: file,
@@ -52,7 +52,7 @@ exports.REQUIRE_VUE_PATH_RE = /(?<!['"`]\s*)(require\s*\(\s*['"]\s*\.{1,2}\/.+)\
52
52
  exports.REQUIRE_TS_PATH_RE = /(?<!['"`]\s*)(require\s*\(\s*['"]\s*\.{1,2}\/.+)\.ts(\s*['"`]\))(?!\s*['"`])/g;
53
53
  exports.REQUIRE_JSX_PATH_RE = /(?<!['"`]\s*)(require\s*\(\s*['"]\s*\.{1,2}\/.+)\.jsx(\s*['"`]\))(?!\s*['"`])/g;
54
54
  exports.REQUIRE_TSX_PATH_RE = /(?<!['"`]\s*)(require\s*\(\s*['"]\s*\.{1,2}\/.+)\.tsx(\s*['"`]\))(?!\s*['"`])/g;
55
- var scriptReplacer = function (_, p1, p2) { return p1 + ".js" + p2; };
55
+ var scriptReplacer = function (_, p1, p2) { return "".concat(p1, ".js").concat(p2); };
56
56
  var replaceVueExt = function (script) {
57
57
  return script.replace(exports.IMPORT_VUE_PATH_RE, scriptReplacer).replace(exports.REQUIRE_VUE_PATH_RE, scriptReplacer);
58
58
  };
@@ -138,17 +138,17 @@ function compileESEntry(dir, publicDirs) {
138
138
  publicDirs.forEach(function (dirname) {
139
139
  var publicComponent = (0, fsUtils_1.bigCamelize)(dirname);
140
140
  publicComponents.push(publicComponent);
141
- imports.push("import " + publicComponent + ", * as " + publicComponent + "Module from './" + dirname + "'");
142
- constInternalComponents.push("export const _" + publicComponent + "Component = " + publicComponent + "Module._" + publicComponent + "Component || {}");
143
- plugins.push(publicComponent + ".install && app.use(" + publicComponent + ")");
144
- cssImports.push("import './" + dirname + "/style'");
145
- lessImports.push("import './" + dirname + "/style/less'");
141
+ imports.push("import ".concat(publicComponent, ", * as ").concat(publicComponent, "Module from './").concat(dirname, "'"));
142
+ constInternalComponents.push("export const _".concat(publicComponent, "Component = ").concat(publicComponent, "Module._").concat(publicComponent, "Component || {}"));
143
+ plugins.push("".concat(publicComponent, ".install && app.use(").concat(publicComponent, ")"));
144
+ cssImports.push("import './".concat(dirname, "/style'"));
145
+ lessImports.push("import './".concat(dirname, "/style/less'"));
146
146
  });
147
- install = "\nfunction install(app) {\n " + plugins.join('\n ') + "\n}\n";
148
- indexTemplate = imports.join('\n') + "\n\n" + constInternalComponents.join('\n') + "\n\n" + install + "\nexport {\n install,\n " + publicComponents.join(',\n ') + "\n}\n\nexport default {\n install,\n " + publicComponents.join(',\n ') + "\n}\n";
149
- styleTemplate = cssImports.join('\n') + "\n";
150
- umdTemplate = imports.join('\n') + "\n\n" + cssImports.join('\n') + "\n\n" + install + "\nexport {\n install,\n " + publicComponents.join(',\n ') + "\n}\n\nexport default {\n install,\n " + publicComponents.join(',\n ') + "\n}\n";
151
- lessTemplate = lessImports.join('\n') + "\n";
147
+ install = "\nfunction install(app) {\n ".concat(plugins.join('\n '), "\n}\n");
148
+ indexTemplate = "".concat(imports.join('\n'), "\n\n").concat(constInternalComponents.join('\n'), "\n\n").concat(install, "\nexport {\n install,\n ").concat(publicComponents.join(',\n '), "\n}\n\nexport default {\n install,\n ").concat(publicComponents.join(',\n '), "\n}\n");
149
+ styleTemplate = "".concat(cssImports.join('\n'), "\n");
150
+ umdTemplate = "".concat(imports.join('\n'), "\n\n").concat(cssImports.join('\n'), "\n\n").concat(install, "\nexport {\n install,\n ").concat(publicComponents.join(',\n '), "\n}\n\nexport default {\n install,\n ").concat(publicComponents.join(',\n '), "\n}\n");
151
+ lessTemplate = "".concat(lessImports.join('\n'), "\n");
152
152
  return [4 /*yield*/, Promise.all([
153
153
  (0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'index.js'), indexTemplate, 'utf-8'),
154
154
  (0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'umdIndex.js'), umdTemplate, 'utf-8'),
@@ -177,15 +177,15 @@ function compileCommonJSEntry(dir, publicDirs) {
177
177
  publicDirs.forEach(function (dirname) {
178
178
  var publicComponent = (0, fsUtils_1.bigCamelize)(dirname);
179
179
  publicComponents.push(publicComponent);
180
- requires.push("var " + publicComponent + " = require('./" + dirname + "')['default']");
181
- plugins.push(publicComponent + ".install && app.use(" + publicComponent + ")");
182
- cssRequires.push("require('./" + dirname + "/style')");
183
- lessRequires.push("require('./" + dirname + "/style/less')");
180
+ requires.push("var ".concat(publicComponent, " = require('./").concat(dirname, "')['default']"));
181
+ plugins.push("".concat(publicComponent, ".install && app.use(").concat(publicComponent, ")"));
182
+ cssRequires.push("require('./".concat(dirname, "/style')"));
183
+ lessRequires.push("require('./".concat(dirname, "/style/less')"));
184
184
  });
185
- install = "\nfunction install(app) {\n " + plugins.join('\n ') + "\n}\n";
186
- indexTemplate = requires.join('\n') + "\n\n" + install + "\n\nmodule.exports = {\n install,\n " + publicComponents.join(',\n ') + "\n}\n";
187
- styleTemplate = cssRequires.join('\n') + "\n";
188
- lessTemplate = lessRequires.join('\n') + "\n";
185
+ install = "\nfunction install(app) {\n ".concat(plugins.join('\n '), "\n}\n");
186
+ indexTemplate = "".concat(requires.join('\n'), "\n\n").concat(install, "\n\nmodule.exports = {\n install,\n ").concat(publicComponents.join(',\n '), "\n}\n");
187
+ styleTemplate = "".concat(cssRequires.join('\n'), "\n");
188
+ lessTemplate = "".concat(lessRequires.join('\n'), "\n");
189
189
  return [4 /*yield*/, Promise.all([
190
190
  (0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'index.js'), indexTemplate, 'utf-8'),
191
191
  (0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'style.js'), styleTemplate, 'utf-8'),
@@ -82,13 +82,13 @@ exports.getExampleRoutePath = getExampleRoutePath;
82
82
  function getComponentDocsRoutePath(componentDocsPath) {
83
83
  var _a;
84
84
  var _b = __read((_a = componentDocsPath.match(COMPONENT_DOCS_RE)) !== null && _a !== void 0 ? _a : [], 3), routePath = _b[1], language = _b[2];
85
- return "/" + language + "/" + routePath;
85
+ return "/".concat(language, "/").concat(routePath);
86
86
  }
87
87
  exports.getComponentDocsRoutePath = getComponentDocsRoutePath;
88
88
  function getRootDocsRoutePath(rootDocsPath) {
89
89
  var _a;
90
90
  var _b = __read((_a = rootDocsPath.match(ROOT_DOCS_RE)) !== null && _a !== void 0 ? _a : [], 3), routePath = _b[1], language = _b[2];
91
- return "/" + language + "/" + routePath;
91
+ return "/".concat(language, "/").concat(routePath);
92
92
  }
93
93
  exports.getRootDocsRoutePath = getRootDocsRoutePath;
94
94
  function findExamplePaths() {
@@ -161,8 +161,8 @@ function buildMobileSiteRoutes() {
161
161
  case 0: return [4 /*yield*/, findExamplePaths()];
162
162
  case 1:
163
163
  examplePaths = _a.sent();
164
- routes = examplePaths.map(function (examplePath) { return "\n {\n path: '" + getExampleRoutePath(examplePath) + "',\n // @ts-ignore\n component: () => import('" + examplePath + "')\n }"; });
165
- source = "export default [ " + routes.join(',') + "\n]";
164
+ routes = examplePaths.map(function (examplePath) { return "\n {\n path: '".concat(getExampleRoutePath(examplePath), "',\n // @ts-ignore\n component: () => import('").concat(examplePath, "')\n }"); });
165
+ source = "export default [ ".concat(routes.join(','), "\n]");
166
166
  return [4 /*yield*/, (0, fsUtils_1.outputFileSyncOnChange)(constant_1.SITE_MOBILE_ROUTES, source)];
167
167
  case 2:
168
168
  _a.sent();
@@ -180,9 +180,9 @@ function buildPcSiteRoutes() {
180
180
  case 0: return [4 /*yield*/, Promise.all([findComponentDocsPaths(), findRootDocsPaths()])];
181
181
  case 1:
182
182
  _a = __read.apply(void 0, [_b.sent(), 2]), componentDocsPaths = _a[0], rootDocsPaths = _a[1];
183
- componentDocsRoutes = componentDocsPaths.map(function (componentDocsPath) { return "\n {\n path: '" + getComponentDocsRoutePath(componentDocsPath) + "',\n // @ts-ignore\n component: () => import('" + componentDocsPath + "')\n }"; });
184
- rootDocsRoutes = rootDocsPaths.map(function (rootDocsPath) { return "\n {\n path: '" + getRootDocsRoutePath(rootDocsPath) + "',\n // @ts-ignore\n component: () => import('" + rootDocsPath + "')\n }"; });
185
- source = "export default [ " + __spreadArray(__spreadArray([], __read(componentDocsRoutes), false), [rootDocsRoutes], false).join(',') + "\n]";
183
+ componentDocsRoutes = componentDocsPaths.map(function (componentDocsPath) { return "\n {\n path: '".concat(getComponentDocsRoutePath(componentDocsPath), "',\n // @ts-ignore\n component: () => import('").concat(componentDocsPath, "')\n }"); });
184
+ rootDocsRoutes = rootDocsPaths.map(function (rootDocsPath) { return "\n {\n path: '".concat(getRootDocsRoutePath(rootDocsPath), "',\n // @ts-ignore\n component: () => import('").concat(rootDocsPath, "')\n }"); });
185
+ source = "export default [ ".concat(__spreadArray(__spreadArray([], __read(componentDocsRoutes), false), [rootDocsRoutes], false).join(','), "\n]");
186
186
  (0, fsUtils_1.outputFileSyncOnChange)(constant_1.SITE_PC_ROUTES, source);
187
187
  return [2 /*return*/];
188
188
  }
@@ -68,16 +68,16 @@ function extractStyleDependencies(file, code, reg, expect, self) {
68
68
  var modules = process.env.BABEL_MODULE;
69
69
  styleImports.forEach(function (styleImport) {
70
70
  var normalizedPath = normalizeStyleDependency(styleImport, reg);
71
- (0, fsUtils_1.smartAppendFileSync)(cssFile, modules === 'commonjs' ? "require('" + normalizedPath + ".css')\n" : "import '" + normalizedPath + ".css'\n");
72
- (0, fsUtils_1.smartAppendFileSync)(lessFile, modules === 'commonjs' ? "require('" + normalizedPath + "." + expect + "')\n" : "import '" + normalizedPath + "." + expect + "'\n");
71
+ (0, fsUtils_1.smartAppendFileSync)(cssFile, modules === 'commonjs' ? "require('".concat(normalizedPath, ".css')\n") : "import '".concat(normalizedPath, ".css'\n"));
72
+ (0, fsUtils_1.smartAppendFileSync)(lessFile, modules === 'commonjs' ? "require('".concat(normalizedPath, ".").concat(expect, "')\n") : "import '".concat(normalizedPath, ".").concat(expect, "'\n"));
73
73
  });
74
74
  if (self) {
75
75
  (0, fsUtils_1.smartAppendFileSync)(cssFile, modules === 'commonjs'
76
- ? "require('" + normalizeStyleDependency(base, reg) + ".css')\n"
77
- : "import '" + normalizeStyleDependency(base, reg) + ".css'\n");
76
+ ? "require('".concat(normalizeStyleDependency(base, reg), ".css')\n")
77
+ : "import '".concat(normalizeStyleDependency(base, reg), ".css'\n"));
78
78
  (0, fsUtils_1.smartAppendFileSync)(lessFile, modules === 'commonjs'
79
- ? "require('" + normalizeStyleDependency(base, reg) + "." + expect + "')\n"
80
- : "import '" + normalizeStyleDependency(base, reg) + "." + expect + "'\n");
79
+ ? "require('".concat(normalizeStyleDependency(base, reg), ".").concat(expect, "')\n")
80
+ : "import '".concat(normalizeStyleDependency(base, reg), ".").concat(expect, "'\n"));
81
81
  }
82
82
  return code.replace(reg, '');
83
83
  }
@@ -85,17 +85,17 @@ function compileTable(md, titleRe) {
85
85
  }
86
86
  exports.compileTable = compileTable;
87
87
  function compileTags(table, tags, componentName) {
88
- tags[(0, lodash_1.get)(varletConfig, 'namespace') + "-" + componentName] = {
88
+ tags["".concat((0, lodash_1.get)(varletConfig, 'namespace'), "-").concat(componentName)] = {
89
89
  attributes: table.attributesTable.map(function (row) { return (0, exports.replaceDot)(row[0]); }),
90
90
  };
91
91
  }
92
92
  exports.compileTags = compileTags;
93
93
  function compileAttributes(table, attributes, componentName) {
94
94
  table.attributesTable.forEach(function (row) {
95
- var attrNamespace = (0, lodash_1.get)(varletConfig, 'namespace') + "-" + componentName + "/" + (0, exports.replaceDot)(row[0]);
95
+ var attrNamespace = "".concat((0, lodash_1.get)(varletConfig, 'namespace'), "-").concat(componentName, "/").concat((0, exports.replaceDot)(row[0]));
96
96
  attributes[attrNamespace] = {
97
97
  type: (0, exports.replaceUnderline)(row[2]),
98
- description: row[1] + " \u9ED8\u8BA4\u503C\uFF1A" + (0, exports.replaceDot)(row[3]),
98
+ description: "".concat(row[1], " \u9ED8\u8BA4\u503C\uFF1A").concat((0, exports.replaceDot)(row[3])),
99
99
  };
100
100
  });
101
101
  }
@@ -120,7 +120,7 @@ function compileWebTypes(table, webTypes, componentName) {
120
120
  description: row[1],
121
121
  }); });
122
122
  webTypes.contributions.html.tags.push({
123
- name: (0, lodash_1.get)(varletConfig, 'namespace') + "-" + componentName,
123
+ name: "".concat((0, lodash_1.get)(varletConfig, 'namespace'), "-").concat(componentName),
124
124
  attributes: attributes,
125
125
  events: events,
126
126
  slots: slots,
@@ -44,7 +44,7 @@ var path_1 = require("path");
44
44
  var varlet_config_1 = require("../config/varlet.config");
45
45
  var lodash_1 = require("lodash");
46
46
  function generateReference(moduleDir) {
47
- (0, fs_extra_1.writeFileSync)((0, path_1.resolve)(moduleDir, 'index.d.ts'), "export * from '" + (0, path_1.relative)(moduleDir, constant_1.TYPES_DIR) + "'\n");
47
+ (0, fs_extra_1.writeFileSync)((0, path_1.resolve)(moduleDir, 'index.d.ts'), "export * from '".concat((0, path_1.relative)(moduleDir, constant_1.TYPES_DIR), "'\n"));
48
48
  }
49
49
  exports.generateReference = generateReference;
50
50
  function compileTypes() {
@@ -67,13 +67,13 @@ function compileTypes() {
67
67
  declares = [];
68
68
  ignoreEntryDir.forEach(function (filename) {
69
69
  var componentName = filename.slice(0, filename.indexOf('.d.ts'));
70
- exports.push("export * from './" + componentName + "'");
70
+ exports.push("export * from './".concat(componentName, "'"));
71
71
  if (!componentName.startsWith(namespace)) {
72
- declares.push("" + (0, fsUtils_1.bigCamelize)(namespace) + (0, fsUtils_1.bigCamelize)(componentName) + ": typeof import('" + name + "')['_" + (0, fsUtils_1.bigCamelize)(componentName) + "Component']");
72
+ declares.push("".concat((0, fsUtils_1.bigCamelize)(namespace)).concat((0, fsUtils_1.bigCamelize)(componentName), ": typeof import('").concat(name, "')['_").concat((0, fsUtils_1.bigCamelize)(componentName), "Component']"));
73
73
  }
74
74
  });
75
- template = "import type { App } from 'vue'\n\nexport const install: (app: App) => void\n\n" + exports.join('\n') + "\n";
76
- globalTemplate = "declare module 'vue' {\n export interface GlobalComponents {\n " + declares.join('\n ') + "\n }\n}\n\nexport {}\n";
75
+ template = "import type { App } from 'vue'\n\nexport const install: (app: App) => void\n\n".concat(exports.join('\n'), "\n");
76
+ globalTemplate = "declare module 'vue' {\n export interface GlobalComponents {\n ".concat(declares.join('\n '), "\n }\n}\n\nexport {}\n");
77
77
  return [4 /*yield*/, Promise.all([
78
78
  (0, fs_extra_1.writeFile)((0, path_1.resolve)(constant_1.TYPES_DIR, 'index.d.ts'), template),
79
79
  (0, fs_extra_1.writeFile)((0, path_1.resolve)(constant_1.TYPES_DIR, 'global.d.ts'), globalTemplate),
@@ -30,7 +30,7 @@ module.exports = __assign({ moduleNameMapper: {
30
30
  '\\.(js|jsx|ts|tsx)$': 'babel-jest',
31
31
  }, collectCoverage: true, collectCoverageFrom: [
32
32
  'src/**/*.{js,jsx,ts,tsx,vue}',
33
- "!**/" + constant_1.EXAMPLE_DIR_NAME + "/**",
34
- "!**/" + constant_1.DOCS_DIR_NAME + "/**",
35
- "!**/" + constant_1.TESTS_DIR_NAME + "/**",
33
+ "!**/".concat(constant_1.EXAMPLE_DIR_NAME, "/**"),
34
+ "!**/".concat(constant_1.DOCS_DIR_NAME, "/**"),
35
+ "!**/".concat(constant_1.TESTS_DIR_NAME, "/**"),
36
36
  ], moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'vue'], transformIgnorePatterns: ['/node_modules/(?!(@varlet/cli))/'] }, getRootConfig());
@@ -49,8 +49,8 @@ function getDevConfig(varletConfig) {
49
49
  (0, plugin_vue_jsx_1.default)(),
50
50
  (0, vite_plugin_html_1.injectHtml)({
51
51
  data: {
52
- pcTitle: (0, lodash_1.get)(varletConfig, "pc.title['" + defaultLanguage + "']"),
53
- mobileTitle: (0, lodash_1.get)(varletConfig, "mobile.title['" + defaultLanguage + "']"),
52
+ pcTitle: (0, lodash_1.get)(varletConfig, "pc.title['".concat(defaultLanguage, "']")),
53
+ mobileTitle: (0, lodash_1.get)(varletConfig, "mobile.title['".concat(defaultLanguage, "']")),
54
54
  logo: (0, lodash_1.get)(varletConfig, "logo"),
55
55
  baidu: (0, lodash_1.get)(varletConfig, "analysis.baidu", ''),
56
56
  },
@@ -86,8 +86,8 @@ function inlineCSS(fileName, dir) {
86
86
  var jsFile = (0, path_1.resolve)(dir, fileName);
87
87
  var cssCode = (0, fs_extra_1.readFileSync)(cssFile, 'utf-8');
88
88
  var jsCode = (0, fs_extra_1.readFileSync)(jsFile, 'utf-8');
89
- var injectCode = ";(function(){var style=document.createElement('style');style.type='text/css';style.rel='stylesheet';style.appendChild(document.createTextNode(`" + cssCode.replace(/\\/g, '\\\\') + "`));var head=document.querySelector('head');head.appendChild(style)})();";
90
- (0, fs_extra_1.writeFileSync)(jsFile, "" + injectCode + jsCode);
89
+ var injectCode = ";(function(){var style=document.createElement('style');style.type='text/css';style.rel='stylesheet';style.appendChild(document.createTextNode(`".concat(cssCode.replace(/\\/g, '\\\\'), "`));var head=document.querySelector('head');head.appendChild(style)})();");
90
+ (0, fs_extra_1.writeFileSync)(jsFile, "".concat(injectCode).concat(jsCode));
91
91
  (0, fs_extra_1.copyFileSync)(cssFile, (0, path_1.resolve)(constant_1.LIB_DIR, 'style.css'));
92
92
  (0, fs_extra_1.removeSync)(cssFile);
93
93
  },
@@ -104,7 +104,7 @@ function clear() {
104
104
  }
105
105
  function getUMDConfig(varletConfig) {
106
106
  var name = (0, lodash_1.get)(varletConfig, 'name');
107
- var fileName = (0, lodash_1.kebabCase)(name) + ".js";
107
+ var fileName = "".concat((0, lodash_1.kebabCase)(name), ".js");
108
108
  return {
109
109
  logLevel: 'silent',
110
110
  build: {
package/lib/index.js CHANGED
@@ -30,8 +30,11 @@ var jest_1 = require("./commands/jest");
30
30
  var lint_1 = require("./commands/lint");
31
31
  var gen_1 = require("./commands/gen");
32
32
  var preview_1 = require("./commands/preview");
33
+ var changelog_1 = require("./commands/changelog");
34
+ var release_1 = require("./commands/release");
35
+ var commitLint_1 = require("./commands/commitLint");
33
36
  var program = new commander_1.Command();
34
- program.version("varlet-cli " + require('../package.json').version).usage('<command> [options]');
37
+ program.version("varlet-cli ".concat(require('../package.json').version)).usage('<command> [options]');
35
38
  program
36
39
  .command('dev')
37
40
  .option('-f --force', 'Force dep pre-optimization regardless of whether deps have changed')
@@ -55,10 +58,18 @@ program
55
58
  .option('-cc --clearCache', 'Clear test cache')
56
59
  .action(jest_1.jest);
57
60
  program.command('gen <name>').description('Generate cli application').action(gen_1.gen);
61
+ program
62
+ .command('changelog')
63
+ .option('-rc --releaseCount <releaseCount>', 'Release count')
64
+ .option('-f --file <file>', 'Changelog filename')
65
+ .description('Generate changelog')
66
+ .action(changelog_1.changelog);
67
+ program.command('release').description('Release all packages and generate changelogs').action(release_1.release);
68
+ program.command('commit-lint <gitParams>').description('Lint commit message').action(commitLint_1.commitLint);
58
69
  program.on('command:*', function (_a) {
59
70
  var _b = __read(_a, 1), cmd = _b[0];
60
71
  program.outputHelp();
61
- logger_1.default.error("\nUnknown command " + cmd + ".\n");
72
+ logger_1.default.error("\nUnknown command ".concat(cmd, ".\n"));
62
73
  process.exitCode = 1;
63
74
  });
64
75
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "1.24.0",
3
+ "version": "1.24.2-alpha.1640861757955",
4
4
  "description": "cli of varlet",
5
5
  "bin": {
6
6
  "varlet-cli": "./lib/index.js"
@@ -27,59 +27,42 @@
27
27
  "bugs": {
28
28
  "url": "https://github.com/haoziqaq/varlet/issues"
29
29
  },
30
- "scripts": {
31
- "dev": "tsc --watch",
32
- "build": "tsc"
33
- },
34
- "gitHead": "859769307c762134844c0ddfdb69452631f76d62",
30
+ "gitHead": "ee9c3866bedad96c86365b0f9888a3a6bb781b1f",
35
31
  "dependencies": {
32
+ "@varlet/icons": "1.24.2-alpha.1640861757955",
33
+ "@varlet/markdown-vite-plugin": "1.24.2-alpha.1640861757955",
34
+ "@varlet/touch-emulator": "1.24.2-alpha.1640861757955",
36
35
  "@babel/core": "^7.14.8",
37
36
  "@babel/preset-env": "^7.14.8",
38
37
  "@babel/preset-typescript": "^7.14.5",
39
- "@commitlint/cli": "^11.0.0",
40
- "@commitlint/config-conventional": "^11.0.0",
41
- "@release-it/conventional-changelog": "^3.3.0",
42
- "@varlet/eslint-config": "^1.13.0",
43
- "@varlet/icons": "^1.24.0",
44
- "@varlet/markdown-vite-plugin": "^1.24.0",
45
- "@varlet/stylelint-config": "^1.9.0",
46
- "@varlet/touch-emulator": "^1.0.1",
38
+ "@babel/helper-plugin-utils": "^7.14.5",
39
+ "vue": "3.2.16",
40
+ "vite": "2.6.5",
47
41
  "@vitejs/plugin-vue": "1.9.2",
48
42
  "@vitejs/plugin-vue-jsx": "1.1.8",
49
- "@vue/babel-plugin-jsx": "^1.0.7",
50
- "@vue/compiler-sfc": "3.2.22",
51
- "@vue/test-utils": "^2.0.0-rc.6",
52
- "babel-jest": "26.6.3",
43
+ "vite-plugin-html": "^2.1.0",
44
+ "@vue/babel-plugin-jsx": "1.0.7",
45
+ "@vue/compiler-sfc": "3.2.16",
46
+ "conventional-changelog": "^3.1.25",
53
47
  "chalk": "^4.1.0",
48
+ "glob": "^7.2.0",
49
+ "semver": "^7.3.5",
54
50
  "chokidar": "^3.5.2",
55
- "clipboard": "^2.0.6",
56
51
  "commander": "^8.3.0",
57
- "commitizen": "^4.2.2",
58
- "conventional-changelog-cli": "^2.1.1",
59
- "cz-conventional-changelog": "^3.3.0",
60
- "eslint": "^7.30.0",
61
52
  "execa": "^5.0.0",
62
53
  "fs-extra": "^9.0.1",
63
54
  "hash-sum": "^2.0.0",
64
- "husky": "^7.0.1",
65
55
  "inquirer": "^8.1.2",
66
- "jest": "^26.6.3",
67
56
  "less": "^3.12.2",
68
- "lint-staged": "^10.5.0",
69
- "live-server": "^1.2.1",
70
57
  "lodash": "^4.17.21",
71
- "lodash-es": "^4.17.21",
72
58
  "ora": "^5.4.0",
73
- "prettier": "^2.3.2",
74
- "release-it": "^14.11.5",
75
59
  "slash": "^3.0.0",
76
- "stylelint": "^13.13.1",
77
- "ts-jest": "^26.5.1",
78
60
  "typescript": "^4.4.4",
79
- "vite": "2.6.5",
80
- "vite-plugin-html": "^2.1.0",
61
+ "jest": "^26.6.3",
62
+ "babel-jest": "26.6.3",
63
+ "ts-jest": "^26.5.1",
81
64
  "vue-jest": "^5.0.0-alpha.8",
82
- "vue-router": "4.0.12"
65
+ "lodash-es": "^4.17.21"
83
66
  },
84
67
  "devDependencies": {
85
68
  "@types/babel__core": "^7.1.12",
@@ -90,6 +73,16 @@
90
73
  "@types/lodash-es": "^4.17.5"
91
74
  },
92
75
  "peerDependencies": {
93
- "vue": "3.2.16"
76
+ "@varlet/touch-emulator": "1.24.2-alpha.1640861757955",
77
+ "@vue/test-utils": "^2.0.0-rc.6",
78
+ "vue": "3.2.16",
79
+ "vue-router": "4.0.12",
80
+ "live-server": "^1.2.1",
81
+ "lodash-es": "^4.17.21",
82
+ "clipboard": "^2.0.6"
83
+ },
84
+ "scripts": {
85
+ "dev": "tsc --watch",
86
+ "build": "tsc"
94
87
  }
95
- }
88
+ }
@@ -1,6 +1,5 @@
1
1
  import { isNumber, isString, toNumber, kebabCase } from './shared'
2
2
  import type { StyleVars } from '../../utils'
3
- import { requestAnimationFrame } from '@varlet/ui/src/utils/elements'
4
3
 
5
4
  export function getLeft(element: HTMLElement): number {
6
5
  const { left } = element.getBoundingClientRect()
@@ -1,14 +0,0 @@
1
- node_modules
2
-
3
- .varlet
4
- .idea
5
- .vscode
6
- *.log
7
- .DS_Store
8
-
9
- site
10
- lib
11
- es
12
- umd
13
- coverage
14
- highlight
package/site/.DS_Store DELETED
Binary file
Binary file