@varlet/cli 2.10.0 → 2.10.1-alpha.1682608027166

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.
Files changed (65) hide show
  1. package/lib/client/appType.d.ts +4 -4
  2. package/lib/client/appType.js +7 -7
  3. package/lib/client/index.d.ts +18 -18
  4. package/lib/client/index.js +109 -109
  5. package/lib/node/bin.d.ts +2 -2
  6. package/lib/node/bin.js +148 -148
  7. package/lib/node/commands/build.d.ts +1 -1
  8. package/lib/node/commands/build.js +15 -15
  9. package/lib/node/commands/changelog.d.ts +5 -5
  10. package/lib/node/commands/changelog.js +20 -20
  11. package/lib/node/commands/checklist.d.ts +6 -6
  12. package/lib/node/commands/checklist.js +64 -64
  13. package/lib/node/commands/commitLint.d.ts +4 -4
  14. package/lib/node/commands/commitLint.js +19 -19
  15. package/lib/node/commands/compile.d.ts +3 -3
  16. package/lib/node/commands/compile.js +31 -31
  17. package/lib/node/commands/create.d.ts +7 -7
  18. package/lib/node/commands/create.js +91 -91
  19. package/lib/node/commands/dev.d.ts +6 -6
  20. package/lib/node/commands/dev.js +42 -42
  21. package/lib/node/commands/extension.d.ts +3 -3
  22. package/lib/node/commands/extension.js +5 -5
  23. package/lib/node/commands/gen.d.ts +7 -7
  24. package/lib/node/commands/gen.js +68 -68
  25. package/lib/node/commands/icons.d.ts +1 -1
  26. package/lib/node/commands/icons.js +82 -82
  27. package/lib/node/commands/jest.d.ts +7 -7
  28. package/lib/node/commands/jest.js +27 -27
  29. package/lib/node/commands/lint.d.ts +1 -1
  30. package/lib/node/commands/lint.js +42 -42
  31. package/lib/node/commands/preview.d.ts +1 -1
  32. package/lib/node/commands/preview.js +18 -18
  33. package/lib/node/commands/release.d.ts +5 -5
  34. package/lib/node/commands/release.js +150 -150
  35. package/lib/node/commands/vite.d.ts +2 -2
  36. package/lib/node/commands/vite.js +14 -14
  37. package/lib/node/compiler/compileModule.d.ts +4 -4
  38. package/lib/node/compiler/compileModule.js +71 -71
  39. package/lib/node/compiler/compileSFC.d.ts +6 -6
  40. package/lib/node/compiler/compileSFC.js +97 -96
  41. package/lib/node/compiler/compileScript.d.ts +13 -13
  42. package/lib/node/compiler/compileScript.js +126 -126
  43. package/lib/node/compiler/compileSiteEntry.d.ts +18 -18
  44. package/lib/node/compiler/compileSiteEntry.js +121 -121
  45. package/lib/node/compiler/compileStyle.d.ts +10 -10
  46. package/lib/node/compiler/compileStyle.js +41 -41
  47. package/lib/node/compiler/compileTemplateHighlight.d.ts +18 -18
  48. package/lib/node/compiler/compileTemplateHighlight.js +128 -128
  49. package/lib/node/compiler/compileTypes.d.ts +2 -2
  50. package/lib/node/compiler/compileTypes.js +40 -40
  51. package/lib/node/config/varlet.config.d.ts +73 -73
  52. package/lib/node/config/varlet.config.js +27 -27
  53. package/lib/node/config/varlet.default.config.d.ts +2 -2
  54. package/lib/node/config/varlet.default.config.js +271 -271
  55. package/lib/node/config/vite.config.d.ts +13 -13
  56. package/lib/node/config/vite.config.js +115 -115
  57. package/lib/node/index.d.ts +15 -15
  58. package/lib/node/index.js +15 -15
  59. package/lib/node/shared/constant.d.ts +51 -51
  60. package/lib/node/shared/constant.js +58 -58
  61. package/lib/node/shared/fsUtils.d.ts +15 -15
  62. package/lib/node/shared/fsUtils.js +54 -54
  63. package/lib/node/shared/logger.d.ts +8 -8
  64. package/lib/node/shared/logger.js +18 -18
  65. package/package.json +7 -7
