@varlet/cli 1.22.0-alpha.12 → 1.22.0-alpha.15

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.
@@ -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.VarletSitePlugin = exports.buildSiteEntry = exports.buildPcSiteRoutes = exports.buildMobileSiteRoutes = exports.findRootDocsPaths = exports.findComponentDocsPaths = exports.findExamplePaths = exports.getRootDocsRoutePath = exports.getComponentDocsRoutePath = exports.getExampleRoutePath = void 0;
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;
@@ -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.SITE,
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
  },
@@ -67,8 +67,8 @@ function getBuildConfig(varletConfig) {
67
67
  emptyOutDir: true,
68
68
  rollupOptions: {
69
69
  input: {
70
- main: path_1.resolve(constant_1.SITE, 'index.html'),
71
- nested: path_1.resolve(constant_1.SITE, 'mobile.html'),
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
  } });
@@ -21,11 +21,10 @@ export declare const TESTS_DIR_NAME = "__tests__";
21
21
  export declare const GENERATORS_DIR: string;
22
22
  export declare const CLI_PACKAGE_JSON: string;
23
23
  export declare const PRIMARY_COLOR = "#3a7afe";
24
- export declare const SITE_MOBILE_MAIN: string;
25
- export declare const SITE_PC_MAIN: string;
26
24
  export declare const SITE: string;
27
25
  export declare const SITE_OUTPUT_PATH: string;
28
26
  export declare const SITE_PUBLIC_PATH: string;
27
+ export declare const SITE_DIR: string;
29
28
  export declare const SITE_PC_ROUTES: string;
30
29
  export declare const SITE_MOBILE_ROUTES: string;
31
30
  export declare const SITE_CONFIG: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JEST_LIB_MOCK = 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_EXAMPLE_GLOB = exports.SITE_DOCS_GLOB = exports.SITE_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.SITE_PC_MAIN = exports.SITE_MOBILE_MAIN = exports.PRIMARY_COLOR = 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.WEBPACK_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.TS_CONFIG = exports.POSTCSS_CONFIG = exports.CWD = void 0;
3
+ exports.JEST_LIB_MOCK = 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_EXAMPLE_GLOB = exports.SITE_DOCS_GLOB = 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.PRIMARY_COLOR = 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.WEBPACK_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.TS_CONFIG = exports.POSTCSS_CONFIG = exports.CWD = void 0;
4
4
  var path_1 = require("path");
5
5
  exports.CWD = process.cwd();
6
6
  exports.POSTCSS_CONFIG = path_1.resolve(exports.CWD, 'postcss.config.js');
@@ -26,11 +26,10 @@ exports.GENERATORS_DIR = path_1.resolve(__dirname, '../../generators');
26
26
  exports.CLI_PACKAGE_JSON = path_1.resolve(__dirname, '../../package.json');
27
27
  exports.PRIMARY_COLOR = '#3a7afe';
28
28
  // 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
29
  exports.SITE = path_1.resolve(__dirname, '../../site');
32
30
  exports.SITE_OUTPUT_PATH = path_1.resolve(exports.CWD, 'site');
33
31
  exports.SITE_PUBLIC_PATH = path_1.resolve(exports.CWD, 'public');
32
+ exports.SITE_DIR = path_1.resolve(exports.CWD, '.varlet/site');
34
33
  exports.SITE_PC_ROUTES = path_1.resolve(exports.CWD, '.varlet/pc.routes.ts');
35
34
  exports.SITE_MOBILE_ROUTES = path_1.resolve(exports.CWD, '.varlet/mobile.routes.ts');
36
35
  exports.SITE_CONFIG = path_1.resolve(exports.CWD, '.varlet/site.config.json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "1.22.0-alpha.12+aff33e6b",
3
+ "version": "1.22.0-alpha.15+97121f37",
4
4
  "description": "cli of varlet",
5
5
  "bin": {
6
6
  "varlet-cli": "./lib/index.js"
@@ -31,7 +31,7 @@
31
31
  "dev": "tsc --watch",
32
32
  "build": "tsc"
33
33
  },
34
- "gitHead": "aff33e6be8fd4a9a6bb4aaada4e46ae6aeea2ea5",
34
+ "gitHead": "97121f377fea975b88d2affc156f01d3c7dc43c1",
35
35
  "dependencies": {
36
36
  "@babel/core": "^7.14.8",
37
37
  "@babel/preset-env": "^7.14.8",
@@ -44,7 +44,7 @@
44
44
  "@varlet/markdown-vite-plugin": "^1.20.0",
45
45
  "@varlet/stylelint-config": "^1.9.0",
46
46
  "@varlet/touch-emulator": "^1.0.1",
47
- "@varlet/ui": "^1.22.0-alpha.12+aff33e6b",
47
+ "@varlet/ui": "^1.22.0-alpha.15+97121f37",
48
48
  "@vitejs/plugin-vue": "1.9.2",
49
49
  "@vitejs/plugin-vue-jsx": "1.1.8",
50
50
  "@vue/babel-plugin-jsx": "^1.0.7",