@gct-paas/cli 0.1.6-dev.1 → 0.1.6-dev.11

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.
@@ -57,7 +57,7 @@ class ModelManage {
57
57
  };
58
58
  } else if (param.name === "file") {
59
59
  requestEntity = {
60
- title: "FormData"
60
+ title: "UploadFileData"
61
61
  };
62
62
  } else {
63
63
  const refKey = this.getOriginRef(param.schema);
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GenCdnLibAction = void 0;
7
+ var _pacote = _interopRequireDefault(require("pacote"));
8
+ var _path = _interopRequireDefault(require("path"));
9
+ var _fsExtra = _interopRequireDefault(require("fs-extra"));
10
+ var _consola = _interopRequireDefault(require("consola"));
11
+ var _listr = require("listr2");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ class GenCdnLibAction {
14
+ packages = ["@gct-paas/api", "@gct-paas/core", "@gct-paas/core-mobile", "@gct-paas/core-pad", "@gct-paas/core-web", "@gct-paas/design", "@gct-paas/design-mobile", "@gct-paas/design-pad", "@gct-paas/design-web", "@gct-paas/native", "@gct-paas/render", "@gct-paas/render-mobile", "@gct-paas/render-pad", "@gct-paas/render-web", "@gct-paas/schema", "@gct-paas/v-ben"];
15
+ /**
16
+ * 下载指定包并复制到外部依赖目录,返回入口文件名;若找不到入口文件则返回空字符串
17
+ */
18
+ async downloadPkg(pkg, pkgInfo, opts, extraDir, extractCacheDir, cacheDir) {
19
+ const _dlCacheDir = _path.default.join(extractCacheDir, pkgInfo.name, pkgInfo.version);
20
+ await _pacote.default.extract(pkgInfo.dist.tarball, _dlCacheDir, {
21
+ registry: opts.registry,
22
+ cache: cacheDir
23
+ });
24
+ const localPkgJson = _fsExtra.default.readJSONSync(_path.default.join(_dlCacheDir, "package.json"));
25
+ const loaderField = localPkgJson.loader;
26
+ if (!loaderField) return "";
27
+ if (!opts.noFiles) {
28
+ const sourceDistPath = _path.default.join(_dlCacheDir, "dist");
29
+ if (opts.clean) {
30
+ const extractPkgPath = _path.default.join(extraDir, pkgInfo.name);
31
+ if (_fsExtra.default.existsSync(extractPkgPath)) {
32
+ _fsExtra.default.removeSync(extractPkgPath);
33
+ }
34
+ }
35
+ const extractPath = _path.default.join(extraDir, pkgInfo.name);
36
+ _fsExtra.default.copySync(sourceDistPath, extractPath, {
37
+ overwrite: true
38
+ });
39
+ }
40
+ return _path.default.basename(loaderField);
41
+ }
42
+ async run(opts) {
43
+ const cwd = process.cwd();
44
+ const extraDir = opts.dir ? _path.default.resolve(cwd, opts.dir) : cwd;
45
+ const extraDirName = _path.default.basename(extraDir);
46
+ if (!_fsExtra.default.existsSync(extraDir)) {
47
+ _fsExtra.default.mkdirSync(extraDir, {
48
+ recursive: true
49
+ });
50
+ }
51
+ const cacheDir = opts.cache ? _path.default.resolve(cwd, opts.cache) : _path.default.join(extraDir, ".cache");
52
+ const extractCacheDir = _path.default.join(cacheDir, "tmp");
53
+ const importMapJsonPath = opts.jsonPath ? _path.default.resolve(cwd, opts.jsonPath) : _path.default.join(extraDir, "import-map.json");
54
+ if (!_fsExtra.default.existsSync(importMapJsonPath)) {
55
+ _consola.default.warn(`import-map.json \u6587\u4EF6\u4E0D\u5B58\u5728\u4E8E ${importMapJsonPath}\uFF0C\u8BF7\u786E\u4FDD\u8DEF\u5F84\u6B63\u786E\u6216\u4F7F\u7528 --jsonPath \u53C2\u6570\u6307\u5B9A\u6B63\u786E\u8DEF\u5F84`);
56
+ return;
57
+ }
58
+ _consola.default.info("\u6B63\u5728\u8BFB\u53D6 import-map.json...");
59
+ const importMap = _fsExtra.default.readJSONSync(importMapJsonPath);
60
+ const tasks = new _listr.Listr(this.packages.map(pkg => ({
61
+ title: `${pkg}@${opts.tag}`,
62
+ task: async (_, task) => {
63
+ task.title = `${pkg}@${opts.tag} \u83B7\u53D6\u5305\u4FE1\u606F...`;
64
+ const pkgInfo = await _pacote.default.manifest(`${pkg}@${opts.tag}`, {
65
+ registry: opts.registry,
66
+ cache: cacheDir
67
+ });
68
+ task.title = `${pkg}@${pkgInfo.version} \u4E0B\u8F7D\u4E2D...`;
69
+ const entryName = await this.downloadPkg(pkg, pkgInfo, opts, extraDir, extractCacheDir, cacheDir);
70
+ if (!entryName) {
71
+ task.skip("package.json \u4E2D\u6CA1\u6709 loader \u5B57\u6BB5\uFF0C\u5DF2\u8DF3\u8FC7");
72
+ return;
73
+ }
74
+ importMap.imports[pkg] = `/${extraDirName}/${pkgInfo.name}/${entryName}`;
75
+ task.title = `${pkg}@${pkgInfo.version}`;
76
+ }
77
+ })), {
78
+ concurrent: true
79
+ });
80
+ await tasks.run();
81
+ const timestamp = Date.now();
82
+ for (const key in importMap.imports) {
83
+ if (importMap.imports[key].includes("?t=")) {
84
+ importMap.imports[key] = importMap.imports[key].replace(/\?t=\d+/, `?t=${timestamp}`);
85
+ } else {
86
+ importMap.imports[key] = `${importMap.imports[key]}?t=${timestamp}`;
87
+ }
88
+ }
89
+ _fsExtra.default.writeJSONSync(importMapJsonPath, importMap, {
90
+ spaces: 2
91
+ });
92
+ if (opts.cleanCache && _fsExtra.default.existsSync(cacheDir)) {
93
+ _consola.default.info(`\u6B63\u5728\u5220\u9664\u7F13\u5B58\u76EE\u5F55: ${cacheDir}`);
94
+ _fsExtra.default.removeSync(cacheDir);
95
+ }
96
+ _consola.default.success("CDN \u5E93\u6587\u4EF6\u751F\u6210\u6210\u529F\uFF01");
97
+ }
98
+ }
99
+ exports.GenCdnLibAction = GenCdnLibAction;
@@ -0,0 +1,15 @@
1
+ import { IGenCdnLibOptions } from '../../interface';
2
+ /**
3
+ * 使用 pacote 从 npm 上下载制定包,至本地 cdn 项目目录,然后修改 import-map.json 文件,适配新包的版本号
4
+ *
5
+ * @export
6
+ * @class GenCdnLibAction
7
+ */
8
+ export declare class GenCdnLibAction {
9
+ private packages;
10
+ /**
11
+ * 下载指定包并复制到外部依赖目录,返回入口文件名;若找不到入口文件则返回空字符串
12
+ */
13
+ private downloadPkg;
14
+ run(opts: IGenCdnLibOptions): Promise<void>;
15
+ }
@@ -9,4 +9,11 @@ Object.defineProperty(exports, "GenApiAction", {
9
9
  return _genApi.GenApiAction;
10
10
  }
11
11
  });