@@ -1,76 +1,76 @@
1
- import logger from '../shared/logger.js';
2
- import fse from 'fs-extra';
3
- import inquirer from 'inquirer';
4
- import { resolve } from 'path';
5
- import { CLI_PACKAGE_JSON, CWD, GENERATORS_DIR } from '../shared/constant.js';
6
- const { copy, pathExistsSync, readFileSync, writeFileSync, rename } = fse;
7
- const { prompt } = inquirer;
8
- function syncVersion(name) {
9
- const file = resolve(CWD, name, 'package.json');
10
- const pkg = JSON.parse(readFileSync(file, 'utf-8'));
11
- const cliPkg = JSON.parse(readFileSync(CLI_PACKAGE_JSON, 'utf-8'));
12
- Object.keys(pkg.devDependencies).forEach((key) => {
13
- if (key.startsWith('@varlet')) {
14
- pkg.devDependencies[key] = `^${cliPkg.version}`;
15
- }
16
- });
17
- pkg.files = ['es', 'lib', 'umd', 'highlight', 'types'];
18
- writeFileSync(file, JSON.stringify(pkg, null, 2));
19
- }
20
- export async function gen(options) {
21
- logger.title('\nšŸ“¦šŸ“¦ Generate cli application ! \n');
22
- const { name } = options.name
23
- ? options
24
- : await prompt({
25
- name: 'name',
26
- message: 'Name of the generate application: ',
27
- default: 'varlet-cli-app',
28
- });
29
- const dest = resolve(CWD, name);
30
- if (pathExistsSync(dest)) {
31
- logger.error(`${name} already exists and cannot be recreated...`);
32
- return;
33
- }
34
- let codeStyle;
35
- // Determine whether the parameter carries a coding style
36
- if (options.sfc || options.tsx) {
37
- codeStyle = options.sfc ? 'sfc' : 'tsx';
38
- }
39
- else {
40
- const { style } = await prompt({
41
- name: 'style',
42
- type: 'list',
43
- message: 'Please select your component library programming format',
44
- choices: ['sfc', 'tsx'],
45
- });
46
- codeStyle = style;
47
- }
48
- const { i18n } = options.i18n
49
- ? options
50
- : await prompt({
51
- name: 'i18n',
52
- type: 'confirm',
53
- message: 'Whether to use i18n?',
54
- default: false,
55
- });
56
- const dirName = i18n ? 'i18n' : 'default';
57
- const base = resolve(GENERATORS_DIR, 'base');
58
- const configBase = resolve(GENERATORS_DIR, 'config', dirName, 'base');
59
- const code = resolve(GENERATORS_DIR, 'config', dirName, codeStyle);
60
- await copy(base, dest);
61
- await copy(configBase, dest);
62
- await copy(code, dest);
63
- await rename(resolve(dest, '_gitignore'), resolve(dest, '.gitignore'));
64
- syncVersion(name);
65
- logger.success('✨ Application generated successfully!');
1
+ import logger from '../shared/logger.js';
2
+ import fse from 'fs-extra';
3
+ import inquirer from 'inquirer';
4
+ import { resolve } from 'path';
5
+ import { CLI_PACKAGE_JSON, CWD, GENERATORS_DIR } from '../shared/constant.js';
6
+ const { copy, pathExistsSync, readFileSync, writeFileSync, rename } = fse;
7
+ const { prompt } = inquirer;
8
+ function syncVersion(name) {
9
+ const file = resolve(CWD, name, 'package.json');
10
+ const pkg = JSON.parse(readFileSync(file, 'utf-8'));
11
+ const cliPkg = JSON.parse(readFileSync(CLI_PACKAGE_JSON, 'utf-8'));
12
+ Object.keys(pkg.devDependencies).forEach((key) => {
13
+ if (key.startsWith('@varlet')) {
14
+ pkg.devDependencies[key] = `^${cliPkg.version}`;
15
+ }
16
+ });
17
+ pkg.files = ['es', 'lib', 'umd', 'highlight', 'types'];
18
+ writeFileSync(file, JSON.stringify(pkg, null, 2));
19
+ }
20
+ export async function gen(options) {
21
+ logger.title('\nšŸ“¦šŸ“¦ Generate cli application ! \n');
22
+ const { name } = options.name
23
+ ? options
24
+ : await prompt({
25
+ name: 'name',
26
+ message: 'Name of the generate application: ',
27
+ default: 'varlet-cli-app',
28
+ });
29
+ const dest = resolve(CWD, name);
30
+ if (pathExistsSync(dest)) {
31
+ logger.error(`${name} already exists and cannot be recreated...`);
32
+ return;
33
+ }
34
+ let codeStyle;
35
+ // Determine whether the parameter carries a coding style
36
+ if (options.sfc || options.tsx) {
37
+ codeStyle = options.sfc ? 'sfc' : 'tsx';
38
+ }
39
+ else {
40
+ const { style } = await prompt({
41
+ name: 'style',
42
+ type: 'list',
43
+ message: 'Please select your component library programming format',
44
+ choices: ['sfc', 'tsx'],
45
+ });
46
+ codeStyle = style;
47
+ }
48
+ const { i18n } = options.i18n
49
+ ? options
50
+ : await prompt({
51
+ name: 'i18n',
52
+ type: 'confirm',
53
+ message: 'Whether to use i18n?',
54
+ default: false,
55
+ });
56
+ const dirName = i18n ? 'i18n' : 'default';
57
+ const base = resolve(GENERATORS_DIR, 'base');
58
+ const configBase = resolve(GENERATORS_DIR, 'config', dirName, 'base');
59
+ const code = resolve(GENERATORS_DIR, 'config', dirName, codeStyle);
60
+ await copy(base, dest);
61
+ await copy(configBase, dest);
62
+ await copy(code, dest);
63
+ await rename(resolve(dest, '_gitignore'), resolve(dest, '.gitignore'));
64
+ syncVersion(name);
65
+ logger.success('✨ Application generated successfully!');
66
66
  logger.info(`\
67
67
  cd ${name}
68
68
  git init (Generating .git folder to init git hooks)
69
69
  pnpm install
70
- pnpm dev`);
70
+ pnpm dev`);
71
71
  logger.success(`\
72
72
  =======================
73
73
  Good luck have fun
74
74
  =======================\
75
- `);
76
- }
75
+ `);
76
+ }
@@ -1 +1 @@
1
- export declare function icons(): Promise<void>;
1
+ export declare function icons(): Promise<void>;
@@ -1,71 +1,71 @@
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}'`);
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
69
  const indexTemplate = `\
70
70
  export const pointCodes = {
71
71
  ${icons.map(({ pointCode, name }) => `'${name}': '${pointCode}'`).join(',\n ')}
@@ -74,7 +74,7 @@ export const pointCodes = {
74
74
  export default [
75
75
  ${iconNames.join(',\n')}
76
76
  ]
77
- `;
77
+ `;
78
78
  const cssTemplate = `\
