@varlet/cli 1.22.0-alpha.6 → 1.22.0-alpha.64
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 +11 -0
- package/README.md +11 -0
- package/generators/sfc/package.json +3 -3
- package/generators/sfc/varlet.config.js +5 -0
- package/generators/tsx/package.json +3 -3
- package/generators/tsx/varlet.config.js +5 -0
- package/lib/commands/dev.js +14 -3
- package/lib/commands/preview.d.ts +1 -0
- package/lib/commands/preview.js +65 -0
- package/lib/compiler/compileSiteEntry.d.ts +1 -4
- package/lib/compiler/compileSiteEntry.js +10 -20
- package/lib/config/jest.config.js +0 -1
- package/lib/config/vite.config.js +6 -6
- package/lib/index.js +2 -0
- package/lib/shared/constant.d.ts +1 -9
- package/lib/shared/constant.js +2 -10
- package/lib/site/components/app-bar/index.d.ts +3 -0
- package/lib/site/components/app-bar/index.js +12 -0
- package/lib/site/components/app-bar/props.d.ts +21 -0
- package/lib/site/components/app-bar/props.js +28 -0
- package/lib/site/components/button/index.d.ts +3 -0
- package/lib/site/components/button/index.js +12 -0
- package/lib/site/components/button/props.d.ts +62 -0
- package/lib/site/components/button/props.js +69 -0
- package/lib/site/components/cell/index.d.ts +3 -0
- package/lib/site/components/cell/index.js +12 -0
- package/lib/site/components/cell/props.d.ts +27 -0
- package/lib/site/components/cell/props.js +30 -0
- package/lib/site/components/context/index.d.ts +15 -0
- package/lib/site/components/context/index.js +11 -0
- package/lib/site/components/context/lock.d.ts +10 -0
- package/lib/site/components/context/lock.js +94 -0
- package/lib/site/components/context/zIndex.d.ts +4 -0
- package/lib/site/components/context/zIndex.js +19 -0
- package/lib/site/components/icon/index.d.ts +3 -0
- package/lib/site/components/icon/index.js +12 -0
- package/lib/site/components/icon/props.d.ts +23 -0
- package/lib/site/components/icon/props.js +25 -0
- package/lib/site/components/loading/index.d.ts +3 -0
- package/lib/site/components/loading/index.js +12 -0
- package/lib/site/components/loading/props.d.ts +26 -0
- package/lib/site/components/loading/props.js +34 -0
- package/lib/site/components/menu/index.d.ts +3 -0
- package/lib/site/components/menu/index.js +12 -0
- package/lib/site/components/menu/props.d.ts +40 -0
- package/lib/site/components/menu/props.js +43 -0
- package/lib/site/components/progress/index.d.ts +3 -0
- package/lib/site/components/progress/index.js +12 -0
- package/lib/site/components/progress/props.d.ts +43 -0
- package/lib/site/components/progress/props.js +57 -0
- package/lib/site/components/ripple/index.d.ts +8 -0
- package/lib/site/components/ripple/index.js +125 -0
- package/lib/site/components/utils/components.d.ts +53 -0
- package/lib/site/components/utils/components.js +279 -0
- package/lib/site/components/utils/elements.d.ts +30 -0
- package/lib/site/components/utils/elements.js +240 -0
- package/lib/site/components/utils/shared.d.ts +36 -0
- package/lib/site/components/utils/shared.js +181 -0
- package/lib/site/mobile/main.d.ts +3 -0
- package/lib/site/mobile/main.js +93 -0
- package/lib/site/pc/main.d.ts +3 -0
- package/lib/site/pc/main.js +69 -0
- package/lib/site/useProgress.d.ts +4 -0
- package/lib/site/useProgress.js +58 -0
- package/lib/site/utils.d.ts +24 -0
- package/lib/site/utils.js +133 -0
- package/package.json +9 -9
- package/site/.DS_Store +0 -0
- package/site/components/app-bar/AppBar.vue +45 -0
- package/site/components/app-bar/appBar.less +66 -0
- package/site/components/app-bar/index.ts +10 -0
- package/site/components/app-bar/props.ts +25 -0
- package/site/components/button/Button.vue +84 -0
- package/site/components/button/button.less +183 -0
- package/site/components/button/index.ts +10 -0
- package/site/components/button/props.ts +70 -0
- package/site/components/cell/Cell.vue +42 -0
- package/site/components/cell/cell.less +74 -0
- package/site/components/cell/index.ts +10 -0
- package/site/components/cell/props.ts +27 -0
- package/site/components/context/index.ts +17 -0
- package/site/components/context/lock.ts +103 -0
- package/site/components/context/zIndex.ts +20 -0
- package/site/components/icon/Icon.vue +68 -0
- package/site/components/icon/icon.less +25 -0
- package/site/components/icon/index.ts +10 -0
- package/site/components/icon/props.ts +24 -0
- package/site/components/loading/Loading.vue +55 -0
- package/site/components/loading/index.ts +10 -0
- package/site/components/loading/loading.less +420 -0
- package/site/components/loading/props.ts +37 -0
- package/site/components/menu/Menu.vue +113 -0
- package/site/components/menu/index.ts +10 -0
- package/site/components/menu/menu.less +27 -0
- package/site/components/menu/props.ts +43 -0
- package/site/components/progress/Progress.vue +108 -0
- package/site/components/progress/index.ts +10 -0
- package/site/components/progress/progress.less +98 -0
- package/site/components/progress/props.ts +55 -0
- package/site/components/ripple/index.ts +167 -0
- package/site/components/ripple/ripple.less +17 -0
- package/site/components/styles/common.less +64 -0
- package/site/components/styles/elevation.less +126 -0
- package/site/components/styles/var.less +27 -0
- package/site/components/utils/components.ts +53 -0
- package/site/components/utils/elements.ts +83 -0
- package/site/components/utils/shared.ts +27 -0
- package/site/mobile/App.vue +20 -16
- package/site/mobile/components/AppHome.vue +6 -6
- package/site/mobile/main.ts +14 -7
- package/site/pc/App.vue +15 -10
- package/site/pc/components/AppHeader.vue +14 -10
- package/site/pc/components/AppMobile.vue +3 -3
- package/site/pc/components/AppSidebar.vue +16 -20
- package/site/pc/main.ts +7 -4
- package/site/useProgress.ts +10 -8
- package/site/utils.ts +13 -2
- package/varlet.default.config.js +3 -2
- package/generators/sfc/yarn.lock +0 -11231
- package/generators/tsx/yarn.lock +0 -11231
package/README.en-US.md
CHANGED
|
@@ -66,11 +66,16 @@ subject to the theme of the `varlet` official document
|
|
|
66
66
|
| `color-link` |
|
|
67
67
|
| `color-type` |
|
|
68
68
|
| `color-progress` |
|
|
69
|
+
| `color-progress-track` |
|
|
69
70
|
| `color-side-bar` |
|
|
70
71
|
| `color-side-bar-active-background` |
|
|
71
72
|
| `color-app-bar` |
|
|
72
73
|
| `color-mobile-cell-hover` |
|
|
73
74
|
| `color-mobile-cell-hover-background` |
|
|
75
|
+
| `color-pc-language-active` |
|
|
76
|
+
| `color-pc-language-active-background` |
|
|
77
|
+
| `color-mobile-language-active` |
|
|
78
|
+
| `color-mobile-language-active-background` |
|
|
74
79
|
|
|
75
80
|
#### SiteHighlight
|
|
76
81
|
|
|
@@ -162,6 +167,12 @@ varlet-cli dev
|
|
|
162
167
|
varlet-cli build
|
|
163
168
|
```
|
|
164
169
|
|
|
170
|
+
#### Preview documentation site
|
|
171
|
+
|
|
172
|
+
```shell
|
|
173
|
+
varlet-cli preview
|
|
174
|
+
```
|
|
175
|
+
|
|
165
176
|
#### Build component library code
|
|
166
177
|
|
|
167
178
|
```shell
|
package/README.md
CHANGED
|
@@ -62,11 +62,16 @@ yarn dev
|
|
|
62
62
|
| `color-link` |
|
|
63
63
|
| `color-type` |
|
|
64
64
|
| `color-progress` |
|
|
65
|
+
| `color-progress-track` |
|
|
65
66
|
| `color-side-bar` |
|
|
66
67
|
| `color-side-bar-active-background` |
|
|
67
68
|
| `color-app-bar` |
|
|
68
69
|
| `color-mobile-cell-hover` |
|
|
69
70
|
| `color-mobile-cell-hover-background` |
|
|
71
|
+
| `color-pc-language-active` |
|
|
72
|
+
| `color-pc-language-active-background` |
|
|
73
|
+
| `color-mobile-language-active` |
|
|
74
|
+
| `color-mobile-language-active-background` |
|
|
70
75
|
|
|
71
76
|
#### SiteHighlight
|
|
72
77
|
|
|
@@ -157,6 +162,12 @@ varlet-cli dev
|
|
|
157
162
|
varlet-cli build
|
|
158
163
|
```
|
|
159
164
|
|
|
165
|
+
#### 预览文档站点
|
|
166
|
+
|
|
167
|
+
```shell
|
|
168
|
+
varlet-cli preview
|
|
169
|
+
```
|
|
170
|
+
|
|
160
171
|
#### 构建组件库代码
|
|
161
172
|
|
|
162
173
|
```shell
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"commit": "git-cz",
|
|
20
20
|
"dev": "varlet-cli dev",
|
|
21
21
|
"build": "varlet-cli build",
|
|
22
|
+
"preview": "varlet-cli preview",
|
|
22
23
|
"compile": "varlet-cli compile",
|
|
23
24
|
"create": "varlet-cli create",
|
|
24
25
|
"lint": "varlet-cli lint",
|
|
@@ -29,12 +30,11 @@
|
|
|
29
30
|
"test:watch": "varlet-cli jest -w"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"vue": "^3.
|
|
33
|
+
"vue": "^3.2.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@varlet/cli": "^1.20.0-alpha.0",
|
|
36
|
-
"vue": "3.2.
|
|
37
|
-
"@vue/compiler-sfc": "3.2.17"
|
|
37
|
+
"vue": "3.2.16"
|
|
38
38
|
},
|
|
39
39
|
"release-it": {
|
|
40
40
|
"git": {
|
|
@@ -9,9 +9,14 @@ module.exports = {
|
|
|
9
9
|
'color-link': '#009688',
|
|
10
10
|
'color-type': '#009688',
|
|
11
11
|
'color-progress': '#009688',
|
|
12
|
+
'color-progress-track': '#fff',
|
|
12
13
|
'color-side-bar': '#009688',
|
|
13
14
|
'color-side-bar-active-background': '#00968821',
|
|
14
15
|
'color-app-bar': '#009688',
|
|
16
|
+
'color-pc-language-active': '#009688',
|
|
17
|
+
'color-pc-language-active-background': '#00968821',
|
|
18
|
+
'color-mobile-language-active': '#009688',
|
|
19
|
+
'color-mobile-language-active-background': '#00968821',
|
|
15
20
|
'color-mobile-cell-hover': '#009688',
|
|
16
21
|
'color-mobile-cell-hover-background': '#00968821',
|
|
17
22
|
},
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"commit": "git-cz",
|
|
20
20
|
"dev": "varlet-cli dev",
|
|
21
21
|
"build": "varlet-cli build",
|
|
22
|
+
"preview": "varlet-cli preview",
|
|
22
23
|
"compile": "varlet-cli compile",
|
|
23
24
|
"create": "varlet-cli create",
|
|
24
25
|
"lint": "varlet-cli lint",
|
|
@@ -29,12 +30,11 @@
|
|
|
29
30
|
"test:watch": "varlet-cli jest -w"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"vue": "^3.
|
|
33
|
+
"vue": "^3.2.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@varlet/cli": "^1.20.0-alpha.0",
|
|
36
|
-
"vue": "3.2.
|
|
37
|
-
"@vue/compiler-sfc": "3.2.17"
|
|
37
|
+
"vue": "3.2.16"
|
|
38
38
|
},
|
|
39
39
|
"release-it": {
|
|
40
40
|
"git": {
|
|
@@ -9,9 +9,14 @@ module.exports = {
|
|
|
9
9
|
'color-link': '#009688',
|
|
10
10
|
'color-type': '#009688',
|
|
11
11
|
'color-progress': '#009688',
|
|
12
|
+
'color-progress-track': '#fff',
|
|
12
13
|
'color-side-bar': '#009688',
|
|
13
14
|
'color-side-bar-active-background': '#00968821',
|
|
14
15
|
'color-app-bar': '#009688',
|
|
16
|
+
'color-pc-language-active': '#009688',
|
|
17
|
+
'color-pc-language-active-background': '#00968821',
|
|
18
|
+
'color-mobile-language-active': '#009688',
|
|
19
|
+
'color-mobile-language-active-background': '#00968821',
|
|
15
20
|
'color-mobile-cell-hover': '#009688',
|
|
16
21
|
'color-mobile-cell-hover-background': '#00968821',
|
|
17
22
|
},
|
package/lib/commands/dev.js
CHANGED
|
@@ -35,8 +35,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
38
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
42
|
exports.dev = void 0;
|
|
43
|
+
var address_1 = __importDefault(require("address"));
|
|
44
|
+
var logger_1 = __importDefault(require("../shared/logger"));
|
|
40
45
|
var vite_1 = require("vite");
|
|
41
46
|
var fs_extra_1 = require("fs-extra");
|
|
42
47
|
var constant_1 = require("../shared/constant");
|
|
@@ -46,7 +51,7 @@ var varlet_config_1 = require("../config/varlet.config");
|
|
|
46
51
|
var lodash_1 = require("lodash");
|
|
47
52
|
function dev(cmd) {
|
|
48
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
-
var devConfig, server;
|
|
54
|
+
var varletConfig, devConfig, inlineConfig, server, host, port, ipv4;
|
|
50
55
|
return __generator(this, function (_a) {
|
|
51
56
|
switch (_a.label) {
|
|
52
57
|
case 0:
|
|
@@ -55,13 +60,19 @@ function dev(cmd) {
|
|
|
55
60
|
return [4 /*yield*/, compileSiteEntry_1.buildSiteEntry()];
|
|
56
61
|
case 1:
|
|
57
62
|
_a.sent();
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
varletConfig = varlet_config_1.getVarletConfig();
|
|
64
|
+
devConfig = vite_config_1.getDevConfig(varletConfig);
|
|
65
|
+
inlineConfig = lodash_1.merge(devConfig, cmd.force ? { server: { force: true } } : {});
|
|
66
|
+
return [4 /*yield*/, vite_1.createServer(inlineConfig)];
|
|
60
67
|
case 2:
|
|
61
68
|
server = _a.sent();
|
|
62
69
|
return [4 /*yield*/, server.listen()];
|
|
63
70
|
case 3:
|
|
64
71
|
_a.sent();
|
|
72
|
+
host = lodash_1.get(varletConfig, 'host');
|
|
73
|
+
port = lodash_1.get(varletConfig, 'port');
|
|
74
|
+
ipv4 = address_1.default.ip();
|
|
75
|
+
logger_1.default.success("Server running at\nLocal: http://" + host + ":" + port + "\nNetwork: http://" + ipv4 + ":" + port);
|
|
65
76
|
return [2 /*return*/];
|
|
66
77
|
}
|
|
67
78
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function preview(): Promise<void>;
|
|
@@ -0,0 +1,65 @@
|
|
|
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.preview = void 0;
|
|
43
|
+
var logger_1 = __importDefault(require("../shared/logger"));
|
|
44
|
+
var execa_1 = __importDefault(require("execa"));
|
|
45
|
+
var constant_1 = require("../shared/constant");
|
|
46
|
+
var fs_extra_1 = require("fs-extra");
|
|
47
|
+
function preview() {
|
|
48
|
+
var _a;
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
return __generator(this, function (_b) {
|
|
51
|
+
if (!fs_extra_1.pathExistsSync(constant_1.SITE_OUTPUT_PATH)) {
|
|
52
|
+
logger_1.default.warning('Cannot find the site folder, you must first run the build command to build the document site');
|
|
53
|
+
return [2 /*return*/];
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
(_a = execa_1.default.command('live-server --port=5500', { cwd: constant_1.SITE_OUTPUT_PATH }).stdout) === null || _a === void 0 ? void 0 : _a.pipe(process.stdout);
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
logger_1.default.error(e);
|
|
60
|
+
}
|
|
61
|
+
return [2 /*return*/];
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exports.preview = preview;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack';
|
|
2
1
|
export declare function getExampleRoutePath(examplePath: string): string;
|
|
3
2
|
export declare function getComponentDocsRoutePath(componentDocsPath: string): string;
|
|
4
3
|
export declare function getRootDocsRoutePath(rootDocsPath: string): string;
|
|
@@ -7,7 +6,5 @@ export declare function findComponentDocsPaths(): Promise<string[]>;
|
|
|
7
6
|
export declare function findRootDocsPaths(): Promise<string[]>;
|
|
8
7
|
export declare function buildMobileSiteRoutes(): Promise<void>;
|
|
9
8
|
export declare function buildPcSiteRoutes(): Promise<void>;
|
|
9
|
+
export declare function buildSiteSource(): Promise<void>;
|
|
10
10
|
export declare function buildSiteEntry(): Promise<void>;
|
|
11
|
-
export declare class VarletSitePlugin {
|
|
12
|
-
apply(compiler: Compiler): void;
|
|
13
|
-
}
|
|
@@ -60,9 +60,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
60
60
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
61
61
|
};
|
|
62
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
-
exports.
|
|
63
|
+
exports.buildSiteEntry = exports.buildSiteSource = exports.buildPcSiteRoutes = exports.buildMobileSiteRoutes = exports.findRootDocsPaths = exports.findComponentDocsPaths = exports.findExamplePaths = exports.getRootDocsRoutePath = exports.getComponentDocsRoutePath = exports.getExampleRoutePath = void 0;
|
|
64
64
|
var slash_1 = __importDefault(require("slash"));
|
|
65
|
-
var chokidar_1 = __importDefault(require("chokidar"));
|
|
66
65
|
var constant_1 = require("../shared/constant");
|
|
67
66
|
var fs_extra_1 = require("fs-extra");
|
|
68
67
|
var path_1 = require("path");
|
|
@@ -187,13 +186,21 @@ function buildPcSiteRoutes() {
|
|
|
187
186
|
});
|
|
188
187
|
}
|
|
189
188
|
exports.buildPcSiteRoutes = buildPcSiteRoutes;
|
|
189
|
+
function buildSiteSource() {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
191
|
+
return __generator(this, function (_a) {
|
|
192
|
+
return [2 /*return*/, fs_extra_1.copy(constant_1.SITE, constant_1.SITE_DIR)];
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
exports.buildSiteSource = buildSiteSource;
|
|
190
197
|
function buildSiteEntry() {
|
|
191
198
|
return __awaiter(this, void 0, void 0, function () {
|
|
192
199
|
return __generator(this, function (_a) {
|
|
193
200
|
switch (_a.label) {
|
|
194
201
|
case 0:
|
|
195
202
|
varlet_config_1.getVarletConfig();
|
|
196
|
-
return [4 /*yield*/, Promise.all([buildMobileSiteRoutes(), buildPcSiteRoutes()])];
|
|
203
|
+
return [4 /*yield*/, Promise.all([buildMobileSiteRoutes(), buildPcSiteRoutes(), buildSiteSource()])];
|
|
197
204
|
case 1:
|
|
198
205
|
_a.sent();
|
|
199
206
|
return [2 /*return*/];
|
|
@@ -202,20 +209,3 @@ function buildSiteEntry() {
|
|
|
202
209
|
});
|
|
203
210
|
}
|
|
204
211
|
exports.buildSiteEntry = buildSiteEntry;
|
|
205
|
-
var PLUGIN_NAME = 'VarletSitePlugin';
|
|
206
|
-
var VarletSitePlugin = /** @class */ (function () {
|
|
207
|
-
function VarletSitePlugin() {
|
|
208
|
-
}
|
|
209
|
-
VarletSitePlugin.prototype.apply = function (compiler) {
|
|
210
|
-
if (process.env.NODE_ENV === 'production') {
|
|
211
|
-
compiler.hooks.beforeCompile.tapPromise(PLUGIN_NAME, buildSiteEntry);
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
var watcher = chokidar_1.default.watch([constant_1.SITE_EXAMPLE_GLOB, constant_1.SITE_DOCS_GLOB, constant_1.VARLET_CONFIG]);
|
|
215
|
-
watcher.on('add', buildSiteEntry).on('unlink', buildSiteEntry).on('change', buildSiteEntry);
|
|
216
|
-
compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, buildSiteEntry);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
return VarletSitePlugin;
|
|
220
|
-
}());
|
|
221
|
-
exports.VarletSitePlugin = VarletSitePlugin;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var constant_1 = require("../shared/constant");
|
|
4
4
|
module.exports = {
|
|
5
5
|
moduleNameMapper: {
|
|
6
|
-
'@varlet/ui': constant_1.JEST_LIB_MOCK,
|
|
7
6
|
'\\.(css|less)$': constant_1.JEST_STYLE_MOCK,
|
|
8
7
|
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': constant_1.JEST_MEDIA_MOCK,
|
|
9
8
|
},
|
|
@@ -27,7 +27,7 @@ function getDevConfig(varletConfig) {
|
|
|
27
27
|
var defaultLanguage = lodash_1.get(varletConfig, 'defaultLanguage');
|
|
28
28
|
var host = lodash_1.get(varletConfig, 'host');
|
|
29
29
|
return {
|
|
30
|
-
root: constant_1.
|
|
30
|
+
root: constant_1.SITE_DIR,
|
|
31
31
|
resolve: {
|
|
32
32
|
extensions: constant_1.VITE_RESOLVE_EXTENSIONS,
|
|
33
33
|
alias: {
|
|
@@ -49,8 +49,8 @@ function getDevConfig(varletConfig) {
|
|
|
49
49
|
plugin_vue_jsx_1.default(),
|
|
50
50
|
vite_plugin_html_1.injectHtml({
|
|
51
51
|
data: {
|
|
52
|
-
pcTitle: lodash_1.get(varletConfig, "title[" + defaultLanguage + "]"),
|
|
53
|
-
mobileTitle: lodash_1.get(varletConfig, "title[" + defaultLanguage + "]"),
|
|
52
|
+
pcTitle: lodash_1.get(varletConfig, "pc.title['" + defaultLanguage + "']"),
|
|
53
|
+
mobileTitle: lodash_1.get(varletConfig, "mobile.title['" + defaultLanguage + "']"),
|
|
54
54
|
logo: lodash_1.get(varletConfig, "logo"),
|
|
55
55
|
baidu: lodash_1.get(varletConfig, "analysis.baidu", ''),
|
|
56
56
|
},
|
|
@@ -61,14 +61,14 @@ function getDevConfig(varletConfig) {
|
|
|
61
61
|
exports.getDevConfig = getDevConfig;
|
|
62
62
|
function getBuildConfig(varletConfig) {
|
|
63
63
|
var devConfig = getDevConfig(varletConfig);
|
|
64
|
-
return __assign(__assign({}, devConfig), { build: {
|
|
64
|
+
return __assign(__assign({}, devConfig), { base: './', build: {
|
|
65
65
|
outDir: constant_1.SITE_OUTPUT_PATH,
|
|
66
66
|
brotliSize: false,
|
|
67
67
|
emptyOutDir: true,
|
|
68
68
|
rollupOptions: {
|
|
69
69
|
input: {
|
|
70
|
-
main: path_1.resolve(constant_1.
|
|
71
|
-
|
|
70
|
+
main: path_1.resolve(constant_1.SITE_DIR, 'index.html'),
|
|
71
|
+
mobile: path_1.resolve(constant_1.SITE_DIR, 'mobile.html'),
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
74
|
} });
|
package/lib/index.js
CHANGED
|
@@ -29,12 +29,14 @@ var create_1 = require("./commands/create");
|
|
|
29
29
|
var jest_1 = require("./commands/jest");
|
|
30
30
|
var lint_1 = require("./commands/lint");
|
|
31
31
|
var gen_1 = require("./commands/gen");
|
|
32
|
+
var preview_1 = require("./commands/preview");
|
|
32
33
|
commander_1.version("varlet-cli " + require('../package.json').version).usage('<command> [options]');
|
|
33
34
|
commander_1.command('dev')
|
|
34
35
|
.option('-f --force', 'Force dep pre-optimization regardless of whether deps have changed')
|
|
35
36
|
.description('Run varlet development environment')
|
|
36
37
|
.action(dev_1.dev);
|
|
37
38
|
commander_1.command('build').description('Build varlet site for production').action(build_1.build);
|
|
39
|
+
commander_1.command('preview').description('Preview varlet site for production').action(preview_1.preview);
|
|
38
40
|
commander_1.command('compile')
|
|
39
41
|
.description('Compile varlet components library code')
|
|
40
42
|
.option('-nu, --noUmd', 'Do not compile umd target code')
|
package/lib/shared/constant.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export declare const CWD: string;
|
|
2
|
-
export declare const POSTCSS_CONFIG: string;
|
|
3
|
-
export declare const TS_CONFIG: string;
|
|
4
2
|
export declare const VARLET_CONFIG: string;
|
|
5
3
|
export declare const SRC_DIR: string;
|
|
6
4
|
export declare const ES_DIR: string;
|
|
@@ -8,7 +6,6 @@ export declare const UMD_DIR: string;
|
|
|
8
6
|
export declare const TYPES_DIR: string;
|
|
9
7
|
export declare const ROOT_DOCS_DIR: string;
|
|
10
8
|
export declare const ESLINT_EXTENSIONS: string[];
|
|
11
|
-
export declare const WEBPACK_RESOLVE_EXTENSIONS: string[];
|
|
12
9
|
export declare const VITE_RESOLVE_EXTENSIONS: string[];
|
|
13
10
|
export declare const SCRIPTS_EXTENSIONS: string[];
|
|
14
11
|
export declare const PUBLIC_DIR_INDEXES: string[];
|
|
@@ -20,17 +17,13 @@ export declare const EXAMPLE_DIR_INDEX = "index.vue";
|
|
|
20
17
|
export declare const TESTS_DIR_NAME = "__tests__";
|
|
21
18
|
export declare const GENERATORS_DIR: string;
|
|
22
19
|
export declare const CLI_PACKAGE_JSON: string;
|
|
23
|
-
export declare const PRIMARY_COLOR = "#3a7afe";
|
|
24
|
-
export declare const SITE_MOBILE_MAIN: string;
|
|
25
|
-
export declare const SITE_PC_MAIN: string;
|
|
26
20
|
export declare const SITE: string;
|
|
27
21
|
export declare const SITE_OUTPUT_PATH: string;
|
|
28
22
|
export declare const SITE_PUBLIC_PATH: string;
|
|
23
|
+
export declare const SITE_DIR: string;
|
|
29
24
|
export declare const SITE_PC_ROUTES: string;
|
|
30
25
|
export declare const SITE_MOBILE_ROUTES: string;
|
|
31
26
|
export declare const SITE_CONFIG: string;
|
|
32
|
-
export declare const SITE_DOCS_GLOB: string;
|
|
33
|
-
export declare const SITE_EXAMPLE_GLOB: string;
|
|
34
27
|
export declare const HL_COMPONENT_NAME_RE: RegExp;
|
|
35
28
|
export declare const HL_API_RE: RegExp;
|
|
36
29
|
export declare const HL_TITLE_ATTRIBUTES_RE: RegExp;
|
|
@@ -44,4 +37,3 @@ export declare const HL_WEB_TYPES_JSON: string;
|
|
|
44
37
|
export declare const JEST_CONFIG: string;
|
|
45
38
|
export declare const JEST_MEDIA_MOCK: string;
|
|
46
39
|
export declare const JEST_STYLE_MOCK: string;
|
|
47
|
-
export declare const JEST_LIB_MOCK: string;
|
package/lib/shared/constant.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.JEST_STYLE_MOCK = exports.JEST_MEDIA_MOCK = exports.JEST_CONFIG = exports.HL_WEB_TYPES_JSON = exports.HL_ATTRIBUTES_JSON = exports.HL_TAGS_JSON = exports.HL_DIR = exports.HL_MD = exports.HL_TITLE_SLOTS_RE = exports.HL_TITLE_EVENTS_RE = exports.HL_TITLE_ATTRIBUTES_RE = exports.HL_API_RE = exports.HL_COMPONENT_NAME_RE = exports.SITE_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_DIR = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.CLI_PACKAGE_JSON = exports.GENERATORS_DIR = exports.TESTS_DIR_NAME = exports.EXAMPLE_DIR_INDEX = exports.DOCS_DIR_NAME = exports.EXAMPLE_LOCALE_DIR_NAME = exports.EXAMPLE_DIR_NAME = exports.STYLE_DIR_NAME = exports.PUBLIC_DIR_INDEXES = exports.SCRIPTS_EXTENSIONS = exports.VITE_RESOLVE_EXTENSIONS = exports.ESLINT_EXTENSIONS = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.ES_DIR = exports.SRC_DIR = exports.VARLET_CONFIG = exports.CWD = void 0;
|
|
4
4
|
var path_1 = require("path");
|
|
5
5
|
exports.CWD = process.cwd();
|
|
6
|
-
exports.POSTCSS_CONFIG = path_1.resolve(exports.CWD, 'postcss.config.js');
|
|
7
|
-
exports.TS_CONFIG = path_1.resolve(exports.CWD, 'tsconfig.json');
|
|
8
6
|
exports.VARLET_CONFIG = path_1.resolve(exports.CWD, 'varlet.config.js');
|
|
9
7
|
exports.SRC_DIR = path_1.resolve(exports.CWD, 'src');
|
|
10
8
|
exports.ES_DIR = path_1.resolve(exports.CWD, 'es');
|
|
@@ -12,7 +10,6 @@ exports.UMD_DIR = path_1.resolve(exports.CWD, 'umd');
|
|
|
12
10
|
exports.TYPES_DIR = path_1.resolve(exports.CWD, 'types');
|
|
13
11
|
exports.ROOT_DOCS_DIR = path_1.resolve(exports.CWD, 'docs');
|
|
14
12
|
exports.ESLINT_EXTENSIONS = ['.vue', '.ts', '.js', '.mjs', '.tsx', '.jsx'];
|
|
15
|
-
exports.WEBPACK_RESOLVE_EXTENSIONS = ['.js', '.jsx', '.vue', '.ts', '.tsx', '.css', '.less'];
|
|
16
13
|
exports.VITE_RESOLVE_EXTENSIONS = ['.vue', '.tsx', '.ts', '.jsx', '.js', '.less', '.css'];
|
|
17
14
|
exports.SCRIPTS_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js'];
|
|
18
15
|
exports.PUBLIC_DIR_INDEXES = ['index.vue', 'index.tsx', 'index.ts', 'index.jsx', 'index.js'];
|
|
@@ -24,18 +21,14 @@ exports.EXAMPLE_DIR_INDEX = 'index.vue';
|
|
|
24
21
|
exports.TESTS_DIR_NAME = '__tests__';
|
|
25
22
|
exports.GENERATORS_DIR = path_1.resolve(__dirname, '../../generators');
|
|
26
23
|
exports.CLI_PACKAGE_JSON = path_1.resolve(__dirname, '../../package.json');
|
|
27
|
-
exports.PRIMARY_COLOR = '#3a7afe';
|
|
28
24
|
// site
|
|
29
|
-
exports.SITE_MOBILE_MAIN = path_1.resolve(__dirname, '../../site/mobile/main.ts');
|
|
30
|
-
exports.SITE_PC_MAIN = path_1.resolve(__dirname, '../../site/pc/main.ts');
|
|
31
25
|
exports.SITE = path_1.resolve(__dirname, '../../site');
|
|
32
26
|
exports.SITE_OUTPUT_PATH = path_1.resolve(exports.CWD, 'site');
|
|
33
27
|
exports.SITE_PUBLIC_PATH = path_1.resolve(exports.CWD, 'public');
|
|
28
|
+
exports.SITE_DIR = path_1.resolve(exports.CWD, '.varlet/site');
|
|
34
29
|
exports.SITE_PC_ROUTES = path_1.resolve(exports.CWD, '.varlet/pc.routes.ts');
|
|
35
30
|
exports.SITE_MOBILE_ROUTES = path_1.resolve(exports.CWD, '.varlet/mobile.routes.ts');
|
|
36
31
|
exports.SITE_CONFIG = path_1.resolve(exports.CWD, '.varlet/site.config.json');
|
|
37
|
-
exports.SITE_DOCS_GLOB = path_1.resolve(exports.CWD, './docs/**');
|
|
38
|
-
exports.SITE_EXAMPLE_GLOB = path_1.resolve(exports.CWD, './src/**/example/**');
|
|
39
32
|
// template highlight
|
|
40
33
|
exports.HL_COMPONENT_NAME_RE = /.*(\/|\\)(.+)(\/|\\)docs(\/|\\)/;
|
|
41
34
|
exports.HL_API_RE = /##\s*API\n+/;
|
|
@@ -51,4 +44,3 @@ exports.HL_WEB_TYPES_JSON = path_1.resolve(exports.HL_DIR, 'web-types.json');
|
|
|
51
44
|
exports.JEST_CONFIG = path_1.resolve(__dirname, '../config/jest.config.js');
|
|
52
45
|
exports.JEST_MEDIA_MOCK = path_1.resolve(__dirname, '../config/jest.media.mock.js');
|
|
53
46
|
exports.JEST_STYLE_MOCK = path_1.resolve(__dirname, '../config/jest.style.mock.js');
|
|
54
|
-
exports.JEST_LIB_MOCK = path_1.resolve(__dirname, '../config/jest.lib.mock.js');
|
|
@@ -0,0 +1,12 @@
|
|
|
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._AppBarComponent = void 0;
|
|
7
|
+
var AppBar_vue_1 = __importDefault(require("./AppBar.vue"));
|
|
8
|
+
AppBar_vue_1.default.install = function (app) {
|
|
9
|
+
app.component(AppBar_vue_1.default.name, AppBar_vue_1.default);
|
|
10
|
+
};
|
|
11
|
+
exports._AppBarComponent = AppBar_vue_1.default;
|
|
12
|
+
exports.default = AppBar_vue_1.default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare function positionValidator(position: string): boolean;
|
|
2
|
+
export declare const props: {
|
|
3
|
+
color: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
};
|
|
6
|
+
textColor: {
|
|
7
|
+
type: StringConstructor;
|
|
8
|
+
};
|
|
9
|
+
title: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
};
|
|
12
|
+
titlePosition: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
validator: typeof positionValidator;
|
|
16
|
+
};
|
|
17
|
+
elevation: {
|
|
18
|
+
type: BooleanConstructor;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.props = exports.positionValidator = void 0;
|
|
4
|
+
function positionValidator(position) {
|
|
5
|
+
var validPositions = ['left', 'center', 'right'];
|
|
6
|
+
return validPositions.includes(position);
|
|
7
|
+
}
|
|
8
|
+
exports.positionValidator = positionValidator;
|
|
9
|
+
exports.props = {
|
|
10
|
+
color: {
|
|
11
|
+
type: String,
|
|
12
|
+
},
|
|
13
|
+
textColor: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
titlePosition: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'left',
|
|
22
|
+
validator: positionValidator,
|
|
23
|
+
},
|
|
24
|
+
elevation: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
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._ButtonComponent = void 0;
|
|
7
|
+
var Button_vue_1 = __importDefault(require("./Button.vue"));
|
|
8
|
+
Button_vue_1.default.install = function (app) {
|
|
9
|
+
app.component(Button_vue_1.default.name, Button_vue_1.default);
|
|
10
|
+
};
|
|
11
|
+
exports._ButtonComponent = Button_vue_1.default;
|
|
12
|
+
exports.default = Button_vue_1.default;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare function typeValidator(type: string): boolean;
|
|
3
|
+
declare function sizeValidator(size: string): boolean;
|
|
4
|
+
export declare const props: {
|
|
5
|
+
type: {
|
|
6
|
+
type: PropType<"default" | "primary" | "info" | "success" | "warning" | "danger">;
|
|
7
|
+
default: string;
|
|
8
|
+
validator: typeof typeValidator;
|
|
9
|
+
};
|
|
10
|
+
size: {
|
|
11
|
+
type: PropType<"small" | "normal" | "mini" | "large">;
|
|
12
|
+
default: string;
|
|
13
|
+
validator: typeof sizeValidator;
|
|
14
|
+
};
|
|
15
|
+
loading: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
19
|
+
round: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
block: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
text: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
outline: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
disabled: {
|
|
36
|
+
type: BooleanConstructor;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
ripple: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: boolean;
|
|
42
|
+
};
|
|
43
|
+
color: {
|
|
44
|
+
type: StringConstructor;
|
|
45
|
+
};
|
|
46
|
+
textColor: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
};
|
|
49
|
+
loadingRadius: {
|
|
50
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
51
|
+
default: number;
|
|
52
|
+
};
|
|
53
|
+
loadingType: any;
|
|
54
|
+
loadingSize: any;
|
|
55
|
+
onClick: {
|
|
56
|
+
type: PropType<(e: Event) => void>;
|
|
57
|
+
};
|
|
58
|
+
onTouchstart: {
|
|
59
|
+
type: PropType<(e: Event) => void>;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export {};
|