12
- var _genApi = require("./gen-api/gen-api.cjs");
12
+ Object.defineProperty(exports, "GenCdnLibAction", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _genCdnLib.GenCdnLibAction;
16
+ }
17
+ });
18
+ var _genApi = require("./gen-api/gen-api.cjs");
19
+ var _genCdnLib = require("./gen-cdn-lib/gen-cdn-lib.cjs");
@@ -1 +1,2 @@
1
1
  export { GenApiAction } from './gen-api/gen-api';
2
+ export { GenCdnLibAction } from './gen-cdn-lib/gen-cdn-lib';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GenCdnLibCommand = void 0;
7
+ var _actions = require("../../actions/index.cjs");
8
+ class GenCdnLibCommand {
9
+ load(program) {
10
+ program.command("gen-cdn-lib").description("\u751F\u6210 cdn \u5E93\u6587\u4EF6").option("--tag <tag>", "\u6307\u5B9A\u4E0B\u8F7D\u7684\u7248\u672C\u6807\u7B7E(latest | dev | beta | alpha)\uFF0C\u9ED8\u8BA4\u4E3A latest", "latest").option("--dir <dir>", "\u6307\u5B9A\u8F93\u51FA\u76EE\u5F55\uFF0C\u672A\u6307\u5B9A\u65F6\u9ED8\u8BA4\u4E3A\u5F53\u524D\u6267\u884C\u76EE\u5F55").option("--jsonPath <jsonPath>", "\u6307\u5B9A import-map.json \u6587\u4EF6\u8DEF\u5F84\uFF0C\u672A\u5236\u5B9A\u9ED8\u8BA4\u4F7F\u7528\u6307\u5B9A\u7684 dir \u76EE\u5F55\u4E0B\u7684 import-map.json \u6587\u4EF6").option("--clean", "\u662F\u5426\u6E05\u7406\u8F93\u51FA\u76EE\u5F55\u540E\u518D\u751F\u6210").option("--registry <registry>", "\u6307\u5B9A npm registry \u5730\u5740\uFF0C\u672A\u6307\u5B9A\u65F6\u4F7F\u7528\u9ED8\u8BA4 registry").option("--cache <cache>", "\u6307\u5B9A pacote \u7F13\u5B58\u76EE\u5F55\uFF0C\u672A\u6307\u5B9A\u65F6\u4F7F\u7528\u9ED8\u8BA4\u7F13\u5B58\u76EE\u5F55").option("--cleanCache", "\u6E05\u7406\u7F13\u5B58\u76EE\u5F55\uFF0C\u9ED8\u8BA4\u4E3A false", false).option("--noFiles", "\u662F\u5426\u53EA\u751F\u6210 import-map.json \u6587\u4EF6\u800C\u4E0D\u4E0B\u8F7D\u5305\u6587\u4EF6\uFF0C\u9ED8\u8BA4\u4E3A false", false).action(this.action.bind(this));
11
+ }
12
+ async action(args) {
13
+ await new _actions.GenCdnLibAction().run(args);
14
+ }
15
+ }
16
+ exports.GenCdnLibCommand = GenCdnLibCommand;
@@ -0,0 +1,6 @@
1
+ import { Command } from 'commander';
2
+ import { ICommand, IGenCdnLibOptions } from '../../interface';
3
+ export declare class GenCdnLibCommand implements ICommand {
4
+ load(program: Command): void;
5
+ action(args: IGenCdnLibOptions): Promise<void>;
6
+ }
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.CommandLoader = void 0;
7
7
  var _consola = require("consola");
