@gct-paas/cli 0.0.1-dev.1 → 0.0.1-dev.10
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/LICENSE +21 -0
- package/dist/actions/gen-api/api-manage.cjs +46 -0
- package/dist/actions/gen-api/api-manage.d.ts +36 -0
- package/dist/actions/gen-api/gen-api.cjs +157 -0
- package/dist/actions/gen-api/gen-api.d.ts +58 -0
- package/dist/actions/gen-api/model-manage.cjs +127 -0
- package/dist/actions/gen-api/model-manage.d.ts +124 -0
- package/dist/actions/index.cjs +12 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/bin.cjs +5 -0
- package/dist/bin.d.ts +2 -0
- package/dist/commands/gen-api/gen-api.cjs +16 -0
- package/dist/commands/gen-api/gen-api.d.ts +44 -0
- package/dist/commands/index.cjs +23 -0
- package/dist/commands/index.d.ts +5 -0
- package/dist/core/handlebars/constant/index.cjs +8 -0
- package/dist/core/handlebars/constant/index.d.ts +2 -0
- package/dist/core/handlebars/handlebars-engine.cjs +134 -0
- package/dist/core/handlebars/handlebars-engine.d.ts +74 -0
- package/dist/core/handlebars/helpers/and/and.cjs +21 -0
- package/dist/core/handlebars/helpers/and/and.d.ts +13 -0
- package/dist/core/handlebars/helpers/camel-case/camel-case.cjs +20 -0
- package/dist/core/handlebars/helpers/camel-case/camel-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/concat/concat.cjs +17 -0
- package/dist/core/handlebars/helpers/concat/concat.d.ts +13 -0
- package/dist/core/handlebars/helpers/eq/eq.cjs +19 -0
- package/dist/core/handlebars/helpers/eq/eq.d.ts +14 -0
- package/dist/core/handlebars/helpers/format-import/format-import.cjs +41 -0
- package/dist/core/handlebars/helpers/format-import/format-import.d.ts +13 -0
- package/dist/core/handlebars/helpers/format-import-item/format-import-item.cjs +37 -0
- package/dist/core/handlebars/helpers/format-import-item/format-import-item.d.ts +13 -0
- package/dist/core/handlebars/helpers/format-js-type/format-js-type.cjs +41 -0
- package/dist/core/handlebars/helpers/format-js-type/format-js-type.d.ts +14 -0
- package/dist/core/handlebars/helpers/gt/gt.cjs +19 -0
- package/dist/core/handlebars/helpers/gt/gt.d.ts +14 -0
- package/dist/core/handlebars/helpers/gte/gte.cjs +19 -0
- package/dist/core/handlebars/helpers/gte/gte.d.ts +14 -0
- package/dist/core/handlebars/helpers/helper-base.cjs +19 -0
- package/dist/core/handlebars/helpers/helper-base.d.ts +22 -0
- package/dist/core/handlebars/helpers/includes/includes.cjs +18 -0
- package/dist/core/handlebars/helpers/includes/includes.d.ts +13 -0
- package/dist/core/handlebars/helpers/index.cjs +52 -0
- package/dist/core/handlebars/helpers/index.d.ts +6 -0
- package/dist/core/handlebars/helpers/json/json.cjs +16 -0
- package/dist/core/handlebars/helpers/json/json.d.ts +13 -0
- package/dist/core/handlebars/helpers/lower-case/lower-case.cjs +19 -0
- package/dist/core/handlebars/helpers/lower-case/lower-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/lt/lt.cjs +19 -0
- package/dist/core/handlebars/helpers/lt/lt.d.ts +14 -0
- package/dist/core/handlebars/helpers/lte/lte.cjs +19 -0
- package/dist/core/handlebars/helpers/lte/lte.d.ts +14 -0
- package/dist/core/handlebars/helpers/neq/neq.cjs +19 -0
- package/dist/core/handlebars/helpers/neq/neq.d.ts +14 -0
- package/dist/core/handlebars/helpers/not/not.cjs +21 -0
- package/dist/core/handlebars/helpers/not/not.d.ts +14 -0
- package/dist/core/handlebars/helpers/not-includes/not-includes.cjs +18 -0
- package/dist/core/handlebars/helpers/not-includes/not-includes.d.ts +13 -0
- package/dist/core/handlebars/helpers/or/or.cjs +23 -0
- package/dist/core/handlebars/helpers/or/or.d.ts +13 -0
- package/dist/core/handlebars/helpers/pascal-case/pascal-case.cjs +20 -0
- package/dist/core/handlebars/helpers/pascal-case/pascal-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/snake-case/snake-case.cjs +20 -0
- package/dist/core/handlebars/helpers/snake-case/snake-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/spinal-case/spinal-case.cjs +20 -0
- package/dist/core/handlebars/helpers/spinal-case/spinal-case.d.ts +13 -0
- package/dist/core/handlebars/helpers/upper-case/upper-case.cjs +19 -0
- package/dist/core/handlebars/helpers/upper-case/upper-case.d.ts +13 -0
- package/dist/core/handlebars/index.cjs +27 -0
- package/dist/core/handlebars/index.d.ts +2 -0
- package/dist/core/handlebars/utils/helper/helper.cjs +41 -0
- package/dist/core/handlebars/utils/helper/helper.d.ts +33 -0
- package/dist/core/handlebars/utils/index.cjs +20 -0
- package/dist/core/handlebars/utils/index.d.ts +17 -0
- package/dist/core/index.cjs +27 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/interface/index.cjs +1 -0
- package/dist/core/interface/index.d.ts +1 -0
- package/dist/index.cjs +47 -0
- package/dist/index.d.ts +2 -0
- package/dist/interface/i-command/i-command.cjs +1 -0
- package/dist/interface/i-command/i-command.d.ts +22 -0
- package/dist/interface/index.cjs +16 -0
- package/dist/utils/index.cjs +18 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/local-binaries/local-binaries.cjs +19 -0
- package/dist/utils/local-binaries/local-binaries.d.ts +3 -0
- package/es/actions/gen-api/api-manage.d.ts +36 -0
- package/es/actions/gen-api/api-manage.mjs +38 -0
- package/es/actions/gen-api/gen-api.d.ts +58 -0
- package/es/actions/gen-api/gen-api.mjs +164 -0
- package/es/actions/gen-api/model-manage.d.ts +124 -0
- package/es/actions/gen-api/model-manage.mjs +126 -0
- package/es/actions/index.d.ts +1 -0
- package/es/actions/index.mjs +1 -0
- package/es/bin.d.ts +2 -0
- package/es/commands/gen-api/gen-api.d.ts +44 -0
- package/es/commands/gen-api/gen-api.mjs +15 -0
- package/es/commands/index.d.ts +5 -0
- package/es/commands/index.mjs +16 -0
- package/es/core/handlebars/constant/index.d.ts +2 -0
- package/es/core/handlebars/constant/index.mjs +2 -0
- package/es/core/handlebars/handlebars-engine.d.ts +74 -0
- package/es/core/handlebars/handlebars-engine.mjs +122 -0
- package/es/core/handlebars/helpers/and/and.d.ts +13 -0
- package/es/core/handlebars/helpers/and/and.mjs +14 -0
- package/es/core/handlebars/helpers/camel-case/camel-case.d.ts +13 -0
- package/es/core/handlebars/helpers/camel-case/camel-case.mjs +13 -0
- package/es/core/handlebars/helpers/concat/concat.d.ts +13 -0
- package/es/core/handlebars/helpers/concat/concat.mjs +10 -0
- package/es/core/handlebars/helpers/eq/eq.d.ts +14 -0
- package/es/core/handlebars/helpers/eq/eq.mjs +12 -0
- package/es/core/handlebars/helpers/format-import/format-import.d.ts +13 -0
- package/es/core/handlebars/helpers/format-import/format-import.mjs +34 -0
- package/es/core/handlebars/helpers/format-import-item/format-import-item.d.ts +13 -0
- package/es/core/handlebars/helpers/format-import-item/format-import-item.mjs +30 -0
- package/es/core/handlebars/helpers/format-js-type/format-js-type.d.ts +14 -0
- package/es/core/handlebars/helpers/format-js-type/format-js-type.mjs +34 -0
- package/es/core/handlebars/helpers/gt/gt.d.ts +14 -0
- package/es/core/handlebars/helpers/gt/gt.mjs +12 -0
- package/es/core/handlebars/helpers/gte/gte.d.ts +14 -0
- package/es/core/handlebars/helpers/gte/gte.mjs +12 -0
- package/es/core/handlebars/helpers/helper-base.d.ts +22 -0
- package/es/core/handlebars/helpers/helper-base.mjs +11 -0
- package/es/core/handlebars/helpers/includes/includes.d.ts +13 -0
- package/es/core/handlebars/helpers/includes/includes.mjs +11 -0
- package/es/core/handlebars/helpers/index.d.ts +6 -0
- package/es/core/handlebars/helpers/index.mjs +46 -0
- package/es/core/handlebars/helpers/json/json.d.ts +13 -0
- package/es/core/handlebars/helpers/json/json.mjs +13 -0
- package/es/core/handlebars/helpers/lower-case/lower-case.d.ts +13 -0
- package/es/core/handlebars/helpers/lower-case/lower-case.mjs +12 -0
- package/es/core/handlebars/helpers/lt/lt.d.ts +14 -0
- package/es/core/handlebars/helpers/lt/lt.mjs +12 -0
- package/es/core/handlebars/helpers/lte/lte.d.ts +14 -0
- package/es/core/handlebars/helpers/lte/lte.mjs +12 -0
- package/es/core/handlebars/helpers/neq/neq.d.ts +14 -0
- package/es/core/handlebars/helpers/neq/neq.mjs +12 -0
- package/es/core/handlebars/helpers/not/not.d.ts +14 -0
- package/es/core/handlebars/helpers/not/not.mjs +12 -0
- package/es/core/handlebars/helpers/not-includes/not-includes.d.ts +13 -0
- package/es/core/handlebars/helpers/not-includes/not-includes.mjs +11 -0
- package/es/core/handlebars/helpers/or/or.d.ts +13 -0
- package/es/core/handlebars/helpers/or/or.mjs +16 -0
- package/es/core/handlebars/helpers/pascal-case/pascal-case.d.ts +13 -0
- package/es/core/handlebars/helpers/pascal-case/pascal-case.mjs +13 -0
- package/es/core/handlebars/helpers/snake-case/snake-case.d.ts +13 -0
- package/es/core/handlebars/helpers/snake-case/snake-case.mjs +13 -0
- package/es/core/handlebars/helpers/spinal-case/spinal-case.d.ts +13 -0
- package/es/core/handlebars/helpers/spinal-case/spinal-case.mjs +13 -0
- package/es/core/handlebars/helpers/upper-case/upper-case.d.ts +13 -0
- package/es/core/handlebars/helpers/upper-case/upper-case.mjs +12 -0
- package/es/core/handlebars/index.d.ts +2 -0
- package/es/core/handlebars/index.mjs +2 -0
- package/es/core/handlebars/utils/helper/helper.d.ts +33 -0
- package/es/core/handlebars/utils/helper/helper.mjs +54 -0
- package/es/core/handlebars/utils/index.d.ts +17 -0
- package/es/core/handlebars/utils/index.mjs +7 -0
- package/es/core/index.d.ts +2 -0
- package/es/core/index.mjs +2 -0
- package/es/core/interface/index.d.ts +1 -0
- package/es/core/interface/index.mjs +0 -0
- package/es/index.d.ts +2 -0
- package/es/interface/i-command/i-command.d.ts +22 -0
- package/es/interface/i-command/i-command.mjs +0 -0
- package/es/interface/index.d.ts +1 -0
- package/es/interface/index.mjs +1 -0
- package/es/types/index.d.ts +1 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.mjs +4 -0
- package/es/utils/local-binaries/local-binaries.d.ts +3 -0
- package/es/utils/local-binaries/local-binaries.mjs +11 -0
- package/package.json +29 -47
- package/src/bin.ts +0 -5
- package/src/commands/index.ts +0 -16
- package/src/core/commitlint/commitlint-config/commitlint-config.ts +0 -37
- package/src/core/commitlint/index.ts +0 -1
- package/src/core/constants/index.ts +0 -8
- package/src/core/eslint/eslint-config/eslint-config.ts +0 -122
- package/src/core/eslint/index.ts +0 -1
- package/src/core/index.ts +0 -7
- package/src/core/prettier/index.ts +0 -1
- package/src/core/prettier/prettier-config/prettier-config.ts +0 -48
- package/src/core/rollup/index.ts +0 -2
- package/src/core/rollup/rollup-config/dev-config.ts +0 -135
- package/src/core/rollup/rollup-plugins/copy-file.ts +0 -57
- package/src/core/rollup/rollup-plugins/ignore-compiler-file.ts +0 -25
- package/src/core/rollup/rollup-plugins/index.ts +0 -2
- package/src/core/stylelint/index.ts +0 -1
- package/src/core/stylelint/stylelint-config/stylelint-config.ts +0 -28
- package/src/core/util/index.ts +0 -27
- package/src/core/util/watcher/watcher.ts +0 -129
- package/src/core/vite/index.ts +0 -1
- package/src/core/vite/vite-config/vite-config.ts +0 -59
- package/src/index.ts +0 -36
- package/src/interface/i-command/i-command.ts +0 -29
- package/src/utils/index.ts +0 -4
- package/src/utils/local-binaries/local-binaries.ts +0 -16
- /package/{src/interface/index.ts → dist/interface/index.d.ts} +0 -0
- /package/{src → dist}/types/index.d.ts +0 -0
- /package/{dist → es}/bin.mjs +0 -0
- /package/{dist → es}/index.mjs +0 -0
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { merge } from 'lodash-es';
|
|
2
|
-
import { Config } from 'stylelint';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 基于基础规则,定义 stylelint 配置
|
|
6
|
-
*
|
|
7
|
-
* @export
|
|
8
|
-
* @param {Config} config
|
|
9
|
-
* @returns {*} {Config}
|
|
10
|
-
*/
|
|
11
|
-
export function defineStylelintConfig(config: Config = {}): Config {
|
|
12
|
-
return merge(
|
|
13
|
-
{
|
|
14
|
-
extends: ['stylelint-config-standard', 'stylelint-config-standard-scss'],
|
|
15
|
-
rules: {
|
|
16
|
-
'annotation-no-unknown': null,
|
|
17
|
-
'color-no-invalid-hex': true,
|
|
18
|
-
'function-name-case': null, // 强制样式方法名称小写或大写
|
|
19
|
-
'no-duplicate-selectors': null,
|
|
20
|
-
'selector-class-pattern': null,
|
|
21
|
-
'scss/dollar-variable-pattern': null,
|
|
22
|
-
'scss/at-function-pattern': null,
|
|
23
|
-
'scss/dollar-variable-empty-line-before': null, // 变量声明之间不可以有空白行
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
config,
|
|
27
|
-
);
|
|
28
|
-
}
|
package/src/core/util/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export { CopyWatch } from './watcher/watcher';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* win 路径 \\ 转 linux 路径 /
|
|
5
|
-
*
|
|
6
|
-
* @author chitanda
|
|
7
|
-
* @date 2022-01-19 09:01:23
|
|
8
|
-
* @export
|
|
9
|
-
* @param {string} pathStr
|
|
10
|
-
* @return {*} {string}
|
|
11
|
-
*/
|
|
12
|
-
export function winToUnixPath(pathStr: string): string {
|
|
13
|
-
return pathStr.replace(/\\/g, '/');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* linux 路径 / 转 win 路径 \\
|
|
18
|
-
*
|
|
19
|
-
* @author chitanda
|
|
20
|
-
* @date 2022-01-19 10:01:34
|
|
21
|
-
* @export
|
|
22
|
-
* @param {string} pathStr
|
|
23
|
-
* @return {*} {string}
|
|
24
|
-
*/
|
|
25
|
-
export function unixToWinPath(pathStr: string): string {
|
|
26
|
-
return pathStr.replace(/\//g, '\\');
|
|
27
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import * as chokidar from 'chokidar';
|
|
2
|
-
import fs from 'fs-extra';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import * as rimraf from 'rimraf';
|
|
5
|
-
import { copyFileSync } from 'copy-file';
|
|
6
|
-
import consola from 'consola';
|
|
7
|
-
import colors from 'picocolors';
|
|
8
|
-
import { EventName } from 'chokidar/handler';
|
|
9
|
-
import { merge } from 'lodash-es';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 文件监控类
|
|
13
|
-
*
|
|
14
|
-
* @author chitanda
|
|
15
|
-
* @date 2022-05-24 14:05:22
|
|
16
|
-
* @export
|
|
17
|
-
* @class CopyWatch
|
|
18
|
-
*/
|
|
19
|
-
export class CopyWatch {
|
|
20
|
-
protected w: chokidar.FSWatcher;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Creates an instance of CopyWatch.
|
|
24
|
-
*
|
|
25
|
-
* @author chitanda
|
|
26
|
-
* @date 2022-05-24 14:05:28
|
|
27
|
-
* @param {string[]} dir 需要监控的目录
|
|
28
|
-
* @param {string} copyDir 需要拷贝到的目录
|
|
29
|
-
*/
|
|
30
|
-
constructor(
|
|
31
|
-
public dir: string,
|
|
32
|
-
public copyDir: string,
|
|
33
|
-
opts: chokidar.ChokidarOptions = {},
|
|
34
|
-
) {
|
|
35
|
-
this.w = chokidar.watch(
|
|
36
|
-
this.dir,
|
|
37
|
-
merge(
|
|
38
|
-
{
|
|
39
|
-
awaitWriteFinish: {
|
|
40
|
-
stabilityThreshold: 300, // 等待0.3秒防抖
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
opts,
|
|
44
|
-
),
|
|
45
|
-
);
|
|
46
|
-
consola.debug(`拷贝监控文件夹: ${this.dir}`);
|
|
47
|
-
this.init();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 初始化
|
|
52
|
-
*
|
|
53
|
-
* @author chitanda
|
|
54
|
-
* @date 2022-05-24 14:05:34
|
|
55
|
-
* @protected
|
|
56
|
-
*/
|
|
57
|
-
protected init(): void {
|
|
58
|
-
this.watchAll = this.watchAll.bind(this);
|
|
59
|
-
this.watchErr = this.watchErr.bind(this);
|
|
60
|
-
this.w.on('all', this.watchAll);
|
|
61
|
-
this.w.on('error', this.watchErr);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* 文件监控变更
|
|
66
|
-
*
|
|
67
|
-
* @author chitanda
|
|
68
|
-
* @date 2022-05-24 14:05:18
|
|
69
|
-
* @protected
|
|
70
|
-
* @param {("add" | "addDir" | "change" | "unlink" | "unlinkDir")} eventName
|
|
71
|
-
* @param {string} pathStr
|
|
72
|
-
* @param {(fs.Stats)} [stats]
|
|
73
|
-
*/
|
|
74
|
-
protected watchAll(
|
|
75
|
-
eventName: EventName,
|
|
76
|
-
pathStr: string,
|
|
77
|
-
stats?: fs.Stats,
|
|
78
|
-
): void {
|
|
79
|
-
if (stats && stats.size <= 0) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const cwd = process.cwd();
|
|
83
|
-
const source = path.resolve(cwd, pathStr);
|
|
84
|
-
const target = path.resolve(this.copyDir, path.relative(this.dir, pathStr));
|
|
85
|
-
switch (eventName) {
|
|
86
|
-
case 'add':
|
|
87
|
-
case 'change':
|
|
88
|
-
consola.info(
|
|
89
|
-
`拷贝文件: ${colors.cyan(source)} => ${colors.cyan(target)}`,
|
|
90
|
-
);
|
|
91
|
-
copyFileSync(source, target);
|
|
92
|
-
break;
|
|
93
|
-
case 'addDir':
|
|
94
|
-
break;
|
|
95
|
-
case 'unlink':
|
|
96
|
-
case 'unlinkDir':
|
|
97
|
-
consola.info(`删除文件或目录: ${target}`);
|
|
98
|
-
rimraf.sync(target);
|
|
99
|
-
break;
|
|
100
|
-
default:
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* 文件监控异常
|
|
106
|
-
*
|
|
107
|
-
* @author chitanda
|
|
108
|
-
* @date 2022-05-24 14:05:13
|
|
109
|
-
* @protected
|
|
110
|
-
* @param {string} path
|
|
111
|
-
* @param {(fs.Stats | undefined)} [stats]
|
|
112
|
-
*/
|
|
113
|
-
protected watchErr(err: unknown): void {
|
|
114
|
-
consola.error(`监控文件发生错误: ${err}`);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* 停止监控
|
|
119
|
-
*
|
|
120
|
-
* @author chitanda
|
|
121
|
-
* @date 2022-05-24 14:05:06
|
|
122
|
-
*/
|
|
123
|
-
unwatch(): void {
|
|
124
|
-
this.w.off('all', this.watchAll);
|
|
125
|
-
this.w.off('error', this.watchErr);
|
|
126
|
-
this.w.unwatch(this.dir);
|
|
127
|
-
this.w.close();
|
|
128
|
-
}
|
|
129
|
-
}
|
package/src/core/vite/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { defineViteConfig } from './vite-config/vite-config';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { defineConfig, mergeConfig, UserConfig } from 'vite';
|
|
2
|
-
import vue from '@vitejs/plugin-vue';
|
|
3
|
-
import vueJsx from '@vitejs/plugin-vue-jsx';
|
|
4
|
-
import { babel } from '@rollup/plugin-babel';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import * as rf from 'rimraf';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 构建 vite 通用配置,基于此配置构建其他 vite 配置
|
|
10
|
-
*
|
|
11
|
-
* @export
|
|
12
|
-
* @param {UserConfig} [opts={}]
|
|
13
|
-
* @returns {*} {UserConfig}
|
|
14
|
-
*/
|
|
15
|
-
export function defineViteConfig(opts: UserConfig = {}): UserConfig {
|
|
16
|
-
// 当前脚本执行的工作目录
|
|
17
|
-
const cwd = process.cwd();
|
|
18
|
-
// 编译文件输出目录
|
|
19
|
-
const outDir = path.resolve(cwd, 'dist');
|
|
20
|
-
// 删除历史编译文件
|
|
21
|
-
rf.sync(outDir);
|
|
22
|
-
|
|
23
|
-
return mergeConfig(
|
|
24
|
-
defineConfig({
|
|
25
|
-
build: {
|
|
26
|
-
outDir,
|
|
27
|
-
lib: {
|
|
28
|
-
entry: path.resolve(cwd, 'src/index.ts'),
|
|
29
|
-
formats: ['system', 'cjs'],
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
plugins: [
|
|
33
|
-
vue(),
|
|
34
|
-
vueJsx(),
|
|
35
|
-
babel({
|
|
36
|
-
babelHelpers: 'bundled',
|
|
37
|
-
presets: [
|
|
38
|
-
[
|
|
39
|
-
'@babel/preset-env',
|
|
40
|
-
{
|
|
41
|
-
useBuiltIns: 'usage',
|
|
42
|
-
corejs: 3,
|
|
43
|
-
bugfixes: true,
|
|
44
|
-
babelHelpers: 'bundled',
|
|
45
|
-
targets: {
|
|
46
|
-
chrome: '>=85',
|
|
47
|
-
edge: '>=85',
|
|
48
|
-
firefox: '>=79',
|
|
49
|
-
safari: '>=14.1',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
],
|
|
54
|
-
}),
|
|
55
|
-
],
|
|
56
|
-
}),
|
|
57
|
-
opts,
|
|
58
|
-
);
|
|
59
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { program } from 'commander';
|
|
2
|
-
import { CommandLoader } from './commands';
|
|
3
|
-
import { loadLocalBinCommandLoader, localBinExists } from './utils';
|
|
4
|
-
import pkg from '../package.json' with { type: 'json' };
|
|
5
|
-
|
|
6
|
-
export async function bootstrap(): Promise<void> {
|
|
7
|
-
// 监控 ctrl + c 停止进程,触发 exit 事件
|
|
8
|
-
process.on('SIGINT', () => {
|
|
9
|
-
process.exit();
|
|
10
|
-
});
|
|
11
|
-
// 初始化命令行
|
|
12
|
-
program
|
|
13
|
-
.version(pkg.version, '-v, --version', '查看当前版本')
|
|
14
|
-
.usage('<command> [options]')
|
|
15
|
-
.helpOption('-h, --help', '获取帮助信息')
|
|
16
|
-
.configureOutput({
|
|
17
|
-
// Visibly override write routines as example!
|
|
18
|
-
writeErr: str => process.stdout.write(`[ERR] ${str}`),
|
|
19
|
-
// Highlight errors in color.
|
|
20
|
-
outputError: (str, write) => write(`\x1b[31m${str}\x1b[0m`),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
if (localBinExists()) {
|
|
24
|
-
const localCommandLoader = loadLocalBinCommandLoader();
|
|
25
|
-
localCommandLoader.load(program);
|
|
26
|
-
} else {
|
|
27
|
-
CommandLoader.load(program);
|
|
28
|
-
}
|
|
29
|
-
program.parse(process.argv);
|
|
30
|
-
|
|
31
|
-
if (!process.argv.slice(2).length) {
|
|
32
|
-
program.outputHelp();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export * from './core';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 命令项
|
|
5
|
-
*
|
|
6
|
-
* @author chitanda
|
|
7
|
-
* @date 2021-12-18 15:12:13
|
|
8
|
-
* @export
|
|
9
|
-
* @interface ICommand
|
|
10
|
-
*/
|
|
11
|
-
export interface ICommand {
|
|
12
|
-
/**
|
|
13
|
-
* 加载命令
|
|
14
|
-
*
|
|
15
|
-
* @author chitanda
|
|
16
|
-
* @date 2021-12-18 15:12:22
|
|
17
|
-
* @param {Command} program
|
|
18
|
-
*/
|
|
19
|
-
load(program: Command): void;
|
|
20
|
-
/**
|
|
21
|
-
* 执行行为
|
|
22
|
-
*
|
|
23
|
-
* @author chitanda
|
|
24
|
-
* @date 2021-12-21 16:12:22
|
|
25
|
-
* @param {...unknown[]} args
|
|
26
|
-
* @return {*} {(void | Promise<void>)}
|
|
27
|
-
*/
|
|
28
|
-
action(...args: unknown[]): void | Promise<void>;
|
|
29
|
-
}
|
package/src/utils/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { join, posix } from 'path';
|
|
2
|
-
import fs from 'fs-extra';
|
|
3
|
-
import { CommandLoader } from '../../commands/index';
|
|
4
|
-
|
|
5
|
-
const localBinPathSegments = [process.cwd(), 'node_modules', '@nestjs', 'cli'];
|
|
6
|
-
|
|
7
|
-
export function localBinExists(): boolean {
|
|
8
|
-
return fs.existsSync(join(...localBinPathSegments));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function loadLocalBinCommandLoader(): typeof CommandLoader {
|
|
12
|
-
const path = posix.join(...localBinPathSegments, 'commands');
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
14
|
-
const commandsFile = require(path);
|
|
15
|
-
return commandsFile.CommandLoader;
|
|
16
|
-
}
|
|
File without changes
|
|
File without changes
|
/package/{dist → es}/bin.mjs
RENAMED
|
File without changes
|
/package/{dist → es}/index.mjs
RENAMED
|
File without changes
|