@gct-paas/cli 0.0.1-dev.7.1 → 0.0.1-dev.7.2
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/dist/bin.cjs +5 -0
- package/dist/commands/create-template/create-template.cjs +37 -0
- package/dist/commands/index.cjs +27 -0
- package/dist/commands/update-template/update-template.cjs +25 -0
- package/dist/commands/zip/zip.cjs +16 -0
- package/dist/core/commitlint/commitlint-config/commitlint-config.cjs +15 -0
- package/dist/core/commitlint/index.cjs +12 -0
- package/dist/core/constants/index.cjs +9 -0
- package/dist/core/eslint/eslint-config/eslint-config.cjs +85 -0
- package/dist/core/eslint/index.cjs +12 -0
- package/dist/core/index.cjs +93 -0
- package/dist/core/prettier/index.cjs +12 -0
- package/dist/core/prettier/prettier-config/prettier-config.cjs +29 -0
- package/dist/core/rollup/index.cjs +27 -0
- package/dist/core/rollup/rollup-config/dev-config.cjs +93 -0
- package/dist/core/rollup/rollup-plugins/copy-file.cjs +24 -0
- package/dist/core/rollup/rollup-plugins/ignore-compiler-file.cjs +23 -0
- package/dist/core/rollup/rollup-plugins/index.cjs +19 -0
- package/dist/core/stylelint/index.cjs +12 -0
- package/dist/core/stylelint/stylelint-config/stylelint-config.cjs +24 -0
- package/dist/core/template/actions/create-template.cjs +53 -0
- package/dist/core/template/actions/update-template.cjs +71 -0
- package/dist/core/template/actions/zip.cjs +25 -0
- package/dist/core/template/constant/index.cjs +7 -0
- package/dist/core/template/index.cjs +26 -0
- package/dist/core/util/index.cjs +20 -0
- package/dist/core/util/watcher/watcher.cjs +99 -0
- package/dist/core/vite/index.cjs +45 -0
- package/dist/core/vite/vite-config/vite-base-config.cjs +47 -0
- package/dist/core/vite/vite-config/vite-config.cjs +35 -0
- package/dist/core/vite/vite-config/vite-dev-config.cjs +23 -0
- package/dist/core/vite/vite-config/vite-plugin-config.cjs +97 -0
- package/dist/index.cjs +47 -0
- package/dist/interface/i-command/i-command.cjs +1 -0
- package/dist/interface/index.cjs +16 -0
- package/dist/utils/index.cjs +18 -0
- package/dist/utils/local-binaries/local-binaries.cjs +19 -0
- package/es/bin.d.ts +2 -0
- package/es/commands/create-template/create-template.d.ts +6 -0
- package/es/commands/index.d.ts +5 -0
- package/es/commands/update-template/update-template.d.ts +6 -0
- package/es/commands/zip/zip.d.ts +21 -0
- package/es/core/commitlint/commitlint-config/commitlint-config.d.ts +9 -0
- package/es/core/commitlint/index.d.ts +1 -0
- package/es/core/constants/index.d.ts +12 -0
- package/es/core/eslint/eslint-config/eslint-config.d.ts +9 -0
- package/es/core/eslint/index.d.ts +1 -0
- package/es/core/index.d.ts +8 -0
- package/es/core/prettier/index.d.ts +1 -0
- package/es/core/prettier/prettier-config/prettier-config.d.ts +22 -0
- package/es/core/rollup/index.d.ts +2 -0
- package/es/core/rollup/rollup-config/dev-config.d.ts +9 -0
- package/es/core/rollup/rollup-plugins/copy-file.d.ts +37 -0
- package/es/core/rollup/rollup-plugins/ignore-compiler-file.d.ts +8 -0
- package/es/core/rollup/rollup-plugins/index.d.ts +2 -0
- package/es/core/stylelint/index.d.ts +1 -0
- package/es/core/stylelint/stylelint-config/stylelint-config.d.ts +9 -0
- package/es/core/template/actions/create-template.d.ts +16 -0
- package/es/core/template/actions/update-template.d.ts +18 -0
- package/es/core/template/actions/zip.d.ts +9 -0
- package/es/core/template/constant/index.d.ts +1 -0
- package/es/core/template/index.d.ts +3 -0
- package/es/core/util/index.d.ts +17 -0
- package/es/core/util/watcher/watcher.d.ts +48 -0
- package/es/core/vite/index.d.ts +4 -0
- package/es/core/vite/vite-config/vite-base-config.d.ts +9 -0
- package/es/core/vite/vite-config/vite-config.d.ts +9 -0
- package/es/core/vite/vite-config/vite-dev-config.d.ts +9 -0
- package/es/core/vite/vite-config/vite-plugin-config.d.ts +25 -0
- package/es/index.d.ts +2 -0
- package/es/interface/i-command/i-command.d.ts +22 -0
- package/es/interface/index.d.ts +1 -0
- package/es/types/index.d.ts +1 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/local-binaries/local-binaries.d.ts +3 -0
- package/package.json +12 -3
- /package/{dist → es}/bin.mjs +0 -0
- /package/{dist → es}/commands/create-template/create-template.mjs +0 -0
- /package/{dist → es}/commands/index.mjs +0 -0
- /package/{dist → es}/commands/update-template/update-template.mjs +0 -0
- /package/{dist → es}/commands/zip/zip.mjs +0 -0
- /package/{dist → es}/core/commitlint/commitlint-config/commitlint-config.mjs +0 -0
- /package/{dist → es}/core/commitlint/index.mjs +0 -0
- /package/{dist → es}/core/constants/index.mjs +0 -0
- /package/{dist → es}/core/eslint/eslint-config/eslint-config.mjs +0 -0
- /package/{dist → es}/core/eslint/index.mjs +0 -0
- /package/{dist → es}/core/index.mjs +0 -0
- /package/{dist → es}/core/prettier/index.mjs +0 -0
- /package/{dist → es}/core/prettier/prettier-config/prettier-config.mjs +0 -0
- /package/{dist → es}/core/rollup/index.mjs +0 -0
- /package/{dist → es}/core/rollup/rollup-config/dev-config.mjs +0 -0
- /package/{dist → es}/core/rollup/rollup-plugins/copy-file.mjs +0 -0
- /package/{dist → es}/core/rollup/rollup-plugins/ignore-compiler-file.mjs +0 -0
- /package/{dist → es}/core/rollup/rollup-plugins/index.mjs +0 -0
- /package/{dist → es}/core/stylelint/index.mjs +0 -0
- /package/{dist → es}/core/stylelint/stylelint-config/stylelint-config.mjs +0 -0
- /package/{dist → es}/core/template/actions/create-template.mjs +0 -0
- /package/{dist → es}/core/template/actions/update-template.mjs +0 -0
- /package/{dist → es}/core/template/actions/zip.mjs +0 -0
- /package/{dist → es}/core/template/constant/index.mjs +0 -0
- /package/{dist → es}/core/template/index.mjs +0 -0
- /package/{dist → es}/core/util/index.mjs +0 -0
- /package/{dist → es}/core/util/watcher/watcher.mjs +0 -0
- /package/{dist → es}/core/vite/index.mjs +0 -0
- /package/{dist → es}/core/vite/vite-config/vite-base-config.mjs +0 -0
- /package/{dist → es}/core/vite/vite-config/vite-config.mjs +0 -0
- /package/{dist → es}/core/vite/vite-config/vite-dev-config.mjs +0 -0
- /package/{dist → es}/core/vite/vite-config/vite-plugin-config.mjs +0 -0
- /package/{dist → es}/index.mjs +0 -0
- /package/{dist → es}/interface/i-command/i-command.mjs +0 -0
- /package/{dist → es}/interface/index.mjs +0 -0
- /package/{dist → es}/utils/index.mjs +0 -0
- /package/{dist → es}/utils/local-binaries/local-binaries.mjs +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { ICommand } from '../../interface';
|
|
3
|
+
interface ZipCommandParams {
|
|
4
|
+
/**
|
|
5
|
+
* 待压缩目录
|
|
6
|
+
*
|
|
7
|
+
* @type {string}
|
|
8
|
+
*/
|
|
9
|
+
folder: string;
|
|
10
|
+
/**
|
|
11
|
+
* 输出文件名
|
|
12
|
+
*
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
output: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class ZipCommand implements ICommand {
|
|
18
|
+
load(program: Command): void;
|
|
19
|
+
action(args: ZipCommandParams): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineCommitlintConfig } from './commitlint-config/commitlint-config';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 开发模式标识,匹配环境变量中的 NODE_ENV
|
|
3
|
+
*/
|
|
4
|
+
export declare const DEV_MODE = "development";
|
|
5
|
+
/**
|
|
6
|
+
* 生产编译模式标识,匹配环境变量中的 NODE_ENV
|
|
7
|
+
*/
|
|
8
|
+
export declare const PROD_MODE = "production";
|
|
9
|
+
/**
|
|
10
|
+
* 默认需要忽略编译的外部依赖
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_EXTERNAL: string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ConfigArray, InfiniteDepthConfigWithExtends } from 'typescript-eslint';
|
|
2
|
+
/**
|
|
3
|
+
* 基于基础规则,定义 eslint 配置
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @param {...InfiniteDepthConfigWithExtends[]} configs
|
|
7
|
+
* @returns {*} {ConfigArray}
|
|
8
|
+
*/
|
|
9
|
+
export declare function defineEslintConfig(...configs: InfiniteDepthConfigWithExtends[]): ConfigArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineEslintConfig } from './eslint-config/eslint-config';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { definePrettierConfig } from './prettier-config/prettier-config';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Options } from 'prettier';
|
|
2
|
+
/**
|
|
3
|
+
* 基于基础配置,定义 prettier 配置
|
|
4
|
+
*
|
|
5
|
+
* @description 提交信息规范,提交格式: type: description
|
|
6
|
+
* feat: 新功能(feature)
|
|
7
|
+
* fix: 修补bug
|
|
8
|
+
* docs: 文档(documentation)
|
|
9
|
+
* style: 格式(不影响代码运行的变动)
|
|
10
|
+
* refactor: 重构(即不是新增功能,也不是修改bug的代码变动)
|
|
11
|
+
* test: 增加测试,或测试变更
|
|
12
|
+
* perf : 性能优化
|
|
13
|
+
* revert: 撤销上一次的提交
|
|
14
|
+
* build: 构建工具或构建过程等的变动,如:关联包升级等
|
|
15
|
+
* chore: 其他修改(不在上述类型中的修改)
|
|
16
|
+
* release: 发布新版本
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @param {Options} config
|
|
20
|
+
* @returns {*} {Options}
|
|
21
|
+
*/
|
|
22
|
+
export declare function definePrettierConfig(config?: Options): Options;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as chokidar from 'chokidar';
|
|
2
|
+
/**
|
|
3
|
+
* 文件拷贝插件配置参数
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @interface CopyFilePluginOptions
|
|
7
|
+
*/
|
|
8
|
+
export interface CopyFilePluginOptions {
|
|
9
|
+
/**
|
|
10
|
+
* 源文件
|
|
11
|
+
*
|
|
12
|
+
* @type {string}
|
|
13
|
+
* @memberof CopyFilePluginOptions
|
|
14
|
+
*/
|
|
15
|
+
from: string;
|
|
16
|
+
/**
|
|
17
|
+
* 目标文件
|
|
18
|
+
*
|
|
19
|
+
* @type {string}
|
|
20
|
+
* @memberof CopyFilePluginOptions
|
|
21
|
+
*/
|
|
22
|
+
to: string;
|
|
23
|
+
/**
|
|
24
|
+
* chokidar watch 配置
|
|
25
|
+
*
|
|
26
|
+
* @type {chokidar.ChokidarOptions}
|
|
27
|
+
*/
|
|
28
|
+
opts?: chokidar.ChokidarOptions;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 文件拷贝插件,在开发模式下会监控文件变更,并自动拷贝文件
|
|
32
|
+
*
|
|
33
|
+
* @export
|
|
34
|
+
* @param {CopyFilePluginOptions[]} opts
|
|
35
|
+
* @return {*} {Plugin}
|
|
36
|
+
*/
|
|
37
|
+
export declare function copyFile(opts: CopyFilePluginOptions[]): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defineStylelintConfig } from './stylelint-config/stylelint-config';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 创建模板行为
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @class CreateTemplateAction
|
|
6
|
+
*/
|
|
7
|
+
export declare class CreateTemplateAction {
|
|
8
|
+
/**
|
|
9
|
+
* 创建模板
|
|
10
|
+
*
|
|
11
|
+
* @param {string} cwd 创建模板的路径
|
|
12
|
+
* @param {string} name 生成项目名称
|
|
13
|
+
* @returns {*} {Promise<void>}
|
|
14
|
+
*/
|
|
15
|
+
run(cwd: string, name: string): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 已经出初始化过的插件进行增量更新
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @class UpdateTemplateAction
|
|
6
|
+
*/
|
|
7
|
+
export declare class UpdateTemplateAction {
|
|
8
|
+
run(cwd: string, overwrite: boolean): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* 增量更新文件,对比文件 hash 值进行更新
|
|
11
|
+
*
|
|
12
|
+
* @param {string} cwd 项目更目录
|
|
13
|
+
* @param {string} temp 模板克隆临时目录
|
|
14
|
+
* @param {string} filePath 克隆的文件路径
|
|
15
|
+
* @returns {*} {Promise<void>}
|
|
16
|
+
*/
|
|
17
|
+
updateFile(cwd: string, temp: string, filePath: string): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TEMPLATE_GIT = "https://git.gct-china.com/paas/frontend/paas-comp-template.git";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { CopyWatch } from './watcher/watcher';
|
|
2
|
+
/**
|
|
3
|
+
* win 路径 \\ 转 linux 路径 /
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @param {string} pathStr
|
|
7
|
+
* @return {*} {string}
|
|
8
|
+
*/
|
|
9
|
+
export declare function winToUnixPath(pathStr: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* linux 路径 / 转 win 路径 \\
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @param {string} pathStr
|
|
15
|
+
* @return {*} {string}
|
|
16
|
+
*/
|
|
17
|
+
export declare function unixToWinPath(pathStr: string): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as chokidar from 'chokidar';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import { EventName } from 'chokidar/handler';
|
|
4
|
+
/**
|
|
5
|
+
* 文件监控类
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class CopyWatch
|
|
9
|
+
*/
|
|
10
|
+
export declare class CopyWatch {
|
|
11
|
+
dir: string;
|
|
12
|
+
copyDir: string;
|
|
13
|
+
protected w: chokidar.FSWatcher;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of CopyWatch.
|
|
16
|
+
*
|
|
17
|
+
* @param {string[]} dir 需要监控的目录
|
|
18
|
+
* @param {string} copyDir 需要拷贝到的目录
|
|
19
|
+
*/
|
|
20
|
+
constructor(dir: string, copyDir: string, opts?: chokidar.ChokidarOptions);
|
|
21
|
+
/**
|
|
22
|
+
* 初始化
|
|
23
|
+
*
|
|
24
|
+
* @protected
|
|
25
|
+
*/
|
|
26
|
+
protected init(): void;
|
|
27
|
+
/**
|
|
28
|
+
* 文件监控变更
|
|
29
|
+
*
|
|
30
|
+
* @protected
|
|
31
|
+
* @param {("add" | "addDir" | "change" | "unlink" | "unlinkDir")} eventName
|
|
32
|
+
* @param {string} pathStr
|
|
33
|
+
* @param {(fs.Stats)} [stats]
|
|
34
|
+
*/
|
|
35
|
+
protected watchAll(eventName: EventName, pathStr: string, stats?: fs.Stats): void;
|
|
36
|
+
/**
|
|
37
|
+
* 文件监控异常
|
|
38
|
+
*
|
|
39
|
+
* @protected
|
|
40
|
+
* @param {string} path
|
|
41
|
+
* @param {(fs.Stats | undefined)} [stats]
|
|
42
|
+
*/
|
|
43
|
+
protected watchErr(err: unknown): void;
|
|
44
|
+
/**
|
|
45
|
+
* 停止监控
|
|
46
|
+
*/
|
|
47
|
+
unwatch(): void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { defineViteBaseConfig } from './vite-config/vite-base-config';
|
|
2
|
+
export { defineViteConfig } from './vite-config/vite-config';
|
|
3
|
+
export { defineDevViteConfig } from './vite-config/vite-dev-config';
|
|
4
|
+
export { defineDesignPluginViteConfig, defineMobilePluginViteConfig, defineWebPluginViteConfig, } from './vite-config/vite-plugin-config';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UserConfig } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* 设计端构建配置
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @param {UserConfig} [opts={}]
|
|
7
|
+
* @returns {*} {UserConfig}
|
|
8
|
+
*/
|
|
9
|
+
export declare function defineDesignPluginViteConfig(opts?: UserConfig): UserConfig;
|
|
10
|
+
/**
|
|
11
|
+
* 移动端插件构建配置
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @param {UserConfig} [opts={}]
|
|
15
|
+
* @returns {*} {UserConfig}
|
|
16
|
+
*/
|
|
17
|
+
export declare function defineMobilePluginViteConfig(opts?: UserConfig): UserConfig;
|
|
18
|
+
/**
|
|
19
|
+
* 网页端插件构建配置
|
|
20
|
+
*
|
|
21
|
+
* @export
|
|
22
|
+
* @param {UserConfig} [opts={}]
|
|
23
|
+
* @returns {*} {UserConfig}
|
|
24
|
+
*/
|
|
25
|
+
export declare function defineWebPluginViteConfig(opts?: UserConfig): UserConfig;
|
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* 命令项
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @interface ICommand
|
|
7
|
+
*/
|
|
8
|
+
export interface ICommand {
|
|
9
|
+
/**
|
|
10
|
+
* 加载命令
|
|
11
|
+
*
|
|
12
|
+
* @param {Command} program
|
|
13
|
+
*/
|
|
14
|
+
load(program: Command): void;
|
|
15
|
+
/**
|
|
16
|
+
* 执行行为
|
|
17
|
+
*
|
|
18
|
+
* @param {...unknown[]} args
|
|
19
|
+
* @return {*} {(void | Promise<void>)}
|
|
20
|
+
*/
|
|
21
|
+
action(...args: unknown[]): void | Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './i-command/i-command';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'eslint-plugin-import';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { localBinExists, loadLocalBinCommandLoader, } from './local-binaries/local-binaries';
|
package/package.json
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/cli",
|
|
3
|
-
"version": "0.0.1-dev.7.
|
|
3
|
+
"version": "0.0.1-dev.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"bin": {
|
|
7
|
-
"gct-paas": "
|
|
7
|
+
"gct-paas": "es/bin.mjs"
|
|
8
8
|
},
|
|
9
|
-
"main": "dist/index.
|
|
9
|
+
"main": "dist/index.cjs",
|
|
10
|
+
"module": "es/index.mjs",
|
|
10
11
|
"types": "dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./es/index.d.ts",
|
|
15
|
+
"import": "./es/index.mjs",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
11
19
|
"files": [
|
|
12
20
|
"dist",
|
|
21
|
+
"es",
|
|
13
22
|
"CHANGELOG.md",
|
|
14
23
|
"README.md"
|
|
15
24
|
],
|
/package/{dist → es}/bin.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{dist → es}/index.mjs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|