@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.
Files changed (113) hide show
  1. package/dist/bin.cjs +5 -0
  2. package/dist/commands/create-template/create-template.cjs +37 -0
  3. package/dist/commands/index.cjs +27 -0
  4. package/dist/commands/update-template/update-template.cjs +25 -0
  5. package/dist/commands/zip/zip.cjs +16 -0
  6. package/dist/core/commitlint/commitlint-config/commitlint-config.cjs +15 -0
  7. package/dist/core/commitlint/index.cjs +12 -0
  8. package/dist/core/constants/index.cjs +9 -0
  9. package/dist/core/eslint/eslint-config/eslint-config.cjs +85 -0
  10. package/dist/core/eslint/index.cjs +12 -0
  11. package/dist/core/index.cjs +93 -0
  12. package/dist/core/prettier/index.cjs +12 -0
  13. package/dist/core/prettier/prettier-config/prettier-config.cjs +29 -0
  14. package/dist/core/rollup/index.cjs +27 -0
  15. package/dist/core/rollup/rollup-config/dev-config.cjs +93 -0
  16. package/dist/core/rollup/rollup-plugins/copy-file.cjs +24 -0
  17. package/dist/core/rollup/rollup-plugins/ignore-compiler-file.cjs +23 -0
  18. package/dist/core/rollup/rollup-plugins/index.cjs +19 -0
  19. package/dist/core/stylelint/index.cjs +12 -0
  20. package/dist/core/stylelint/stylelint-config/stylelint-config.cjs +24 -0
  21. package/dist/core/template/actions/create-template.cjs +53 -0
  22. package/dist/core/template/actions/update-template.cjs +71 -0
  23. package/dist/core/template/actions/zip.cjs +25 -0
  24. package/dist/core/template/constant/index.cjs +7 -0
  25. package/dist/core/template/index.cjs +26 -0
  26. package/dist/core/util/index.cjs +20 -0
  27. package/dist/core/util/watcher/watcher.cjs +99 -0
  28. package/dist/core/vite/index.cjs +45 -0
  29. package/dist/core/vite/vite-config/vite-base-config.cjs +47 -0
  30. package/dist/core/vite/vite-config/vite-config.cjs +35 -0
  31. package/dist/core/vite/vite-config/vite-dev-config.cjs +23 -0
  32. package/dist/core/vite/vite-config/vite-plugin-config.cjs +97 -0
  33. package/dist/index.cjs +47 -0
  34. package/dist/interface/i-command/i-command.cjs +1 -0
  35. package/dist/interface/index.cjs +16 -0
  36. package/dist/utils/index.cjs +18 -0
  37. package/dist/utils/local-binaries/local-binaries.cjs +19 -0
  38. package/es/bin.d.ts +2 -0
  39. package/es/commands/create-template/create-template.d.ts +6 -0
  40. package/es/commands/index.d.ts +5 -0
  41. package/es/commands/update-template/update-template.d.ts +6 -0
  42. package/es/commands/zip/zip.d.ts +21 -0
  43. package/es/core/commitlint/commitlint-config/commitlint-config.d.ts +9 -0
  44. package/es/core/commitlint/index.d.ts +1 -0
  45. package/es/core/constants/index.d.ts +12 -0
  46. package/es/core/eslint/eslint-config/eslint-config.d.ts +9 -0
  47. package/es/core/eslint/index.d.ts +1 -0
  48. package/es/core/index.d.ts +8 -0
  49. package/es/core/prettier/index.d.ts +1 -0
  50. package/es/core/prettier/prettier-config/prettier-config.d.ts +22 -0
  51. package/es/core/rollup/index.d.ts +2 -0
  52. package/es/core/rollup/rollup-config/dev-config.d.ts +9 -0
  53. package/es/core/rollup/rollup-plugins/copy-file.d.ts +37 -0
  54. package/es/core/rollup/rollup-plugins/ignore-compiler-file.d.ts +8 -0
  55. package/es/core/rollup/rollup-plugins/index.d.ts +2 -0
  56. package/es/core/stylelint/index.d.ts +1 -0
  57. package/es/core/stylelint/stylelint-config/stylelint-config.d.ts +9 -0
  58. package/es/core/template/actions/create-template.d.ts +16 -0
  59. package/es/core/template/actions/update-template.d.ts +18 -0
  60. package/es/core/template/actions/zip.d.ts +9 -0
  61. package/es/core/template/constant/index.d.ts +1 -0
  62. package/es/core/template/index.d.ts +3 -0
  63. package/es/core/util/index.d.ts +17 -0
  64. package/es/core/util/watcher/watcher.d.ts +48 -0
  65. package/es/core/vite/index.d.ts +4 -0
  66. package/es/core/vite/vite-config/vite-base-config.d.ts +9 -0
  67. package/es/core/vite/vite-config/vite-config.d.ts +9 -0
  68. package/es/core/vite/vite-config/vite-dev-config.d.ts +9 -0
  69. package/es/core/vite/vite-config/vite-plugin-config.d.ts +25 -0
  70. package/es/index.d.ts +2 -0
  71. package/es/interface/i-command/i-command.d.ts +22 -0
  72. package/es/interface/index.d.ts +1 -0
  73. package/es/types/index.d.ts +1 -0
  74. package/es/utils/index.d.ts +1 -0
  75. package/es/utils/local-binaries/local-binaries.d.ts +3 -0
  76. package/package.json +12 -3
  77. /package/{dist → es}/bin.mjs +0 -0
  78. /package/{dist → es}/commands/create-template/create-template.mjs +0 -0
  79. /package/{dist → es}/commands/index.mjs +0 -0
  80. /package/{dist → es}/commands/update-template/update-template.mjs +0 -0
  81. /package/{dist → es}/commands/zip/zip.mjs +0 -0
  82. /package/{dist → es}/core/commitlint/commitlint-config/commitlint-config.mjs +0 -0
  83. /package/{dist → es}/core/commitlint/index.mjs +0 -0
  84. /package/{dist → es}/core/constants/index.mjs +0 -0
  85. /package/{dist → es}/core/eslint/eslint-config/eslint-config.mjs +0 -0
  86. /package/{dist → es}/core/eslint/index.mjs +0 -0
  87. /package/{dist → es}/core/index.mjs +0 -0
  88. /package/{dist → es}/core/prettier/index.mjs +0 -0
  89. /package/{dist → es}/core/prettier/prettier-config/prettier-config.mjs +0 -0
  90. /package/{dist → es}/core/rollup/index.mjs +0 -0
  91. /package/{dist → es}/core/rollup/rollup-config/dev-config.mjs +0 -0
  92. /package/{dist → es}/core/rollup/rollup-plugins/copy-file.mjs +0 -0
  93. /package/{dist → es}/core/rollup/rollup-plugins/ignore-compiler-file.mjs +0 -0
  94. /package/{dist → es}/core/rollup/rollup-plugins/index.mjs +0 -0
  95. /package/{dist → es}/core/stylelint/index.mjs +0 -0
  96. /package/{dist → es}/core/stylelint/stylelint-config/stylelint-config.mjs +0 -0
  97. /package/{dist → es}/core/template/actions/create-template.mjs +0 -0
  98. /package/{dist → es}/core/template/actions/update-template.mjs +0 -0
  99. /package/{dist → es}/core/template/actions/zip.mjs +0 -0
  100. /package/{dist → es}/core/template/constant/index.mjs +0 -0
  101. /package/{dist → es}/core/template/index.mjs +0 -0
  102. /package/{dist → es}/core/util/index.mjs +0 -0
  103. /package/{dist → es}/core/util/watcher/watcher.mjs +0 -0
  104. /package/{dist → es}/core/vite/index.mjs +0 -0
  105. /package/{dist → es}/core/vite/vite-config/vite-base-config.mjs +0 -0
  106. /package/{dist → es}/core/vite/vite-config/vite-config.mjs +0 -0
  107. /package/{dist → es}/core/vite/vite-config/vite-dev-config.mjs +0 -0
  108. /package/{dist → es}/core/vite/vite-config/vite-plugin-config.mjs +0 -0
  109. /package/{dist → es}/index.mjs +0 -0
  110. /package/{dist → es}/interface/i-command/i-command.mjs +0 -0
  111. /package/{dist → es}/interface/index.mjs +0 -0
  112. /package/{dist → es}/utils/index.mjs +0 -0
  113. /package/{dist → es}/utils/local-binaries/local-binaries.mjs +0 -0