79
79
  @font-face {
80
80
  font-family: "${name}";
@@ -87,19 +87,19 @@ ${iconNames.join(',\n')}
87
87
  font-family: "${name}";
88
88
  }
89
89
 
90
- ${icons
91
- .map((icon) => {
90
+ ${icons
91
+ .map((icon) => {
92
92
  return `.${namespace}-${icon.name}::before {
93
93
  content: "\\${icon.pointCode}";
94
- }`;
95
- })
94
+ }`;
95
+ })
96
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
- }
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,7 +1,7 @@
1
- export interface JestCommandOptions {
2
- watch?: boolean;
3
- watchAll?: boolean;
4
- component?: string;
5
- clearCache?: boolean;
6
- }
7
- export declare function jest(cmd: JestCommandOptions): Promise<void>;
1
+ export interface JestCommandOptions {
2
+ watch?: boolean;
3
+ watchAll?: boolean;
4
+ component?: string;
5
+ clearCache?: boolean;
6
+ }
7
+ export declare function jest(cmd: JestCommandOptions): Promise<void>;
@@ -1,27 +1,27 @@
1
- import logger from '../shared/logger.js';
2
- import jestModule from 'jest';
3
- import { CWD, JEST_CONFIG } from '../shared/constant.js';
4
- import { buildSiteEntry } from '../compiler/compileSiteEntry.js';
5
- const { runCLI } = jestModule;
6
- export async function jest(cmd) {
7
- process.env.NODE_ENV = 'test';
8
- const config = {
9
- rootDir: CWD,
10
- watch: cmd.watch,
11
- watchAll: cmd.watchAll,
12
- clearCache: cmd.clearCache,
13
- config: JEST_CONFIG,
14
- testRegex: cmd.component && `${cmd.component}/__tests__/.*.spec.[jt]s?$`,
15
- };
16
- await buildSiteEntry(false);
17
- try {
18
- const response = await runCLI(config, [CWD]);
19
- if (!response.results.success && !cmd.watch) {
20
- process.exit(1);
21
- }
22
- }
23
- catch (e) {
24
- logger.error(e.toString());
25
- process.exit(1);
26
- }
27
- }
1
+ import logger from '../shared/logger.js';
2
+ import jestModule from 'jest';
3
+ import { CWD, JEST_CONFIG } from '../shared/constant.js';
4
+ import { buildSiteEntry } from '../compiler/compileSiteEntry.js';
5
+ const { runCLI } = jestModule;
6
+ export async function jest(cmd) {
7
+ process.env.NODE_ENV = 'test';
8
+ const config = {
9
+ rootDir: CWD,
10
+ watch: cmd.watch,
11
+ watchAll: cmd.watchAll,
12
+ clearCache: cmd.clearCache,
13
+ config: JEST_CONFIG,
14
+ testRegex: cmd.component && `${cmd.component}/__tests__/.*.spec.[jt]s?$`,
15
+ };
16
+ await buildSiteEntry(false);
17
+ try {
18
+ const response = await runCLI(config, [CWD]);
19
+ if (!response.results.success && !cmd.watch) {
20
+ process.exit(1);
21
+ }
22
+ }
23
+ catch (e) {
24
+ logger.error(e.toString());
25
+ process.exit(1);
26
+ }
27
+ }
@@ -1 +1 @@
1
- export declare function lint(): Promise<void>;
1
+ export declare function lint(): Promise<void>;
@@ -1,42 +1,42 @@
1
- import execa from 'execa';
2
- import { createSpinner } from 'nanospinner';
3
- import { CWD, ESLINT_EXTENSIONS } from '../shared/constant.js';
4
- import { isDir } from '../shared/fsUtils.js';
5
- import { resolve } from 'path';
6
- export async function lint() {
7
- const spinner = createSpinner();
8
- try {
9
- spinner.start({ text: 'prettier starting...' });
10
- await execa('prettier', ['--write', '--cache', '.']);
11
- spinner.success({ text: 'prettier success' });
12
- spinner.start({ text: 'stylelint starting...' });
13
- const stylelintPattern = ['./src/**/*.vue', './src/**/*.css', './src/**/*.less'];
14
- const hasPackages = isDir(resolve(CWD, 'packages'));
15
- hasPackages && stylelintPattern.push('./packages/**/*.vue', './packages/**/*.css', './packages/**/*.less');
16
- await execa('stylelint', [...stylelintPattern, '--fix', '--cache']);
17
- spinner.success({ text: 'stylelint success' });
18
- spinner.start({ text: 'eslint starting...' });
19
- const eslintPatterns = [
20
- './src',
21
- './packages/varlet-cli/src',
22
- './packages/varlet-ui/src',
23
- './packages/varlet-icons/lib',
24
- './packages/varlet-vite-plugins/src',
25
- './packages/varlet-touch-emulator',
26
- './packages/varlet-vscode-extension/src',
27
- ];
28
- const { stdout } = await execa('eslint', [
29
- ...eslintPatterns.filter((pattern) => isDir(resolve(CWD, pattern))),
30
- '--fix',
31
- '--cache',
32
- '--ext',
33
- ESLINT_EXTENSIONS.join(),
34
- ]);
35
- const type = stdout ? 'warn' : 'success';
36
- spinner[type]({ text: stdout || 'eslint success' });
37
- }
38
- catch (e) {
39
- spinner.error({ text: e.toString() });
40
- process.exit(1);
41
- }
42
- }
1
+ import execa from 'execa';
2
+ import { createSpinner } from 'nanospinner';
3
+ import { CWD, ESLINT_EXTENSIONS } from '../shared/constant.js';
4
+ import { isDir } from '../shared/fsUtils.js';
5
+ import { resolve } from 'path';
6
+ export async function lint() {
7
+ const spinner = createSpinner();
8
+ try {
9
+ spinner.start({ text: 'prettier starting...' });
10
+ await execa('prettier', ['--write', '--cache', '.']);
11
+ spinner.success({ text: 'prettier success' });
12
+ spinner.start({ text: 'stylelint starting...' });
13
+ const stylelintPattern = ['./src/**/*.vue', './src/**/*.css', './src/**/*.less'];
14
+ const hasPackages = isDir(resolve(CWD, 'packages'));
15
+ hasPackages && stylelintPattern.push('./packages/**/*.vue', './packages/**/*.css', './packages/**/*.less');
16
+ await execa('stylelint', [...stylelintPattern, '--fix', '--cache']);
17
+ spinner.success({ text: 'stylelint success' });
18
+ spinner.start({ text: 'eslint starting...' });
19
+ const eslintPatterns = [
20
+ './src',
21
+ './packages/varlet-cli/src',
22
+ './packages/varlet-ui/src',
23
+ './packages/varlet-icons/lib',
24
+ './packages/varlet-vite-plugins/src',
25
+ './packages/varlet-touch-emulator',
26
+ './packages/varlet-vscode-extension/src',
27
+ ];
28
+ const { stdout } = await execa('eslint', [
29
+ ...eslintPatterns.filter((pattern) => isDir(resolve(CWD, pattern))),
30
+ '--fix',
31
+ '--cache',
32
+ '--ext',
33
+ ESLINT_EXTENSIONS.join(),
34
+ ]);
35
+ const type = stdout ? 'warn' : 'success';
36
+ spinner[type]({ text: stdout || 'eslint success' });
37
+ }
38
+ catch (e) {
39
+ spinner.error({ text: e.toString() });
40
+ process.exit(1);
41
+ }
42
+ }
@@ -1 +1 @@
1
- export declare function preview(): Promise<void>;
1
+ export declare function preview(): Promise<void>;
@@ -1,18 +1,18 @@
1
- import fse from 'fs-extra';
2
- import logger from '../shared/logger.js';
3
- import execa from 'execa';
4
- import { SITE_OUTPUT_PATH } from '../shared/constant.js';
5
- const { pathExistsSync } = fse;
6
- export async function preview() {
7
- var _a;
8
- if (!pathExistsSync(SITE_OUTPUT_PATH)) {
9
- logger.warning('Cannot find the site folder, you must first run the build command to build the document site');
10
- return;
11
- }
12
- try {
13
- await ((_a = execa.command('live-server --port=5500', { cwd: SITE_OUTPUT_PATH }).stdout) === null || _a === void 0 ? void 0 : _a.pipe(process.stdout));
14
- }
15
- catch (e) {
16
- logger.error(e.toString());
17
- }
18
- }
1
+ import fse from 'fs-extra';
2
+ import logger from '../shared/logger.js';
3
+ import execa from 'execa';
4
+ import { SITE_OUTPUT_PATH } from '../shared/constant.js';
5
+ const { pathExistsSync } = fse;
6
+ export async function preview() {
7
+ var _a;
8
+ if (!pathExistsSync(SITE_OUTPUT_PATH)) {
9
+ logger.warning('Cannot find the site folder, you must first run the build command to build the document site');
10
+ return;
11
+ }
12
+ try {
13
+ await ((_a = execa.command('live-server --port=5500', { cwd: SITE_OUTPUT_PATH }).stdout) === null || _a === void 0 ? void 0 : _a.pipe(process.stdout));
14
+ }
15
+ catch (e) {
16
+ logger.error(e.toString());
17
+ }
18
+ }
@@ -1,5 +1,5 @@
1
- export interface ReleaseCommandOptions {
2
- remote?: string;
3
- task?(): Promise<void>;
4
- }
5
- export declare function release(options: ReleaseCommandOptions): Promise<void>;
1
+ export interface ReleaseCommandOptions {
2
+ remote?: string;
3
+ task?(): Promise<void>;
4
+ }
5
+ export declare function release(options: ReleaseCommandOptions): Promise<void>;