8
8
  var _genApi = require("./gen-api/gen-api.cjs");
9
+ var _genCdnLib = require("./gen-cdn-lib/gen-cdn-lib.cjs");
9
10
  class CommandLoader {
10
11
  static load(program) {
11
12
  new _genApi.GenApiCommand().load(program);
13
+ new _genCdnLib.GenCdnLibCommand().load(program);
12
14
  this.handleInvalidCommand(program);
13
15
  }
14
16
  static handleInvalidCommand(program) {
@@ -0,0 +1,58 @@
1
+ /**
2
+ * 生成 cdn 库文件命令参数接口
3
+ *
4
+ * @export
5
+ * @interface IGenCdnLibOptions
6
+ */
7
+ export interface IGenCdnLibOptions {
8
+ /**
9
+ * 制定下载的版本标签,默认为 latest
10
+ *
11
+ * @default 'latest'
12
+ * @type {string}
13
+ */
14
+ tag: string;
15
+ /**
16
+ * 要输出的 extras 资源目录,未指定时默认为当前执行目录
17
+ *
18
+ * @type {string}
19
+ */
20
+ dir?: string;
21
+ /**
22
+ * 指定 import-map.json 文件路径,未制定默认使用指定的 dir 目录下的 import-map.json 文件
23
+ *
24
+ * @type {string}
25
+ */
26
+ jsonPath?: string;
27
+ /**
28
+ * 是否只生成 import-map.json 文件而不下载包文件,默认为 false
29
+ *
30
+ * @type {boolean}
31
+ */
32
+ noFiles?: boolean;
33
+ /**
34
+ * 是否清理输出目录后再生成
35
+ *
36
+ * @type {boolean}
37
+ */
38
+ clean?: boolean;
39
+ /**
40
+ * 指定 npm registry 地址,未指定时使用默认 registry
41
+ *
42
+ * @type {string}
43
+ */
44
+ registry?: string;
45
+ /**
46
+ * 指定 pacote 缓存目录,未指定时使用默认缓存目录
47
+ *
48
+ * @type {string}
49
+ */
50
+ cache?: string;
51
+ /**
52
+ * 清理缓存目录,默认为 false
53
+ *
54
+ * @default false
55
+ * @type {boolean}
56
+ */
57
+ cleanCache?: boolean;
58
+ }
@@ -1 +1,2 @@
1
1
  export * from './i-command/i-command';
2
+ export type { IGenCdnLibOptions } from './i-gen-cdn-lib-options/i-gen-cdn-lib-options';
@@ -56,7 +56,7 @@ export class ModelManage {
56
56
  if (param.name === "requestBody") {
57
57
  requestEntity = { title: "IObject" };
58
58
  } else if (param.name === "file") {
59
- requestEntity = { title: "FormData" };
59
+ requestEntity = { title: "UploadFileData" };
60
60
  } else {
61
61
  const refKey = this.getOriginRef(param.schema);
62
62
  requestEntity = cfg.definitions[refKey];
@@ -0,0 +1,15 @@
1
+ import { IGenCdnLibOptions } from '../../interface';
2
+ /**
3
+ * 使用 pacote 从 npm 上下载制定包,至本地 cdn 项目目录,然后修改 import-map.json 文件,适配新包的版本号
4
+ *
5
+ * @export
6
+ * @class GenCdnLibAction
7
+ */
8
+ export declare class GenCdnLibAction {
9
+ private packages;
10
+ /**
11
+ * 下载指定包并复制到外部依赖目录,返回入口文件名;若找不到入口文件则返回空字符串
12
+ */
13
+ private downloadPkg;
14
+ run(opts: IGenCdnLibOptions): Promise<void>;
15
+ }
@@ -0,0 +1,105 @@
1
+ import pacote from "pacote";
2
+ import path from "path";
3
+ import fse from "fs-extra";
4
+ import log from "consola";
5
+ import { Listr } from "listr2";
6
+ export class GenCdnLibAction {
7
+ packages = [
8
+ "@gct-paas/api",
9
+ "@gct-paas/core",
10
+ "@gct-paas/core-mobile",
11
+ "@gct-paas/core-pad",
12
+ "@gct-paas/core-web",
13
+ "@gct-paas/design",
14
+ "@gct-paas/design-mobile",
15
+ "@gct-paas/design-pad",
16
+ "@gct-paas/design-web",
17
+ "@gct-paas/native",
18
+ "@gct-paas/render",
19
+ "@gct-paas/render-mobile",
20
+ "@gct-paas/render-pad",
21
+ "@gct-paas/render-web",
22
+ "@gct-paas/schema",
23
+ "@gct-paas/v-ben"
24
+ ];
25
+ /**
26
+ * 下载指定包并复制到外部依赖目录,返回入口文件名;若找不到入口文件则返回空字符串
27
+ */
28
+ async downloadPkg(pkg, pkgInfo, opts, extraDir, extractCacheDir, cacheDir) {
29
+ const _dlCacheDir = path.join(extractCacheDir, pkgInfo.name, pkgInfo.version);
30
+ await pacote.extract(pkgInfo.dist.tarball, _dlCacheDir, {
31
+ registry: opts.registry,
32
+ cache: cacheDir
33
+ });
34
+ const localPkgJson = fse.readJSONSync(path.join(_dlCacheDir, "package.json"));
35
+ const loaderField = localPkgJson.loader;
36
+ if (!loaderField) return "";
37
+ if (!opts.noFiles) {
38
+ const sourceDistPath = path.join(_dlCacheDir, "dist");
39
+ if (opts.clean) {
40
+ const extractPkgPath = path.join(extraDir, pkgInfo.name);
41
+ if (fse.existsSync(extractPkgPath)) {
42
+ fse.removeSync(extractPkgPath);
43
+ }
44
+ }
45
+ const extractPath = path.join(extraDir, pkgInfo.name);
46
+ fse.copySync(sourceDistPath, extractPath, { overwrite: true });
47
+ }
48
+ return path.basename(loaderField);
49
+ }
50
+ async run(opts) {
51
+ const cwd = process.cwd();
52
+ const extraDir = opts.dir ? path.resolve(cwd, opts.dir) : cwd;
53
+ const extraDirName = path.basename(extraDir);
54
+ if (!fse.existsSync(extraDir)) {
55
+ fse.mkdirSync(extraDir, { recursive: true });
56
+ }
57
+ const cacheDir = opts.cache ? path.resolve(cwd, opts.cache) : path.join(extraDir, ".cache");
58
+ const extractCacheDir = path.join(cacheDir, "tmp");
59
+ const importMapJsonPath = opts.jsonPath ? path.resolve(cwd, opts.jsonPath) : path.join(extraDir, "import-map.json");
60
+ if (!fse.existsSync(importMapJsonPath)) {
61
+ log.warn(
62
+ `import-map.json \u6587\u4EF6\u4E0D\u5B58\u5728\u4E8E ${importMapJsonPath}\uFF0C\u8BF7\u786E\u4FDD\u8DEF\u5F84\u6B63\u786E\u6216\u4F7F\u7528 --jsonPath \u53C2\u6570\u6307\u5B9A\u6B63\u786E\u8DEF\u5F84`
63
+ );
64
+ return;
65
+ }
66
+ log.info("\u6B63\u5728\u8BFB\u53D6 import-map.json...");
67
+ const importMap = fse.readJSONSync(importMapJsonPath);
68
+ const tasks = new Listr(
69
+ this.packages.map((pkg) => ({
70
+ title: `${pkg}@${opts.tag}`,
71
+ task: async (_, task) => {
72
+ task.title = `${pkg}@${opts.tag} \u83B7\u53D6\u5305\u4FE1\u606F...`;
73
+ const pkgInfo = await pacote.manifest(`${pkg}@${opts.tag}`, {
74
+ registry: opts.registry,
75
+ cache: cacheDir
76
+ });
77
+ task.title = `${pkg}@${pkgInfo.version} \u4E0B\u8F7D\u4E2D...`;
78
+ const entryName = await this.downloadPkg(pkg, pkgInfo, opts, extraDir, extractCacheDir, cacheDir);
79
+ if (!entryName) {
80
+ task.skip("package.json \u4E2D\u6CA1\u6709 loader \u5B57\u6BB5\uFF0C\u5DF2\u8DF3\u8FC7");
81
+ return;
82
+ }
83
+ importMap.imports[pkg] = `/${extraDirName}/${pkgInfo.name}/${entryName}`;
84
+ task.title = `${pkg}@${pkgInfo.version}`;
85
+ }
86
+ })),
87
+ { concurrent: true }
88
+ );
89
+ await tasks.run();
90
+ const timestamp = Date.now();
91
+ for (const key in importMap.imports) {
92
+ if (importMap.imports[key].includes("?t=")) {
93
+ importMap.imports[key] = importMap.imports[key].replace(/\?t=\d+/, `?t=${timestamp}`);
94
+ } else {
95
+ importMap.imports[key] = `${importMap.imports[key]}?t=${timestamp}`;
96
+ }
97
+ }
98
+ fse.writeJSONSync(importMapJsonPath, importMap, { spaces: 2 });
99
+ if (opts.cleanCache && fse.existsSync(cacheDir)) {
100
+ log.info(`\u6B63\u5728\u5220\u9664\u7F13\u5B58\u76EE\u5F55: ${cacheDir}`);
101
+ fse.removeSync(cacheDir);
102
+ }
103
+ log.success("CDN \u5E93\u6587\u4EF6\u751F\u6210\u6210\u529F\uFF01");
104
+ }
105
+ }
@@ -1 +1,2 @@
1
1
  export { GenApiAction } from './gen-api/gen-api';
2
+ export { GenCdnLibAction } from './gen-cdn-lib/gen-cdn-lib';
@@ -1 +1,2 @@
1
1
  export { GenApiAction } from "./gen-api/gen-api.mjs";
2
+ export { GenCdnLibAction } from "./gen-cdn-lib/gen-cdn-lib.mjs";
@@ -0,0 +1,6 @@
1
+ import { Command } from 'commander';
2
+ import { ICommand, IGenCdnLibOptions } from '../../interface';
3
+ export declare class GenCdnLibCommand implements ICommand {
4
+ load(program: Command): void;
5
+ action(args: IGenCdnLibOptions): Promise<void>;
6
+ }
@@ -0,0 +1,11 @@
1
+ import { GenCdnLibAction } from "../../actions/index.mjs";
2
+ export class GenCdnLibCommand {
3
+ load(program) {
4
+ program.command("gen-cdn-lib").description("\u751F\u6210 cdn \u5E93\u6587\u4EF6").option("--tag <tag>", "\u6307\u5B9A\u4E0B\u8F7D\u7684\u7248\u672C\u6807\u7B7E(latest | dev | beta | alpha)\uFF0C\u9ED8\u8BA4\u4E3A latest", "latest").option("--dir <dir>", "\u6307\u5B9A\u8F93\u51FA\u76EE\u5F55\uFF0C\u672A\u6307\u5B9A\u65F6\u9ED8\u8BA4\u4E3A\u5F53\u524D\u6267\u884C\u76EE\u5F55").option("--jsonPath <jsonPath>", "\u6307\u5B9A import-map.json \u6587\u4EF6\u8DEF\u5F84\uFF0C\u672A\u5236\u5B9A\u9ED8\u8BA4\u4F7F\u7528\u6307\u5B9A\u7684 dir \u76EE\u5F55\u4E0B\u7684 import-map.json \u6587\u4EF6").option("--clean", "\u662F\u5426\u6E05\u7406\u8F93\u51FA\u76EE\u5F55\u540E\u518D\u751F\u6210").option("--registry <registry>", "\u6307\u5B9A npm registry \u5730\u5740\uFF0C\u672A\u6307\u5B9A\u65F6\u4F7F\u7528\u9ED8\u8BA4 registry").option("--cache <cache>", "\u6307\u5B9A pacote \u7F13\u5B58\u76EE\u5F55\uFF0C\u672A\u6307\u5B9A\u65F6\u4F7F\u7528\u9ED8\u8BA4\u7F13\u5B58\u76EE\u5F55").option("--cleanCache", "\u6E05\u7406\u7F13\u5B58\u76EE\u5F55\uFF0C\u9ED8\u8BA4\u4E3A false", false).option("--noFiles", "\u662F\u5426\u53EA\u751F\u6210 import-map.json \u6587\u4EF6\u800C\u4E0D\u4E0B\u8F7D\u5305\u6587\u4EF6\uFF0C\u9ED8\u8BA4\u4E3A false", false).action(this.action.bind(this));
5
+ }
6
+ async action(args) {
7
+ await new GenCdnLibAction().run(
8
+ args
9
+ );
10
+ }
11
+ }
@@ -1,8 +1,10 @@
1
1
  import { consola } from "consola";
2
2
  import { GenApiCommand } from "./gen-api/gen-api.mjs";
3
+ import { GenCdnLibCommand } from "./gen-cdn-lib/gen-cdn-lib.mjs";
3
4
  export class CommandLoader {
4
5
  static load(program) {
5
6
  new GenApiCommand().load(program);
7
+ new GenCdnLibCommand().load(program);
6
8
  this.handleInvalidCommand(program);
7
9
  }
8
10
  static handleInvalidCommand(program) {
@@ -0,0 +1,58 @@
1
+ /**
2
+ * 生成 cdn 库文件命令参数接口
3
+ *
4
+ * @export
5
+ * @interface IGenCdnLibOptions
6
+ */
7
+ export interface IGenCdnLibOptions {
8
+ /**
9
+ * 制定下载的版本标签,默认为 latest
10
+ *
11
+ * @default 'latest'
12
+ * @type {string}
13
+ */
14
+ tag: string;
15
+ /**
16
+ * 要输出的 extras 资源目录,未指定时默认为当前执行目录
17
+ *
18
+ * @type {string}
19
+ */
20
+ dir?: string;
21
+ /**
22
+ * 指定 import-map.json 文件路径,未制定默认使用指定的 dir 目录下的 import-map.json 文件
23
+ *
24
+ * @type {string}
25
+ */
26
+ jsonPath?: string;
27
+ /**
28
+ * 是否只生成 import-map.json 文件而不下载包文件,默认为 false
29
+ *
30
+ * @type {boolean}
31
+ */
32
+ noFiles?: boolean;
33
+ /**
34
+ * 是否清理输出目录后再生成
35
+ *
36
+ * @type {boolean}
37
+ */
38
+ clean?: boolean;
39
+ /**
40
+ * 指定 npm registry 地址,未指定时使用默认 registry
41
+ *
42
+ * @type {string}
43
+ */
44
+ registry?: string;
45
+ /**
46
+ * 指定 pacote 缓存目录,未指定时使用默认缓存目录
47
+ *
48
+ * @type {string}
49
+ */
50
+ cache?: string;
51
+ /**
52
+ * 清理缓存目录,默认为 false
53
+ *
54
+ * @default false
55
+ * @type {boolean}
56
+ */
57
+ cleanCache?: boolean;
58
+ }
@@ -1 +1,2 @@
1
1
  export * from './i-command/i-command';
2
+ export type { IGenCdnLibOptions } from './i-gen-cdn-lib-options/i-gen-cdn-lib-options';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/cli",
3
- "version": "0.1.6-dev.1",
3
+ "version": "0.1.6-dev.11",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "bin": {
@@ -34,7 +34,7 @@
34
34
  "license": "MIT",
35
35
  "author": "gct",
36
36
  "scripts": {
37
- "run": "tsx src/bin.ts",
37
+ "run": "tsx src/bin.ts gen-cdn-lib --tag=dev --dir=/Users/zhr/workspace/gct/gct-paas-cdn/extras",
38
38
  "build": "unbuild",
39
39
  "publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
40
40
  "publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
@@ -52,8 +52,10 @@
52
52
  "got": "^14.6.6",
53
53
  "handlebars": "^4.7.8",
54
54
  "handlebars-helpers": "^0.10.0",
55
+ "listr2": "^10.2.1",
55
56
  "lodash-es": "^4.17.23",
56
57
  "ora": "^9.1.0",
58
+ "pacote": "^21.5.0",
57
59
  "picocolors": "^1.1.1",
58
60
  "rimraf": "^6.1.2"
59
61
  },
@@ -61,9 +63,10 @@
61
63
  "@types/fs-extra": "^11.0.4",
62
64
  "@types/lodash-es": "^4.17.12",
63
65
  "@types/node": "^25.0.10",
66
+ "@types/pacote": "^11.1.8",
64
67
  "tsx": "^4.21.0",
65
68
  "typescript": "^5.9.3",
66
69
  "unbuild": "^3.6.1"
67
70
  },
68
- "gitHead": "ac6a576b84157817fa6d5159bb0725ba189aa11e"
71
+ "gitHead": "56307bdf54199f17269b25e6ad3a712b48234b8f"
69
72
  }