@varlet/cli 2.0.0-alpha.1663499244572 → 2.0.0-alpha.1664031123039
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/LICENCE +21 -21
- package/README.en-US.md +401 -401
- package/README.md +396 -396
- package/lib/commands/build.d.ts +1 -1
- package/lib/commands/build.js +67 -18
- package/lib/commands/changelog.d.ts +6 -6
- package/lib/commands/changelog.js +27 -26
- package/lib/commands/commitLint.d.ts +1 -1
- package/lib/commands/commitLint.js +21 -50
- package/lib/commands/compile.d.ts +7 -7
- package/lib/commands/compile.js +119 -43
- package/lib/commands/create.d.ts +8 -8
- package/lib/commands/create.js +166 -90
- package/lib/commands/dev.d.ts +5 -5
- package/lib/commands/dev.js +123 -44
- package/lib/commands/gen.d.ts +8 -8
- package/lib/commands/gen.js +135 -85
- package/lib/commands/jest.d.ts +8 -0
- package/lib/commands/jest.js +85 -0
- package/lib/commands/lint.d.ts +1 -1
- package/lib/commands/lint.js +123 -48
- package/lib/commands/preview.d.ts +1 -1
- package/lib/commands/preview.js +74 -23
- package/lib/commands/release.d.ts +5 -5
- package/lib/commands/release.js +270 -132
- package/lib/commands/vite.d.ts +3 -3
- package/lib/commands/vite.js +69 -20
- package/lib/compiler/compileModule.d.ts +5 -5
- package/lib/compiler/compileModule.js +190 -79
- package/lib/compiler/compileSFC.d.ts +2 -2
- package/lib/compiler/compileSFC.js +135 -86
- package/lib/compiler/compileScript.d.ts +17 -17
- package/lib/compiler/compileScript.js +194 -152
- package/lib/compiler/compileSiteEntry.d.ts +13 -13
- package/lib/compiler/compileSiteEntry.js +237 -140
- package/lib/compiler/compileStyle.d.ts +11 -11
- package/lib/compiler/compileStyle.js +91 -43
- package/lib/compiler/compileTemplateHighlight.d.ts +10 -10
- package/lib/compiler/compileTemplateHighlight.js +193 -145
- package/lib/compiler/compileTypes.d.ts +2 -2
- package/lib/compiler/compileTypes.js +85 -49
- package/lib/config/babel.config.d.ts +2 -2
- package/lib/config/babel.config.js +31 -30
- package/lib/config/babel.sfc.transform.d.ts +1 -1
- package/lib/config/babel.sfc.transform.js +18 -18
- package/lib/config/jest.config.d.ts +1 -0
- package/lib/config/jest.config.js +37 -0
- package/lib/config/jest.media.mock.d.ts +0 -0
- package/lib/config/jest.media.mock.js +2 -0
- package/lib/config/jest.style.mock.d.ts +0 -0
- package/lib/config/jest.style.mock.js +2 -0
- package/lib/config/varlet.config.d.ts +1 -1
- package/lib/config/varlet.config.js +24 -23
- package/lib/config/vite.config.d.ts +5 -5
- package/lib/config/vite.config.js +162 -157
- package/lib/index.d.ts +2 -2
- package/lib/index.js +102 -84
- package/lib/shared/constant.d.ts +43 -44
- package/lib/shared/constant.js +50 -51
- package/lib/shared/fsUtils.d.ts +12 -12
- package/lib/shared/fsUtils.js +108 -61
- package/lib/shared/logger.d.ts +8 -8
- package/lib/shared/logger.js +23 -23
- package/package.json +11 -11
- package/preset.js +3 -3
- package/site/components/button/Button.vue +106 -106
- package/site/components/button/button.less +183 -183
- package/site/components/button/index.ts +10 -10
- package/site/components/button/props.ts +78 -78
- package/site/components/cell/Cell.vue +54 -54
- package/site/components/cell/cell.less +78 -78
- package/site/components/cell/index.ts +10 -10
- package/site/components/cell/props.ts +27 -27
- package/site/components/code-example/CodeExample.vue +137 -137
- package/site/components/code-example/codeExample.less +41 -41
- package/site/components/code-example/index.ts +10 -10
- package/site/components/context/index.ts +21 -21
- package/site/components/context/lock.ts +92 -92
- package/site/components/context/zIndex.ts +20 -20
- package/site/components/icon/Icon.vue +75 -75
- package/site/components/icon/icon.less +26 -26
- package/site/components/icon/index.ts +10 -10
- package/site/components/icon/props.ts +24 -24
- package/site/components/loading/Loading.vue +84 -84
- package/site/components/loading/index.ts +10 -10
- package/site/components/loading/loading.less +505 -505
- package/site/components/loading/props.ts +42 -42
- package/site/components/popup/Popup.tsx +102 -102
- package/site/components/popup/index.ts +10 -10
- package/site/components/popup/popup.less +125 -125
- package/site/components/popup/props.ts +63 -63
- package/site/components/progress/Progress.vue +112 -112
- package/site/components/progress/index.ts +10 -10
- package/site/components/progress/progress.less +101 -101
- package/site/components/progress/props.ts +55 -55
- package/site/components/ripple/index.ts +188 -188
- package/site/components/ripple/ripple.less +20 -20
- package/site/components/snackbar/Snackbar.vue +41 -41
- package/site/components/snackbar/core.vue +132 -132
- package/site/components/snackbar/index.tsx +270 -270
- package/site/components/snackbar/props.ts +97 -97
- package/site/components/snackbar/snackbar.less +135 -135
- package/site/components/styles/common.less +64 -64
- package/site/components/styles/elevation.less +126 -126
- package/site/components/styles/var.less +27 -27
- package/site/components/utils/components.ts +117 -117
- package/site/components/utils/elements.ts +102 -102
- package/site/index.html +49 -49
- package/site/mobile/App.vue +291 -291
- package/site/mobile/components/AppHome.vue +134 -134
- package/site/mobile/components/AppType.vue +22 -22
- package/site/mobile/components/app-bar/AppBar.vue +65 -65
- package/site/mobile/components/app-bar/appBar.less +57 -57
- package/site/mobile/components/app-bar/index.ts +10 -10
- package/site/mobile/components/app-bar/props.ts +25 -25
- package/site/mobile/main.ts +78 -78
- package/site/mobile.html +41 -41
- package/site/module.d.ts +5 -5
- package/site/pc/App.vue +43 -43
- package/site/pc/Layout.vue +423 -423
- package/site/pc/components/AnimationBox.vue +33 -33
- package/site/pc/components/AppHeader.vue +368 -368
- package/site/pc/components/AppMobile.vue +60 -60
- package/site/pc/components/AppSidebar.vue +143 -143
- package/site/pc/components/LogoAnimation.vue +117 -117
- package/site/pc/floating.ts +9 -9
- package/site/pc/main.ts +100 -100
- package/site/pc/pages/index/index.less +176 -176
- package/site/pc/pages/index/index.vue +130 -130
- package/site/pc/pages/index/locale/en-US.ts +1 -1
- package/site/pc/pages/index/locale/zh-CN.ts +1 -1
- package/site/tsconfig.json +11 -11
- package/site/useProgress.ts +72 -72
- package/site/utils.ts +165 -167
- package/template/create/{tsx.ejs → [ComponentName].tsx.ejs} +13 -13
- package/template/create/{vue.ejs → [ComponentName].vue.ejs} +17 -17
- package/template/create/{less.ejs → [componentName].less.ejs} +3 -3
- package/template/create/__tests__/{index.spec.ejs → index.spec.js.ejs} +13 -8
- package/template/create/example/{index.ejs → index.vue.ejs} +15 -15
- package/template/create/example/locale/en-US.ts +3 -3
- package/template/create/example/locale/index.ts +23 -23
- package/template/create/example/locale/zh-CN.ts +3 -3
- package/template/create/{index.ejs → index.ts.ejs} +11 -12
- package/template/create/props.ts +1 -1
- package/template/generators/base/.prettierignore +14 -9
- package/template/generators/base/.prettierrc +5 -5
- package/template/generators/base/README.md +82 -82
- package/template/generators/base/babel.config.js +10 -10
- package/template/generators/base/public/logo.svg +30 -1
- package/template/generators/base/shims/shims-md.d.ts +4 -4
- package/template/generators/base/shims/shims-vue.d.ts +6 -6
- package/template/generators/base/tsconfig.json +13 -13
- package/template/generators/config/default/base/docs/home.zh-CN.md +2 -10
- package/template/generators/config/default/base/package.json +112 -105
- package/template/generators/config/default/base/types/basicComponent.d.ts +7 -7
- package/template/generators/config/default/base/types/button.d.ts +12 -12
- package/template/generators/config/default/base/types/index.d.ts +6 -6
- package/template/generators/config/default/base/varlet.config.js +45 -110
- package/template/generators/config/default/sfc/src/button/Button.vue +31 -30
- package/template/generators/config/default/sfc/src/button/__tests__/index.spec.js +7 -7
- package/template/generators/config/default/sfc/src/button/button.less +14 -14
- package/template/generators/config/default/sfc/src/button/docs/zh-CN.md +38 -47
- package/template/generators/config/default/sfc/src/button/example/BasicUse.vue +7 -7
- package/template/generators/config/default/sfc/src/button/example/ModifyColor.vue +7 -7
- package/template/generators/config/default/sfc/src/button/example/index.vue +12 -13
- package/template/generators/config/default/sfc/src/button/index.ts +10 -10
- package/template/generators/config/default/tsx/src/button/Button.tsx +29 -29
- package/template/generators/config/default/tsx/src/button/__tests__/index.spec.js +7 -7
- package/template/generators/config/default/tsx/src/button/button.less +14 -14
- package/template/generators/config/default/tsx/src/button/docs/zh-CN.md +38 -47
- package/template/generators/config/default/tsx/src/button/example/BasicUse.vue +7 -7
- package/template/generators/config/default/tsx/src/button/example/ModifyColor.vue +7 -7
- package/template/generators/config/default/tsx/src/button/example/index.vue +12 -13
- package/template/generators/config/default/tsx/src/button/index.ts +10 -10
- package/template/generators/config/i18n/base/docs/home.en-US.md +3 -11
- package/template/generators/config/i18n/base/docs/home.zh-CN.md +2 -10
- package/template/generators/config/i18n/base/package.json +112 -105
- package/template/generators/config/i18n/base/types/basicComponent.d.ts +7 -7
- package/template/generators/config/i18n/base/types/button.d.ts +12 -12
- package/template/generators/config/i18n/base/types/index.d.ts +7 -7
- package/template/generators/config/i18n/base/types/locale.d.ts +24 -24
- package/template/generators/config/i18n/base/varlet.config.js +47 -122
- package/template/generators/config/i18n/sfc/src/button/Button.vue +37 -36
- package/template/generators/config/i18n/sfc/src/button/__tests__/index.spec.js +7 -7
- package/template/generators/config/i18n/sfc/src/button/button.less +14 -14
- package/template/generators/config/i18n/sfc/src/button/docs/en-US.md +38 -34
- package/template/generators/config/i18n/sfc/src/button/docs/zh-CN.md +38 -34
- package/template/generators/config/i18n/sfc/src/button/example/BasicUse.vue +11 -11
- package/template/generators/config/i18n/sfc/src/button/example/ModifyColor.vue +11 -11
- package/template/generators/config/i18n/sfc/src/button/example/index.vue +16 -13
- package/template/generators/config/i18n/sfc/src/button/example/locale/en-US.ts +5 -5
- package/template/generators/config/i18n/sfc/src/button/example/locale/index.ts +23 -23
- package/template/generators/config/i18n/sfc/src/button/example/locale/zh-CN.ts +5 -5
- package/template/generators/config/i18n/sfc/src/button/index.ts +10 -10
- package/template/generators/config/i18n/sfc/src/locale/__tests__/index.spec.js +51 -51
- package/template/generators/config/i18n/sfc/src/locale/docs/en-US.md +26 -26
- package/template/generators/config/i18n/sfc/src/locale/docs/zh-CN.md +25 -25
- package/template/generators/config/i18n/sfc/src/locale/en-US.d.ts +5 -5
- package/template/generators/config/i18n/sfc/src/locale/en-US.ts +7 -7
- package/template/generators/config/i18n/sfc/src/locale/index.ts +67 -67
- package/template/generators/config/i18n/sfc/src/locale/zh-CN.d.ts +5 -5
- package/template/generators/config/i18n/sfc/src/locale/zh-CN.ts +7 -7
- package/template/generators/config/i18n/tsx/src/button/Button.tsx +31 -33
- package/template/generators/config/i18n/tsx/src/button/__tests__/index.spec.js +7 -7
- package/template/generators/config/i18n/tsx/src/button/button.less +14 -14
- package/template/generators/config/i18n/tsx/src/button/docs/en-US.md +38 -34
- package/template/generators/config/i18n/tsx/src/button/docs/zh-CN.md +38 -34
- package/template/generators/config/i18n/tsx/src/button/example/BasicUse.vue +11 -11
- package/template/generators/config/i18n/tsx/src/button/example/ModifyColor.vue +11 -11
- package/template/generators/config/i18n/tsx/src/button/example/index.vue +15 -13
- package/template/generators/config/i18n/tsx/src/button/example/locale/en-US.ts +5 -5
- package/template/generators/config/i18n/tsx/src/button/example/locale/index.ts +23 -23
- package/template/generators/config/i18n/tsx/src/button/example/locale/zh-CN.ts +5 -5
- package/template/generators/config/i18n/tsx/src/button/index.ts +10 -10
- package/template/generators/config/i18n/tsx/src/locale/__tests__/index.spec.js +51 -51
- package/template/generators/config/i18n/tsx/src/locale/docs/en-US.md +26 -26
- package/template/generators/config/i18n/tsx/src/locale/docs/zh-CN.md +25 -25
- package/template/generators/config/i18n/tsx/src/locale/en-US.d.ts +5 -5
- package/template/generators/config/i18n/tsx/src/locale/en-US.ts +7 -7
- package/template/generators/config/i18n/tsx/src/locale/index.ts +67 -67
- package/template/generators/config/i18n/tsx/src/locale/zh-CN.d.ts +5 -5
- package/template/generators/config/i18n/tsx/src/locale/zh-CN.ts +7 -7
- package/tsconfig.json +14 -15
- package/varlet.default.config.js +3 -3
- package/lib/commands/test.d.ts +0 -7
- package/lib/commands/test.js +0 -26
- package/lib/config/vitest.config.d.ts +0 -2
- package/lib/config/vitest.config.js +0 -28
- package/template/generators/base/public/highlight.css +0 -1
package/lib/index.js
CHANGED
|
@@ -1,84 +1,102 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
program
|
|
38
|
-
program
|
|
39
|
-
|
|
40
|
-
.
|
|
41
|
-
.option('-
|
|
42
|
-
.
|
|
43
|
-
|
|
44
|
-
program
|
|
45
|
-
|
|
46
|
-
.
|
|
47
|
-
.
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
.
|
|
56
|
-
.
|
|
57
|
-
.option('-
|
|
58
|
-
.action(
|
|
59
|
-
program
|
|
60
|
-
|
|
61
|
-
.
|
|
62
|
-
.
|
|
63
|
-
.option('-
|
|
64
|
-
.option('-
|
|
65
|
-
.option('-
|
|
66
|
-
.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
.
|
|
70
|
-
.
|
|
71
|
-
.
|
|
72
|
-
.
|
|
73
|
-
|
|
74
|
-
.
|
|
75
|
-
.
|
|
76
|
-
|
|
77
|
-
.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
program
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
4
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5
|
+
if (!m) return o;
|
|
6
|
+
var i = m.call(o), r, ar = [], e;
|
|
7
|
+
try {
|
|
8
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
9
|
+
}
|
|
10
|
+
catch (error) { e = { error: error }; }
|
|
11
|
+
finally {
|
|
12
|
+
try {
|
|
13
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
14
|
+
}
|
|
15
|
+
finally { if (e) throw e.error; }
|
|
16
|
+
}
|
|
17
|
+
return ar;
|
|
18
|
+
};
|
|
19
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
var logger_1 = __importDefault(require("./shared/logger"));
|
|
24
|
+
var commander_1 = require("commander");
|
|
25
|
+
var dev_1 = require("./commands/dev");
|
|
26
|
+
var build_1 = require("./commands/build");
|
|
27
|
+
var vite_1 = require("./commands/vite");
|
|
28
|
+
var compile_1 = require("./commands/compile");
|
|
29
|
+
var create_1 = require("./commands/create");
|
|
30
|
+
var jest_1 = require("./commands/jest");
|
|
31
|
+
var lint_1 = require("./commands/lint");
|
|
32
|
+
var gen_1 = require("./commands/gen");
|
|
33
|
+
var preview_1 = require("./commands/preview");
|
|
34
|
+
var changelog_1 = require("./commands/changelog");
|
|
35
|
+
var release_1 = require("./commands/release");
|
|
36
|
+
var commitLint_1 = require("./commands/commitLint");
|
|
37
|
+
var program = new commander_1.Command();
|
|
38
|
+
program.version("varlet-cli ".concat(require('../package.json').version)).usage('<command> [options]');
|
|
39
|
+
program
|
|
40
|
+
.command('dev')
|
|
41
|
+
.option('-f --force', 'Force dep pre-optimization regardless of whether deps have changed')
|
|
42
|
+
.description('Run varlet development environment')
|
|
43
|
+
.action(dev_1.dev);
|
|
44
|
+
program.command('build').description('Build varlet site for production').action(build_1.build);
|
|
45
|
+
program
|
|
46
|
+
.command('build:vite')
|
|
47
|
+
.description('Use vite build app for production')
|
|
48
|
+
.action(function () { return (0, vite_1.vite)('build'); });
|
|
49
|
+
program
|
|
50
|
+
.command('dev:vite')
|
|
51
|
+
.description('Use vite start server for development')
|
|
52
|
+
.action(function () { return (0, vite_1.vite)('dev'); });
|
|
53
|
+
program.command('preview').description('Preview varlet site for production').action(preview_1.preview);
|
|
54
|
+
program
|
|
55
|
+
.command('compile')
|
|
56
|
+
.description('Compile varlet components library code')
|
|
57
|
+
.option('-nu, --noUmd', 'Do not compile umd target code')
|
|
58
|
+
.action(compile_1.compile);
|
|
59
|
+
program.command('lint').description('Lint code').action(lint_1.lint);
|
|
60
|
+
program
|
|
61
|
+
.command('create')
|
|
62
|
+
.description('Create a component directory')
|
|
63
|
+
.option('-n, --name <componentName>', 'Component name')
|
|
64
|
+
.option('-s, --sfc', 'Generate files in sfc format')
|
|
65
|
+
.option('-t, --tsx', 'Generate files in tsx format')
|
|
66
|
+
.option('-l, --locale', 'Generator internationalized files')
|
|
67
|
+
.action(create_1.create);
|
|
68
|
+
program
|
|
69
|
+
.command('jest')
|
|
70
|
+
.description('Run Jest in work directory')
|
|
71
|
+
.option('-w, --watch', 'Watch files for changes and rerun tests related to changed files')
|
|
72
|
+
.option('-wa, --watchAll', 'Watch files for changes and rerun all tests when something changes')
|
|
73
|
+
.option('-c, --component <componentName>', 'Test a specific component')
|
|
74
|
+
.option('-cc --clearCache', 'Clear test cache')
|
|
75
|
+
.action(jest_1.jest);
|
|
76
|
+
program
|
|
77
|
+
.command('gen')
|
|
78
|
+
.description('Generate cli application')
|
|
79
|
+
.option('-n, --name <applicationName>', 'Application name')
|
|
80
|
+
.option('-s, --sfc', 'Generate files in sfc format')
|
|
81
|
+
.option('-t, --tsx', 'Generate files in tsx format')
|
|
82
|
+
.option('-l, --locale', 'Generator internationalized files')
|
|
83
|
+
.action(gen_1.gen);
|
|
84
|
+
program
|
|
85
|
+
.command('changelog')
|
|
86
|
+
.option('-rc --releaseCount <releaseCount>', 'Release count')
|
|
87
|
+
.option('-f --file <file>', 'Changelog filename')
|
|
88
|
+
.description('Generate changelog')
|
|
89
|
+
.action(changelog_1.changelog);
|
|
90
|
+
program
|
|
91
|
+
.command('release')
|
|
92
|
+
.option('-r --remote <remote>', 'Remote name')
|
|
93
|
+
.description('Release all packages and generate changelogs')
|
|
94
|
+
.action(release_1.release);
|
|
95
|
+
program.command('commit-lint <gitParams>').description('Lint commit message').action(commitLint_1.commitLint);
|
|
96
|
+
program.on('command:*', function (_a) {
|
|
97
|
+
var _b = __read(_a, 1), cmd = _b[0];
|
|
98
|
+
program.outputHelp();
|
|
99
|
+
logger_1.default.error("\nUnknown command ".concat(cmd, ".\n"));
|
|
100
|
+
process.exitCode = 1;
|
|
101
|
+
});
|
|
102
|
+
program.parse();
|
package/lib/shared/constant.d.ts
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
export declare const CWD: string;
|
|
2
|
-
export declare const VARLET_CONFIG: string;
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const
|
|
33
|
-
export declare const
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const
|
|
36
|
-
export declare const
|
|
37
|
-
export declare const
|
|
38
|
-
export declare const
|
|
39
|
-
export declare const
|
|
40
|
-
export declare const
|
|
41
|
-
export declare const
|
|
42
|
-
export declare const
|
|
43
|
-
export declare const
|
|
44
|
-
export declare const JEST_STYLE_MOCK: string;
|
|
1
|
+
export declare const CWD: string;
|
|
2
|
+
export declare const VARLET_CONFIG: string;
|
|
3
|
+
export declare const SRC_DIR: string;
|
|
4
|
+
export declare const ES_DIR: string;
|
|
5
|
+
export declare const LIB_DIR: string;
|
|
6
|
+
export declare const UMD_DIR: string;
|
|
7
|
+
export declare const TYPES_DIR: string;
|
|
8
|
+
export declare const ROOT_DOCS_DIR: string;
|
|
9
|
+
export declare const ROOT_PAGES_DIR: string;
|
|
10
|
+
export declare const ESLINT_EXTENSIONS: string[];
|
|
11
|
+
export declare const VITE_RESOLVE_EXTENSIONS: string[];
|
|
12
|
+
export declare const SCRIPTS_EXTENSIONS: string[];
|
|
13
|
+
export declare const PUBLIC_DIR_INDEXES: string[];
|
|
14
|
+
export declare const STYLE_DIR_NAME = "style";
|
|
15
|
+
export declare const EXAMPLE_DIR_NAME = "example";
|
|
16
|
+
export declare const LOCALE_DIR_NAME = "locale";
|
|
17
|
+
export declare const DOCS_DIR_NAME = "docs";
|
|
18
|
+
export declare const DIR_INDEX = "index.vue";
|
|
19
|
+
export declare const TESTS_DIR_NAME = "__tests__";
|
|
20
|
+
export declare const GENERATORS_DIR: string;
|
|
21
|
+
export declare const UI_PACKAGE_JSON: string;
|
|
22
|
+
export declare const CLI_PACKAGE_JSON: string;
|
|
23
|
+
export declare const SITE: string;
|
|
24
|
+
export declare const SITE_OUTPUT_PATH: string;
|
|
25
|
+
export declare const SITE_PUBLIC_PATH: string;
|
|
26
|
+
export declare const SITE_DIR: string;
|
|
27
|
+
export declare const SITE_PC_DIR: string;
|
|
28
|
+
export declare const SITE_PC_ROUTES: string;
|
|
29
|
+
export declare const SITE_MOBILE_ROUTES: string;
|
|
30
|
+
export declare const SITE_CONFIG: string;
|
|
31
|
+
export declare const HL_COMPONENT_NAME_RE: RegExp;
|
|
32
|
+
export declare const HL_API_RE: RegExp;
|
|
33
|
+
export declare const HL_TITLE_ATTRIBUTES_RE: RegExp;
|
|
34
|
+
export declare const HL_TITLE_EVENTS_RE: RegExp;
|
|
35
|
+
export declare const HL_TITLE_SLOTS_RE: RegExp;
|
|
36
|
+
export declare const HL_MD = "zh-CN.md";
|
|
37
|
+
export declare const HL_DIR: string;
|
|
38
|
+
export declare const HL_TAGS_JSON: string;
|
|
39
|
+
export declare const HL_ATTRIBUTES_JSON: string;
|
|
40
|
+
export declare const HL_WEB_TYPES_JSON: string;
|
|
41
|
+
export declare const JEST_CONFIG: string;
|
|
42
|
+
export declare const JEST_MEDIA_MOCK: string;
|
|
43
|
+
export declare const JEST_STYLE_MOCK: string;
|
package/lib/shared/constant.js
CHANGED
|
@@ -1,51 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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_PC_DIR = exports.SITE_DIR = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.CLI_PACKAGE_JSON = exports.UI_PACKAGE_JSON = exports.GENERATORS_DIR = exports.TESTS_DIR_NAME = exports.DIR_INDEX = exports.DOCS_DIR_NAME = exports.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_PAGES_DIR = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.LIB_DIR = exports.ES_DIR = exports.SRC_DIR = exports.
|
|
4
|
-
|
|
5
|
-
exports.CWD = process.cwd();
|
|
6
|
-
exports.VARLET_CONFIG = (0, path_1.resolve)(exports.CWD, 'varlet.config.js');
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
exports.
|
|
50
|
-
exports.
|
|
51
|
-
exports.JEST_STYLE_MOCK = (0, path_1.resolve)(__dirname, '../config/jest.style.mock.js');
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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_PC_DIR = exports.SITE_DIR = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.CLI_PACKAGE_JSON = exports.UI_PACKAGE_JSON = exports.GENERATORS_DIR = exports.TESTS_DIR_NAME = exports.DIR_INDEX = exports.DOCS_DIR_NAME = exports.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_PAGES_DIR = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.LIB_DIR = exports.ES_DIR = exports.SRC_DIR = exports.VARLET_CONFIG = exports.CWD = void 0;
|
|
4
|
+
var path_1 = require("path");
|
|
5
|
+
exports.CWD = process.cwd();
|
|
6
|
+
exports.VARLET_CONFIG = (0, path_1.resolve)(exports.CWD, 'varlet.config.js');
|
|
7
|
+
exports.SRC_DIR = (0, path_1.resolve)(exports.CWD, 'src');
|
|
8
|
+
exports.ES_DIR = (0, path_1.resolve)(exports.CWD, 'es');
|
|
9
|
+
exports.LIB_DIR = (0, path_1.resolve)(exports.CWD, 'lib');
|
|
10
|
+
exports.UMD_DIR = (0, path_1.resolve)(exports.CWD, 'umd');
|
|
11
|
+
exports.TYPES_DIR = (0, path_1.resolve)(exports.CWD, 'types');
|
|
12
|
+
exports.ROOT_DOCS_DIR = (0, path_1.resolve)(exports.CWD, 'docs');
|
|
13
|
+
exports.ROOT_PAGES_DIR = (0, path_1.resolve)(exports.CWD, 'pages');
|
|
14
|
+
exports.ESLINT_EXTENSIONS = ['.vue', '.ts', '.js', '.mjs', '.tsx', '.jsx'];
|
|
15
|
+
exports.VITE_RESOLVE_EXTENSIONS = ['.vue', '.tsx', '.ts', '.jsx', '.js', '.less', '.css'];
|
|
16
|
+
exports.SCRIPTS_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js'];
|
|
17
|
+
exports.PUBLIC_DIR_INDEXES = ['index.vue', 'index.tsx', 'index.ts', 'index.jsx', 'index.js'];
|
|
18
|
+
exports.STYLE_DIR_NAME = 'style';
|
|
19
|
+
exports.EXAMPLE_DIR_NAME = 'example';
|
|
20
|
+
exports.LOCALE_DIR_NAME = 'locale';
|
|
21
|
+
exports.DOCS_DIR_NAME = 'docs';
|
|
22
|
+
exports.DIR_INDEX = 'index.vue';
|
|
23
|
+
exports.TESTS_DIR_NAME = '__tests__';
|
|
24
|
+
exports.GENERATORS_DIR = (0, path_1.resolve)(__dirname, '../../template/generators');
|
|
25
|
+
exports.UI_PACKAGE_JSON = (0, path_1.resolve)(exports.CWD, 'package.json');
|
|
26
|
+
exports.CLI_PACKAGE_JSON = (0, path_1.resolve)(__dirname, '../../package.json');
|
|
27
|
+
// site
|
|
28
|
+
exports.SITE = (0, path_1.resolve)(__dirname, '../../site');
|
|
29
|
+
exports.SITE_OUTPUT_PATH = (0, path_1.resolve)(exports.CWD, 'site');
|
|
30
|
+
exports.SITE_PUBLIC_PATH = (0, path_1.resolve)(exports.CWD, 'public');
|
|
31
|
+
exports.SITE_DIR = (0, path_1.resolve)(exports.CWD, '.varlet/site');
|
|
32
|
+
exports.SITE_PC_DIR = (0, path_1.resolve)(exports.CWD, '.varlet/site/pc');
|
|
33
|
+
exports.SITE_PC_ROUTES = (0, path_1.resolve)(exports.CWD, '.varlet/pc.routes.ts');
|
|
34
|
+
exports.SITE_MOBILE_ROUTES = (0, path_1.resolve)(exports.CWD, '.varlet/mobile.routes.ts');
|
|
35
|
+
exports.SITE_CONFIG = (0, path_1.resolve)(exports.CWD, '.varlet/site.config.json');
|
|
36
|
+
// template highlight
|
|
37
|
+
exports.HL_COMPONENT_NAME_RE = /.*(\/|\\)(.+)(\/|\\)docs(\/|\\)/;
|
|
38
|
+
exports.HL_API_RE = /##\s*API\n+/;
|
|
39
|
+
exports.HL_TITLE_ATTRIBUTES_RE = /###\s*属性\s*\n+/;
|
|
40
|
+
exports.HL_TITLE_EVENTS_RE = /###\s*事件\s*\n+/;
|
|
41
|
+
exports.HL_TITLE_SLOTS_RE = /###\s*插槽\s*\n+/;
|
|
42
|
+
exports.HL_MD = 'zh-CN.md';
|
|
43
|
+
exports.HL_DIR = (0, path_1.resolve)(exports.CWD, 'highlight');
|
|
44
|
+
exports.HL_TAGS_JSON = (0, path_1.resolve)(exports.HL_DIR, 'tags.json');
|
|
45
|
+
exports.HL_ATTRIBUTES_JSON = (0, path_1.resolve)(exports.HL_DIR, 'attributes.json');
|
|
46
|
+
exports.HL_WEB_TYPES_JSON = (0, path_1.resolve)(exports.HL_DIR, 'web-types.json');
|
|
47
|
+
// jest
|
|
48
|
+
exports.JEST_CONFIG = (0, path_1.resolve)(__dirname, '../config/jest.config.js');
|
|
49
|
+
exports.JEST_MEDIA_MOCK = (0, path_1.resolve)(__dirname, '../config/jest.media.mock.js');
|
|
50
|
+
exports.JEST_STYLE_MOCK = (0, path_1.resolve)(__dirname, '../config/jest.style.mock.js');
|
package/lib/shared/fsUtils.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare function getPublicDirs(): Promise<string[]>;
|
|
2
|
-
export declare const isMD: (file: string) => boolean;
|
|
3
|
-
export declare const isDir: (file: string) => boolean;
|
|
4
|
-
export declare const isSFC: (file: string) => boolean;
|
|
5
|
-
export declare const isDTS: (file: string) => boolean;
|
|
6
|
-
export declare const isScript: (file: string) => boolean;
|
|
7
|
-
export declare const isLess: (file: string) => boolean;
|
|
8
|
-
export declare const isPublicDir: (dir: string) => boolean;
|
|
9
|
-
export declare const replaceExt: (file: string, ext: string) => string;
|
|
10
|
-
export declare function smartAppendFileSync(file: string, code: string): void;
|
|
11
|
-
export declare function outputFileSyncOnChange(path: string, code: string): void;
|
|
12
|
-
export declare function glob(pattern: string): Promise<string[]>;
|
|
1
|
+
export declare function getPublicDirs(): Promise<string[]>;
|
|
2
|
+
export declare const isMD: (file: string) => boolean;
|
|
3
|
+
export declare const isDir: (file: string) => boolean;
|
|
4
|
+
export declare const isSFC: (file: string) => boolean;
|
|
5
|
+
export declare const isDTS: (file: string) => boolean;
|
|
6
|
+
export declare const isScript: (file: string) => boolean;
|
|
7
|
+
export declare const isLess: (file: string) => boolean;
|
|
8
|
+
export declare const isPublicDir: (dir: string) => boolean;
|
|
9
|
+
export declare const replaceExt: (file: string, ext: string) => string;
|
|
10
|
+
export declare function smartAppendFileSync(file: string, code: string): void;
|
|
11
|
+
export declare function outputFileSyncOnChange(path: string, code: string): void;
|
|
12
|
+
export declare function glob(pattern: string): Promise<string[]>;
|
package/lib/shared/fsUtils.js
CHANGED
|
@@ -1,61 +1,108 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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.glob = exports.outputFileSyncOnChange = exports.smartAppendFileSync = exports.replaceExt = exports.isPublicDir = exports.isLess = exports.isScript = exports.isDTS = exports.isSFC = exports.isDir = exports.isMD = exports.getPublicDirs = void 0;
|
|
43
|
+
var path_1 = require("path");
|
|
44
|
+
var fs_extra_1 = require("fs-extra");
|
|
45
|
+
var constant_1 = require("./constant");
|
|
46
|
+
var glob_1 = __importDefault(require("glob"));
|
|
47
|
+
function getPublicDirs() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
+
var srcDir;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0: return [4 /*yield*/, (0, fs_extra_1.readdir)(constant_1.SRC_DIR)];
|
|
53
|
+
case 1:
|
|
54
|
+
srcDir = _a.sent();
|
|
55
|
+
return [2 /*return*/, srcDir.filter(function (filename) { return (0, exports.isPublicDir)((0, path_1.resolve)(constant_1.SRC_DIR, filename)); })];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
exports.getPublicDirs = getPublicDirs;
|
|
61
|
+
var isMD = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && (0, path_1.extname)(file) === '.md'; };
|
|
62
|
+
exports.isMD = isMD;
|
|
63
|
+
var isDir = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && (0, fs_extra_1.lstatSync)(file).isDirectory(); };
|
|
64
|
+
exports.isDir = isDir;
|
|
65
|
+
var isSFC = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && (0, path_1.extname)(file) === '.vue'; };
|
|
66
|
+
exports.isSFC = isSFC;
|
|
67
|
+
var isDTS = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && file.endsWith('.d.ts'); };
|
|
68
|
+
exports.isDTS = isDTS;
|
|
69
|
+
var isScript = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && constant_1.SCRIPTS_EXTENSIONS.includes((0, path_1.extname)(file)); };
|
|
70
|
+
exports.isScript = isScript;
|
|
71
|
+
var isLess = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && (0, path_1.extname)(file) === '.less'; };
|
|
72
|
+
exports.isLess = isLess;
|
|
73
|
+
var isPublicDir = function (dir) {
|
|
74
|
+
return constant_1.PUBLIC_DIR_INDEXES.some(function (index) { return (0, fs_extra_1.pathExistsSync)((0, path_1.resolve)(dir, index)); });
|
|
75
|
+
};
|
|
76
|
+
exports.isPublicDir = isPublicDir;
|
|
77
|
+
var replaceExt = function (file, ext) { return file.replace((0, path_1.extname)(file), ext); };
|
|
78
|
+
exports.replaceExt = replaceExt;
|
|
79
|
+
function smartAppendFileSync(file, code) {
|
|
80
|
+
if ((0, fs_extra_1.pathExistsSync)(file)) {
|
|
81
|
+
var content = (0, fs_extra_1.readFileSync)(file, 'utf-8');
|
|
82
|
+
if (!content.includes(code)) {
|
|
83
|
+
(0, fs_extra_1.appendFileSync)(file, code);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.smartAppendFileSync = smartAppendFileSync;
|
|
88
|
+
function outputFileSyncOnChange(path, code) {
|
|
89
|
+
(0, fs_extra_1.ensureFileSync)(path);
|
|
90
|
+
var content = (0, fs_extra_1.readFileSync)(path, 'utf-8');
|
|
91
|
+
if (content !== code) {
|
|
92
|
+
(0, fs_extra_1.outputFileSync)(path, code);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.outputFileSyncOnChange = outputFileSyncOnChange;
|
|
96
|
+
function glob(pattern) {
|
|
97
|
+
return new Promise(function (resolve, reject) {
|
|
98
|
+
(0, glob_1.default)(pattern, function (err, files) {
|
|
99
|
+
if (err) {
|
|
100
|
+
reject(err);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
resolve(files);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
exports.glob = glob;
|
package/lib/shared/logger.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
info(text: string): void;
|
|
3
|
-
success(text: string): void;
|
|
4
|
-
warning(text: string): void;
|
|
5
|
-
error(text: string): void;
|
|
6
|
-
title(text: string): void;
|
|
7
|
-
};
|
|
8
|
-
export default _default;
|
|
1
|
+
declare const _default: {
|
|
2
|
+
info(text: string): void;
|
|
3
|
+
success(text: string): void;
|
|
4
|
+
warning(text: string): void;
|
|
5
|
+
error(text: string): void;
|
|
6
|
+
title(text: string): void;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|