@varlet/cli 2.7.2 → 2.7.3-alpha.1675176726761

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.md CHANGED
@@ -1,4 +1,4 @@
1
- # Components Library Tools(@varlet/cli)
1
+ # Components Library Tools
2
2
 
3
3
  ### Intro
4
4
 
@@ -13,6 +13,8 @@ The out-of-the-box `Vue3 component library` rapid prototyping tool provides a se
13
13
  - 📦  Out-of-the-box code inspection tool
14
14
  - 📦  Out-of-the-box unit testing tools
15
15
  - 📦  Out-of-the-box code publishing tool, publishes to both `npm` and `github`, and automatically generates changelogs
16
+ - 💪  Support for `VSCode` extension development
17
+ - 💪  Support `build svg to web fonts`
16
18
  - 💪  Support for `Typescript`
17
19
  - 💪  Support `Dark Mode`
18
20
  - 🌍  Support `Internationalization`
@@ -53,7 +55,8 @@ Also refer to `@varlet/ui` [varlet.config.mjs](https://github.com/varletjs/varle
53
55
  | `analysis` | Document statistics related | _{ baidu: string }_ | `-` |
54
56
  | `pc` | PC-side document structure configuration | _Record<string, any>_ | `-` |
55
57
  | `mobile` | Mobile side document structure configuration | _Record<string, any>_ | `-` |
56
- | `copy` | Copy file options | _{ from: string, to: string, type: 'folder' | 'file' }[]_ | `-` |
58
+ | `copy` | Copy file options | _[CopyPath[]](https://github.com/varletjs/varlet/blob/dev/packages/varlet-vite-plugins/src/copy.ts)_ | `-` |
59
+ | `icons` | Font icon packaging related configuration | _[VarletConfigIcons](https://github.com/varletjs/varlet/blob/dev/packages/varlet-cli/src/node/config/varlet.config.ts)_ | `-` |
57
60
 
58
61
  ### Custom pages
59
62
 
@@ -120,6 +123,27 @@ varlet-cli preview
120
123
  varlet-cli compile
121
124
  ```
122
125
 
126
+ #### Run VSCode extension development environment
127
+
128
+ ```shell
129
+ # playground-ignore
130
+ varlet-cli dev:extension
131
+ ```
132
+
133
+ #### Build VSCode extension for production
134
+
135
+ ```shell
136
+ # playground-ignore
137
+ varlet-cli build:extension
138
+ ```
139
+
140
+ #### Build svg to web fonts
141
+
142
+ ```shell
143
+ # playground-ignore
144
+ varlet-cli build:icons
145
+ ```
146
+
123
147
  #### Execute all unit tests
124
148
 
125
149
  ```shell
package/README.zh-CN.md CHANGED
@@ -1,4 +1,4 @@
1
- # 组件库快速成型工具(@varlet/cli)
1
+ # 组件库快速成型工具
2
2
 
3
3
  ### 介绍
4
4
 
@@ -13,6 +13,8 @@
13
13
  - 📦 &nbsp;开箱即用的代码检查工具
14
14
  - 📦 &nbsp;开箱即用的单元测试工具
15
15
  - 📦 &nbsp;开箱即用的代码发布工具,同时发布到 `npm` 和 `github`, 并自动生成更新日志
16
+ - 💪 &nbsp;支持 `VSCode` 插件开发
17
+ - 💪 &nbsp;支持 `字体图标打包`
16
18
  - 💪 &nbsp;支持 `Typescript`
17
19
  - 💪 &nbsp;支持 `暗黑模式`
18
20
  - 🌍 &nbsp;支持 `国际化`
@@ -53,7 +55,8 @@ varlet-cli gen
53
55
  | `analysis` | 文档统计相关 | _{ baidu: string }_ | `-` |
54
56
  | `pc` | pc 端文档结构配置 | _Record<string, any>_ | `-` |
55
57
  | `mobile` | mobile 端文档结构配置 | _Record<string, any>_ | `-` |
56
- | `copy` | 复制文件配置 | _{ from: string, to: string, type: 'folder' | 'file' }[]_ | `-` |
58
+ | `copy` | 复制文件配置 | _[CopyPath[]](https://github.com/varletjs/varlet/blob/dev/packages/varlet-vite-plugins/src/copy.ts)_ | `-` |
59
+ | `icons` | 字体图标打包相关配置 | _[VarletConfigIcons](https://github.com/varletjs/varlet/blob/dev/packages/varlet-cli/src/node/config/varlet.config.ts)_ | `-` |
57
60
 
58
61
  ### 自定义页面
59
62
 
@@ -119,6 +122,27 @@ varlet-cli preview
119
122
  varlet-cli compile
120
123
  ```
121
124
 
125
+ #### 启动 VSCode 插件开发环境
126
+
127
+ ```shell
128
+ # playground-ignore
129
+ varlet-cli dev:extension
130
+ ```
131
+
132
+ #### 构建 VSCode 插件
133
+
134
+ ```shell
135
+ # playground-ignore
136
+ varlet-cli build:extension
137
+ ```
138
+
139
+ #### 打包字体图标
140
+
141
+ ```shell
142
+ # playground-ignore
143
+ varlet-cli build:icons
144
+ ```
145
+
122
146
  #### 执行所有的单元测试
123
147
 
124
148
  ```shell
package/lib/node/bin.js CHANGED
@@ -18,6 +18,13 @@ program
18
18
  const { build } = await import('./commands/build.js');
19
19
  return build();
20
20
  });
21
+ program
22
+ .command('dev:vite')
23
+ .description('Use vite start server for development')
24
+ .action(async () => {
25
+ const { vite } = await import('./commands/vite.js');
26
+ return vite('dev');
27
+ });
21
28
  program
22
29
  .command('build:vite')
23
30
  .description('Use vite build app for production')
@@ -26,11 +33,25 @@ program
26
33
  return vite('build');
27
34
  });
28
35
  program
29
- .command('dev:vite')
30
- .description('Use vite start server for development')
36
+ .command('dev:extension')
37
+ .description('Run VSCode extension development environment')
31
38
  .action(async () => {
32
- const { vite } = await import('./commands/vite.js');
33
- return vite('dev');
39
+ const { extension } = await import('./commands/extension.js');
40
+ return extension('dev');
41
+ });
42
+ program
43
+ .command('build:extension')
44
+ .description('Build VSCode extension for production')
45
+ .action(async () => {
46
+ const { extension } = await import('./commands/extension.js');
47
+ return extension('build');
48
+ });
49
+ program
50
+ .command('build:icons')
51
+ .description('Build icons')
52
+ .action(async () => {
53
+ const { icons } = await import('./commands/icons.js');
54
+ return icons();
34
55
  });
35
56
  program
36
57
  .command('preview')
@@ -1,6 +1,5 @@
1
- interface ChangelogCommandOptions {
1
+ export interface ChangelogCommandOptions {
2
2
  file?: string;
3
3
  releaseCount?: number;
4
4
  }
5
5
  export declare function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>;
6
- export {};
@@ -1,8 +1,7 @@
1
- interface CreateCommandOptions {
1
+ export interface CreateCommandOptions {
2
2
  name?: string;
3
3
  locale?: boolean;
4
4
  sfc?: boolean;
5
5
  tsx?: boolean;
6
6
  }
7
7
  export declare function create(options: CreateCommandOptions): Promise<void>;
8
- export {};
@@ -0,0 +1,3 @@
1
+ import { type ExtensionMode } from '../config/vite.config.js';
2
+ export declare type ExtensionCommandMode = ExtensionMode;
3
+ export declare function extension(mode: ExtensionCommandMode): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { build } from 'vite';
2
+ import { getExtensionConfig } from '../config/vite.config.js';
3
+ export async function extension(mode) {
4
+ await build(getExtensionConfig(mode));
5
+ }
@@ -1,8 +1,7 @@
1
- interface GenCommandOptions {
1
+ export interface GenCommandOptions {
2
2
  name?: string;
3
3
  i18n?: boolean;
4
4
  sfc?: boolean;
5
5
  tsx?: boolean;
6
6
  }
7
7
  export declare function gen(options: GenCommandOptions): Promise<void>;
8
- export {};
@@ -0,0 +1 @@
1
+ export declare function icons(): Promise<void>;
@@ -0,0 +1,105 @@
1
+ import fse from 'fs-extra';
2
+ import sharp from 'sharp';
3
+ import webfont from 'webfont';
4
+ import logger from '../shared/logger.js';
5
+ import { parse, resolve } from 'path';
6
+ import { ICONS_DIST_DIR, ICONS_CSS_DIR, ICONS_PNG_DIR, ICONS_FONTS_DIR, ICONS_SVG_DIR } from '../shared/constant.js';
7
+ import { getVarletConfig } from '../config/varlet.config.js';
8
+ import { get } from 'lodash-es';
9
+ const { removeSync, ensureDir, writeFile, readdirSync } = fse;
10
+ async function removeDir() {
11
+ removeSync(ICONS_DIST_DIR);
12
+ await Promise.all([ensureDir(ICONS_FONTS_DIR), ensureDir(ICONS_CSS_DIR), ensureDir(ICONS_PNG_DIR)]);
13
+ }
14
+ async function buildPNG(svgFiles) {
15
+ await Promise.all(svgFiles.map((svg) => {
16
+ return new Promise((done) => {
17
+ const { name } = parse(svg);
18
+ sharp(resolve(ICONS_SVG_DIR, svg))
19
+ .resize({ height: 100 })
20
+ .toBuffer()
21
+ .then((buffer) => {
22
+ sharp({
23
+ create: {
24
+ width: 100,
25
+ height: 100,
26
+ channels: 4,
27
+ background: '#4a7afe',
28
+ },
29
+ })
30
+ .composite([
31
+ {
32
+ input: buffer,
33
+ blend: 'dest-in',
34
+ },
35
+ ])
36
+ .png()
37
+ .toFile(resolve(ICONS_PNG_DIR, `${name}.png`))
38
+ .then(() => {
39
+ done();
40
+ });
41
+ });
42
+ });
43
+ }));
44
+ }
45
+ function buildWebFont(name) {
46
+ return webfont.default({
47
+ files: `${ICONS_SVG_DIR}/*.svg`,
48
+ fontName: name,
49
+ formats: ['ttf'],
50
+ fontHeight: 512,
51
+ descent: 64,
52
+ });
53
+ }
54
+ export async function icons() {
55
+ const varletConfig = await getVarletConfig();
56
+ const { name, namespace, base64, publicPath, fontFamilyClassName, fontWeight, fontStyle } = get(varletConfig, 'icons');
57
+ await removeDir();
58
+ const svgFiles = readdirSync(ICONS_SVG_DIR);
59
+ const [{ ttf }] = await Promise.all([buildWebFont(name), buildPNG(svgFiles)]);
60
+ const icons = svgFiles.map((svgName) => {
61
+ const i = svgName.indexOf('-');
62
+ const extIndex = svgName.lastIndexOf('.');
63
+ return {
64
+ name: svgName.slice(i + 1, extIndex),
65
+ pointCode: svgName.slice(1, i),
66
+ };
67
+ });
68
+ const iconNames = icons.map((iconName) => ` '${iconName.name}'`);
69
+ const indexTemplate = `\
70
+ export const pointCodes = {
71
+ ${icons.map(({ pointCode, name }) => `'${name}': '${pointCode}'`).join(',\n ')}
72
+ }
73
+
74
+ export default [
75
+ ${iconNames.join(',\n')}
76
+ ]
77
+ `;
78
+ const cssTemplate = `\
79
+ @font-face {
80
+ font-family: "${name}";
81
+ src: url("${base64 ? `data:font/truetype;charset=utf-8;base64,${ttf.toString('base64')}` : `${publicPath}${name}-webfont.ttf`}") format("truetype");
82
+ font-weight: ${fontWeight};
83
+ font-style: ${fontStyle};
84
+ }
85
+
86
+ .${fontFamilyClassName} {
87
+ font-family: "${name}";
88
+ }
89
+
90
+ ${icons
91
+ .map((icon) => {
92
+ return `.${namespace}-${icon.name}::before {
93
+ content: "\\${icon.pointCode}";
94
+ }`;
95
+ })
96
+ .join('\n\n')}
97
+ `;
98
+ await Promise.all([
99
+ writeFile(resolve(ICONS_FONTS_DIR, `${name}-webfont.ttf`), ttf),
100
+ writeFile(resolve(ICONS_CSS_DIR, `${name}.css`), cssTemplate),
101
+ writeFile(resolve(ICONS_CSS_DIR, `${name}.less`), cssTemplate),
102
+ writeFile(resolve(ICONS_DIST_DIR, 'index.js'), indexTemplate),
103
+ ]);
104
+ logger.success('build success!');
105
+ }
@@ -1,8 +1,7 @@
1
- interface JestCommandOptions {
1
+ export interface JestCommandOptions {
2
2
  watch?: boolean;
3
3
  watchAll?: boolean;
4
4
  component?: string;
5
5
  clearCache?: boolean;
6
6
  }
7
7
  export declare function jest(cmd: JestCommandOptions): Promise<void>;
8
- export {};
@@ -1,6 +1,5 @@
1
- interface ReleaseCommandOptions {
1
+ export interface ReleaseCommandOptions {
2
2
  remote?: string;
3
3
  task?(): Promise<void>;
4
4
  }
5
5
  export declare function release(options: ReleaseCommandOptions): Promise<void>;
6
- export {};
@@ -1,3 +1,2 @@
1
- declare type ViteCommandMode = 'dev' | 'build';
1
+ export declare type ViteCommandMode = 'dev' | 'build';
2
2
  export declare function vite(mode: ViteCommandMode): Promise<void>;
3
- export {};
@@ -1,4 +1,25 @@
1
1
  import { type CopyOptions } from '@varlet/vite-plugins';
2
+ export interface VarletConfigIcons {
3
+ /**
4
+ * @default `varlet-icons`
5
+ * Font name.
6
+ */
7
+ name?: string;
8
+ /**
9
+ * @default `var-icon`
10
+ * Font name prefix.
11
+ */
12
+ namespace?: string;
13
+ /**
14
+ * @default `true`
15
+ * Output base64
16
+ */
17
+ base64?: boolean;
18
+ publicPath?: string;
19
+ fontFamilyClassName?: string;
20
+ fontWeight?: string;
21
+ fontStyle?: string;
22
+ }
2
23
  export interface VarletConfig {
3
24
  /**
4
25
  * @default `Varlet`
@@ -40,6 +61,7 @@ export interface VarletConfig {
40
61
  pc?: Record<string, any>;
41
62
  mobile?: Record<string, any>;
42
63
  copy?: CopyOptions['paths'];
64
+ icons?: VarletConfigIcons;
43
65
  }
44
66
  export declare function defineConfig(config: VarletConfig): VarletConfig;
45
67
  export declare function mergeStrategy(value: any, srcValue: any, key: string): any[] | undefined;
@@ -259,4 +259,12 @@ export default defineConfig({
259
259
  'color-hl-group-h': '#14a6e9',
260
260
  'color-hl-group-i': '#ed4648',
261
261
  },
262
+ icons: {
263
+ name: 'varlet-icons',
264
+ namespace: 'var-icon',
265
+ fontStyle: 'normal',
266
+ fontWeight: 'normal',
267
+ fontFamilyClassName: 'var-icon--set',
268
+ base64: true,
269
+ },
262
270
  });
@@ -9,3 +9,5 @@ export interface BundleBuildOptions {
9
9
  emptyOutDir: boolean;
10
10
  }
11
11
  export declare function getBundleConfig(varletConfig: Required<VarletConfig>, buildOptions: BundleBuildOptions): InlineConfig;
12
+ export declare type ExtensionMode = 'dev' | 'build';
13
+ export declare function getExtensionConfig(mode: ExtensionMode): InlineConfig;
@@ -1,7 +1,7 @@
1
1
  import vue from '@vitejs/plugin-vue';
2
2
  import jsx from '@vitejs/plugin-vue-jsx';
3
3
  import { markdown, html, inlineCss, copy } from '@varlet/vite-plugins';
4
- import { ES_DIR, SITE_CONFIG, SITE_DIR, SITE_MOBILE_ROUTES, SITE_OUTPUT_PATH, SITE_PC_ROUTES, SITE_PUBLIC_PATH, VITE_RESOLVE_EXTENSIONS, } from '../shared/constant.js';
4
+ import { ES_DIR, SITE_CONFIG, SITE_DIR, SITE_MOBILE_ROUTES, SITE_OUTPUT_PATH, SITE_PC_ROUTES, SITE_PUBLIC_PATH, VITE_RESOLVE_EXTENSIONS, EXTENSION_ENTRY, } from '../shared/constant.js';
5
5
  import { get } from 'lodash-es';
6
6
  import { resolve } from 'path';
7
7
  export function getDevConfig(varletConfig) {
@@ -90,3 +90,19 @@ export function getBundleConfig(varletConfig, buildOptions) {
90
90
  },
91
91
  };
92
92
  }
93
+ export function getExtensionConfig(mode) {
94
+ return {
95
+ build: {
96
+ sourcemap: mode === 'dev' ? 'inline' : false,
97
+ watch: mode === 'dev' ? {} : null,
98
+ lib: {
99
+ entry: EXTENSION_ENTRY,
100
+ fileName: 'extension',
101
+ formats: ['cjs'],
102
+ },
103
+ rollupOptions: {
104
+ external: ['vscode'],
105
+ },
106
+ },
107
+ };
108
+ }
@@ -11,3 +11,4 @@ export * from './commands/lint.js';
11
11
  export * from './commands/changelog.js';
12
12
  export * from './commands/preview.js';
13
13
  export * from './commands/vite.js';
14
+ export * from './commands/extension.js';
package/lib/node/index.js CHANGED
@@ -11,3 +11,4 @@ export * from './commands/lint.js';
11
11
  export * from './commands/changelog.js';
12
12
  export * from './commands/preview.js';
13
13
  export * from './commands/vite.js';
14
+ export * from './commands/extension.js';
@@ -39,4 +39,10 @@ export declare const HL_DIR: string;
39
39
  export declare const HL_TAGS_JSON: string;
40
40
  export declare const HL_ATTRIBUTES_JSON: string;
41
41
  export declare const HL_WEB_TYPES_JSON: string;
42
+ export declare const ICONS_DIST_DIR: string;
43
+ export declare const ICONS_CSS_DIR: string;
44
+ export declare const ICONS_PNG_DIR: string;
45
+ export declare const ICONS_FONTS_DIR: string;
46
+ export declare const ICONS_SVG_DIR: string;
47
+ export declare const EXTENSION_ENTRY: string;
42
48
  export declare const JEST_CONFIG: string;
@@ -43,5 +43,13 @@ export const HL_DIR = resolve(CWD, 'highlight');
43
43
  export const HL_TAGS_JSON = resolve(HL_DIR, 'tags.json');
44
44
  export const HL_ATTRIBUTES_JSON = resolve(HL_DIR, 'attributes.json');
45
45
  export const HL_WEB_TYPES_JSON = resolve(HL_DIR, 'web-types.json');
46
+ // icons
47
+ export const ICONS_DIST_DIR = resolve(CWD, 'dist');
48
+ export const ICONS_CSS_DIR = resolve(ICONS_DIST_DIR, 'css');
49
+ export const ICONS_PNG_DIR = resolve(ICONS_DIST_DIR, 'png');
50
+ export const ICONS_FONTS_DIR = resolve(ICONS_DIST_DIR, 'fonts');
51
+ export const ICONS_SVG_DIR = resolve(CWD, 'svg');
52
+ // extension
53
+ export const EXTENSION_ENTRY = resolve(CWD, 'src/extension.ts');
46
54
  // jest
47
55
  export const JEST_CONFIG = resolve(dirname, '../../../cjs/jest.config.cjs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "2.7.2",
3
+ "version": "2.7.3-alpha.1675176726761",
4
4
  "type": "module",
5
5
  "description": "cli of varlet",
6
6
  "bin": {
@@ -44,6 +44,8 @@
44
44
  "@vue/babel-plugin-jsx": "1.1.1",
45
45
  "@vue/compiler-sfc": "3.2.25",
46
46
  "@vue/runtime-core": "3.2.25",
47
+ "webfont": "^9.0.0",
48
+ "sharp": "0.31.3",
47
49
  "babel-jest": "26.6.3",
48
50
  "chalk": "^4.1.0",
49
51
  "chokidar": "^3.5.2",
@@ -66,8 +68,8 @@
66
68
  "vite": "4.0.4",
67
69
  "vue": "3.2.25",
68
70
  "vue-jest": "^5.0.0-alpha.8",
69
- "@varlet/vite-plugins": "2.7.2",
70
- "@varlet/shared": "2.7.2"
71
+ "@varlet/vite-plugins": "2.7.3-alpha.1675176726761",
72
+ "@varlet/shared": "2.7.3-alpha.1675176726761"
71
73
  },
72
74
  "devDependencies": {
73
75
  "@types/babel__core": "^7.1.12",
@@ -79,8 +81,9 @@
79
81
  "@types/node": "^18.7.20",
80
82
  "@types/semver": "^7.3.9",
81
83
  "@types/inquirer": "^9.0.2",
82
- "@varlet/touch-emulator": "2.7.2",
83
- "@varlet/icons": "2.7.2"
84
+ "@types/sharp": "0.31.1",
85
+ "@varlet/icons": "2.7.3-alpha.1675176726761",
86
+ "@varlet/touch-emulator": "2.7.3-alpha.1675176726761"
84
87
  },
85
88
  "peerDependencies": {
86
89
  "@vue/runtime-core": "3.2.16",
@@ -90,8 +93,8 @@
90
93
  "lodash-es": "^4.17.21",
91
94
  "vue": "3.2.25",
92
95
  "vue-router": "4.0.12",
93
- "@varlet/icons": "2.7.2",
94
- "@varlet/touch-emulator": "2.7.2"
96
+ "@varlet/icons": "2.7.3-alpha.1675176726761",
97
+ "@varlet/touch-emulator": "2.7.3-alpha.1675176726761"
95
98
  },
96
99
  "scripts": {
97
100
  "dev": "tsc --watch",
@@ -1,44 +0,0 @@
1
- export interface VarletConfig {
2
- /**
3
- * @default `Varlet`
4
- * UI library name.
5
- */
6
- name?: string;
7
- /**
8
- * @default `var`
9
- * Component name prefix
10
- */
11
- namespace?: string;
12
- /**
13
- * @default `localhost`
14
- * Local dev server host
15
- */
16
- host?: string;
17
- /**
18
- * @default `8080`
19
- * Local dev server port
20
- */
21
- port?: number;
22
- title?: string;
23
- logo?: string;
24
- themeKey?: string;
25
- defaultLanguage?: 'zh-CN' | 'en-US';
26
- /**
27
- * @default `false`
28
- * Show mobile component on the right.
29
- */
30
- useMobile?: boolean;
31
- lightTheme?: Record<string, string>;
32
- darkTheme?: Record<string, string>;
33
- highlight?: {
34
- style: string;
35
- };
36
- analysis?: {
37
- baidu: string;
38
- };
39
- pc?: Record<string, any>;
40
- mobile?: Record<string, any>;
41
- }
42
- export declare function defineConfig(config: VarletConfig): VarletConfig;
43
- export declare function mergeStrategy(value: any, srcValue: any, key: string): any[] | undefined;
44
- export declare function getVarletConfig(emit?: boolean): Promise<Required<VarletConfig>>;
@@ -1,27 +0,0 @@
1
- import fse from 'fs-extra';
2
- import { mergeWith } from 'lodash-es';
3
- import { VARLET_CONFIG, SITE_CONFIG } from '../shared/constant.js';
4
- import { outputFileSyncOnChange } from '../shared/fsUtils.js';
5
- import { isArray } from '@varlet/shared';
6
- import { pathToFileURL } from 'url';
7
- const { pathExistsSync, statSync } = fse;
8
- export function defineConfig(config) {
9
- return config;
10
- }
11
- export function mergeStrategy(value, srcValue, key) {
12
- if (key === 'features' && isArray(srcValue)) {
13
- return srcValue;
14
- }
15
- }
16
- export async function getVarletConfig(emit = false) {
17
- const defaultConfig = (await import('./varlet.default.config.js')).default;
18
- const config = pathExistsSync(VARLET_CONFIG)
19
- ? (await import(`${pathToFileURL(VARLET_CONFIG).href}?_t=${statSync(VARLET_CONFIG).mtimeMs}`)).default
20
- : {};
21
- const mergedConfig = mergeWith(defaultConfig, config, mergeStrategy);
22
- if (emit) {
23
- const source = JSON.stringify(mergedConfig, null, 2);
24
- outputFileSyncOnChange(SITE_CONFIG, source);
25
- }
26
- return mergedConfig;
27
- }
@@ -1,9 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export interface CopyPath {
3
- from: string;
4
- to: string;
5
- }
6
- export interface CopyOptions {
7
- paths: CopyPath[];
8
- }
9
- export declare function copy(options: CopyOptions): Plugin;
@@ -1,17 +0,0 @@
1
- import fse from 'fs-extra';
2
- const { copyFileSync } = fse;
3
- export function copy(options) {
4
- return {
5
- name: 'vite-plugin-varlet-copy',
6
- buildStart() {
7
- options.paths.forEach((copyPath) => {
8
- try {
9
- copyFileSync(copyPath.from, copyPath.to);
10
- }
11
- catch (e) {
12
- this.warn(e);
13
- }
14
- });
15
- }
16
- };
17
- }