@@ -0,0 +1,6 @@
1
+ import { Command } from 'commander';
2
+ import { ICommand } from '../../interface';
3
+ export declare class CreateTemplateCommand implements ICommand {
4
+ load(program: Command): void;
5
+ action(): Promise<void>;
6
+ }
@@ -0,0 +1,5 @@
1
+ import { Command } from 'commander';
2
+ export declare class CommandLoader {
3
+ static load(program: Command): void;
4
+ private static handleInvalidCommand;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { Command } from 'commander';
2
+ import { ICommand } from '../../interface';
3
+ export declare class UpdateTemplateCommand implements ICommand {
4
+ load(program: Command): void;
5
+ action(): Promise<void>;
6
+ }
@@ -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,9 @@
1
+ import type { UserConfig } from '@commitlint/types';
2
+ /**
3
+ * 基于基础配置,定义 commitlint 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [config={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineCommitlintConfig(config?: UserConfig): UserConfig;
@@ -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,8 @@
1
+ export * from './commitlint';
2
+ export * from './eslint';
3
+ export * from './prettier';
4
+ export * from './rollup';
5
+ export * from './stylelint';
6
+ export * from './template';
7
+ export * from './util';
8
+ export * from './vite';
@@ -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,2 @@
1
+ export { defineRollupConfig } from './rollup-config/dev-config';
2
+ export * from './rollup-plugins';
@@ -0,0 +1,9 @@
1
+ import { RollupOptions } from 'rollup';
2
+ /**
3
+ * 开发包基础编译配置
4
+ *
5
+ * @export
6
+ * @param {RollupOptions} [opts={}]
7
+ * @returns {*} {RollupOptions}
8
+ */
9
+ export declare function defineRollupConfig(opts?: RollupOptions): RollupOptions;
@@ -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,8 @@
1
+ import { Plugin } from 'rollup';
2
+ /**
3
+ * 忽略编译的文件类型
4
+ *
5
+ * @export
6
+ * @returns {*} {Plugin}
7
+ */
8
+ export declare function ignoreCompilerFile(extReg: RegExp): Plugin;
@@ -0,0 +1,2 @@
1
+ export { copyFile } from './copy-file';
2
+ export { ignoreCompilerFile } from './ignore-compiler-file';
@@ -0,0 +1 @@
1
+ export { defineStylelintConfig } from './stylelint-config/stylelint-config';
@@ -0,0 +1,9 @@
1
+ import { Config } from 'stylelint';
2
+ /**
3
+ * 基于基础规则,定义 stylelint 配置
4
+ *
5
+ * @export
6
+ * @param {Config} config
7
+ * @returns {*} {Config}
8
+ */
9
+ export declare function defineStylelintConfig(config?: Config): 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,9 @@
1
+ /**
2
+ * 压缩文件夹
3
+ *
4
+ * @export
5
+ * @class ZipAction
6
+ */
7
+ export declare class ZipAction {
8
+ run(cwd: string, folder?: string, outFile?: string): Promise<void>;
9
+ }
@@ -0,0 +1 @@
1
+ export declare const TEMPLATE_GIT = "https://git.gct-china.com/paas/frontend/paas-comp-template.git";
@@ -0,0 +1,3 @@
1
+ export { CreateTemplateAction } from './actions/create-template';
2
+ export { UpdateTemplateAction } from './actions/update-template';
3
+ export { ZipAction } from './actions/zip';
@@ -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,9 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * 构建 vite 通用配置,基于此配置构建其他 vite 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [opts={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineViteBaseConfig(opts?: UserConfig): UserConfig;
@@ -0,0 +1,9 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * 构建 vite 通用配置,基于此配置构建其他 vite 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [opts={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineViteConfig(opts?: UserConfig): UserConfig;
@@ -0,0 +1,9 @@
1
+ import { UserConfig } from 'vite';
2
+ /**
3
+ * 构建本地开发 vite 通用配置,基于此配置构建其他 vite 配置
4
+ *
5
+ * @export
6
+ * @param {UserConfig} [opts={}]
7
+ * @returns {*} {UserConfig}
8
+ */
9
+ export declare function defineDevViteConfig(opts?: UserConfig): UserConfig;
@@ -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,2 @@
1
+ export declare function bootstrap(): Promise<void>;
2
+ export * from './core';
@@ -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';
@@ -0,0 +1,3 @@
1
+ import { CommandLoader } from '../../commands/index';
2
+ export declare function localBinExists(): boolean;
3
+ export declare function loadLocalBinCommandLoader(): typeof CommandLoader;
package/package.json CHANGED
@@ -1,15 +1,24 @@
1
1
  {
2
2
  "name": "@gct-paas/cli",
3
- "version": "0.0.1-dev.7.1",
3
+ "version": "0.0.1-dev.7.2",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "bin": {
7
- "gct-paas": "dist/bin.mjs"
7
+ "gct-paas": "es/bin.mjs"
8
8
  },
9
- "main": "dist/index.mjs",
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
  ],
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