@gct-paas/cli 0.1.7 → 0.1.8
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/CHANGELOG.md +6 -0
- package/dist/actions/gen-cdn-lib/gen-cdn-lib.cjs +16 -5
- package/dist/actions/gen-cdn-lib/gen-cdn-lib.d.ts +0 -1
- package/dist/actions/update-catalog-env/update-catalog-env.cjs +3 -7
- package/dist/actions/update-catalog-env/update-catalog-env.d.ts +0 -1
- package/dist/commands/gen-cdn-lib/gen-cdn-lib.cjs +1 -1
- package/dist/constants/index.cjs +11 -0
- package/dist/constants/index.d.ts +8 -0
- package/dist/interface/i-gen-cdn-lib-options/i-gen-cdn-lib-options.d.ts +1 -1
- package/es/actions/gen-cdn-lib/gen-cdn-lib.d.ts +0 -1
- package/es/actions/gen-cdn-lib/gen-cdn-lib.mjs +16 -22
- package/es/actions/update-catalog-env/update-catalog-env.d.ts +0 -1
- package/es/actions/update-catalog-env/update-catalog-env.mjs +3 -24
- package/es/commands/gen-cdn-lib/gen-cdn-lib.mjs +1 -1
- package/es/constants/index.d.ts +8 -0
- package/es/constants/index.mjs +22 -0
- package/es/interface/i-gen-cdn-lib-options/i-gen-cdn-lib-options.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,9 +9,10 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
9
9
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
10
10
|
var _consola = _interopRequireDefault(require("consola"));
|
|
11
11
|
var _listr = require("listr2");
|
|
12
|
+
var _constants = require("../../constants/index.cjs");
|
|
13
|
+
var _utils = require("../../utils/index.cjs");
|
|
12
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
15
|
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
|
/**
|
|
16
17
|
* 下载指定包并复制到外部依赖目录,返回入口文件名;若找不到入口文件则返回空字符串
|
|
17
18
|
*/
|
|
@@ -57,11 +58,21 @@ class GenCdnLibAction {
|
|
|
57
58
|
}
|
|
58
59
|
_consola.default.info("\u6B63\u5728\u8BFB\u53D6 import-map.json...");
|
|
59
60
|
const importMap = _fsExtra.default.readJSONSync(importMapJsonPath);
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
let tag = opts.tag;
|
|
62
|
+
if (!tag) {
|
|
63
|
+
const branch = await (0, _utils.getBranchName)();
|
|
64
|
+
if (branch) {
|
|
65
|
+
tag = _constants.branch_2_tag[branch];
|
|
66
|
+
}
|
|
67
|
+
if (!tag) {
|
|
68
|
+
tag = "latest";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const tasks = new _listr.Listr(_constants.lib_packages.map(pkg => ({
|
|
72
|
+
title: `${pkg}@${tag}`,
|
|
62
73
|
task: async (_, task) => {
|
|
63
|
-
task.title = `${pkg}@${
|
|
64
|
-
const pkgInfo = await _pacote.default.manifest(`${pkg}@${
|
|
74
|
+
task.title = `${pkg}@${tag} \u83B7\u53D6\u5305\u4FE1\u606F...`;
|
|
75
|
+
const pkgInfo = await _pacote.default.manifest(`${pkg}@${tag}`, {
|
|
65
76
|
registry: opts.registry,
|
|
66
77
|
cache: cacheDir
|
|
67
78
|
});
|
|
@@ -11,17 +11,13 @@ var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
|
11
11
|
var _jsYaml = _interopRequireDefault(require("js-yaml"));
|
|
12
12
|
var _utils = require("../../utils/index.cjs");
|
|
13
13
|
var _path = _interopRequireDefault(require("path"));
|
|
14
|
+
var _constants = require("../../constants/index.cjs");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
const envMap = {
|
|
16
|
-
"paas-dev": "dev",
|
|
17
|
-
"paas-test": "test"
|
|
18
|
-
};
|
|
19
16
|
class UpdateCatalogEnvAction {
|
|
20
|
-
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"];
|
|
21
17
|
async run() {
|
|
22
18
|
_consola.consola.start("\u4FEE\u6539 pnpm catalog \u914D\u7F6E...");
|
|
23
19
|
const branch = await (0, _utils.getBranchName)();
|
|
24
|
-
const tag =
|
|
20
|
+
const tag = _constants.branch_2_tag[branch];
|
|
25
21
|
if (!tag) {
|
|
26
22
|
_consola.consola.info(`\u5F53\u524D\u5206\u652F ${branch} \u4E0D\u5339\u914D\u4EFB\u4F55\u73AF\u5883\u6807\u7B7E\uFF0C\u8DF3\u8FC7 catalog \u8BBE\u7F6E`);
|
|
27
23
|
return;
|
|
@@ -33,7 +29,7 @@ class UpdateCatalogEnvAction {
|
|
|
33
29
|
_consola.consola.warn("pnpm-workspace.yaml \u4E2D\u7F3A\u5C11 catalog \u914D\u7F6E\uFF0C\u8DF3\u8FC7 catalog \u8BBE\u7F6E");
|
|
34
30
|
return;
|
|
35
31
|
}
|
|
36
|
-
const tasks = new _listr.Listr(
|
|
32
|
+
const tasks = new _listr.Listr(_constants.lib_packages.map(pkg => ({
|
|
37
33
|
title: `\u8BBE\u7F6E ${pkg} \u7684 catalog \u6807\u7B7E\u4E3A ${tag}`,
|
|
38
34
|
task: async (_, task) => {
|
|
39
35
|
if (!catalogCfg[pkg]) {
|
|
@@ -7,7 +7,7 @@ exports.GenCdnLibCommand = void 0;
|
|
|
7
7
|
var _actions = require("../../actions/index.cjs");
|
|
8
8
|
class GenCdnLibCommand {
|
|
9
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"
|
|
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").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
11
|
}
|
|
12
12
|
async action(args) {
|
|
13
13
|
await new _actions.GenCdnLibAction().run(args);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.lib_packages = exports.branch_2_tag = void 0;
|
|
7
|
+
const lib_packages = exports.lib_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"];
|
|
8
|
+
const branch_2_tag = exports.branch_2_tag = {
|
|
9
|
+
"paas-dev": "dev",
|
|
10
|
+
"paas-test": "test"
|
|
11
|
+
};
|
|
@@ -3,25 +3,9 @@ import path from "path";
|
|
|
3
3
|
import fse from "fs-extra";
|
|
4
4
|
import log from "consola";
|
|
5
5
|
import { Listr } from "listr2";
|
|
6
|
+
import { branch_2_tag, lib_packages } from "../../constants/index.mjs";
|
|
7
|
+
import { getBranchName } from "../../utils/index.mjs";
|
|
6
8
|
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
9
|
/**
|
|
26
10
|
* 下载指定包并复制到外部依赖目录,返回入口文件名;若找不到入口文件则返回空字符串
|
|
27
11
|
*/
|
|
@@ -65,12 +49,22 @@ export class GenCdnLibAction {
|
|
|
65
49
|
}
|
|
66
50
|
log.info("\u6B63\u5728\u8BFB\u53D6 import-map.json...");
|
|
67
51
|
const importMap = fse.readJSONSync(importMapJsonPath);
|
|
52
|
+
let tag = opts.tag;
|
|
53
|
+
if (!tag) {
|
|
54
|
+
const branch = await getBranchName();
|
|
55
|
+
if (branch) {
|
|
56
|
+
tag = branch_2_tag[branch];
|
|
57
|
+
}
|
|
58
|
+
if (!tag) {
|
|
59
|
+
tag = "latest";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
68
62
|
const tasks = new Listr(
|
|
69
|
-
|
|
70
|
-
title: `${pkg}@${
|
|
63
|
+
lib_packages.map((pkg) => ({
|
|
64
|
+
title: `${pkg}@${tag}`,
|
|
71
65
|
task: async (_, task) => {
|
|
72
|
-
task.title = `${pkg}@${
|
|
73
|
-
const pkgInfo = await pacote.manifest(`${pkg}@${
|
|
66
|
+
task.title = `${pkg}@${tag} \u83B7\u53D6\u5305\u4FE1\u606F...`;
|
|
67
|
+
const pkgInfo = await pacote.manifest(`${pkg}@${tag}`, {
|
|
74
68
|
registry: opts.registry,
|
|
75
69
|
cache: cacheDir
|
|
76
70
|
});
|
|
@@ -5,33 +5,12 @@ import fse from "fs-extra";
|
|
|
5
5
|
import jsYaml from "js-yaml";
|
|
6
6
|
import { getBranchName } from "../../utils/index.mjs";
|
|
7
7
|
import path from "path";
|
|
8
|
-
|
|
9
|
-
"paas-dev": "dev",
|
|
10
|
-
"paas-test": "test"
|
|
11
|
-
};
|
|
8
|
+
import { branch_2_tag, lib_packages } from "../../constants/index.mjs";
|
|
12
9
|
export class UpdateCatalogEnvAction {
|
|
13
|
-
packages = [
|
|
14
|
-
"@gct-paas/api",
|
|
15
|
-
"@gct-paas/core",
|
|
16
|
-
"@gct-paas/core-mobile",
|
|
17
|
-
"@gct-paas/core-pad",
|
|
18
|
-
"@gct-paas/core-web",
|
|
19
|
-
"@gct-paas/design",
|
|
20
|
-
"@gct-paas/design-mobile",
|
|
21
|
-
"@gct-paas/design-pad",
|
|
22
|
-
"@gct-paas/design-web",
|
|
23
|
-
"@gct-paas/native",
|
|
24
|
-
"@gct-paas/render",
|
|
25
|
-
"@gct-paas/render-mobile",
|
|
26
|
-
"@gct-paas/render-pad",
|
|
27
|
-
"@gct-paas/render-web",
|
|
28
|
-
"@gct-paas/schema",
|
|
29
|
-
"@gct-paas/v-ben"
|
|
30
|
-
];
|
|
31
10
|
async run() {
|
|
32
11
|
consola.start("\u4FEE\u6539 pnpm catalog \u914D\u7F6E...");
|
|
33
12
|
const branch = await getBranchName();
|
|
34
|
-
const tag =
|
|
13
|
+
const tag = branch_2_tag[branch];
|
|
35
14
|
if (!tag) {
|
|
36
15
|
consola.info(`\u5F53\u524D\u5206\u652F ${branch} \u4E0D\u5339\u914D\u4EFB\u4F55\u73AF\u5883\u6807\u7B7E\uFF0C\u8DF3\u8FC7 catalog \u8BBE\u7F6E`);
|
|
37
16
|
return;
|
|
@@ -44,7 +23,7 @@ export class UpdateCatalogEnvAction {
|
|
|
44
23
|
return;
|
|
45
24
|
}
|
|
46
25
|
const tasks = new Listr(
|
|
47
|
-
|
|
26
|
+
lib_packages.map((pkg) => ({
|
|
48
27
|
title: `\u8BBE\u7F6E ${pkg} \u7684 catalog \u6807\u7B7E\u4E3A ${tag}`,
|
|
49
28
|
task: async (_, task) => {
|
|
50
29
|
if (!catalogCfg[pkg]) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GenCdnLibAction } from "../../actions/index.mjs";
|
|
2
2
|
export class GenCdnLibCommand {
|
|
3
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"
|
|
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").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
5
|
}
|
|
6
6
|
async action(args) {
|
|
7
7
|
await new GenCdnLibAction().run(
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const lib_packages = [
|
|
2
|
+
"@gct-paas/api",
|
|
3
|
+
"@gct-paas/core",
|
|
4
|
+
"@gct-paas/core-mobile",
|
|
5
|
+
"@gct-paas/core-pad",
|
|
6
|
+
"@gct-paas/core-web",
|
|
7
|
+
"@gct-paas/design",
|
|
8
|
+
"@gct-paas/design-mobile",
|
|
9
|
+
"@gct-paas/design-pad",
|
|
10
|
+
"@gct-paas/design-web",
|
|
11
|
+
"@gct-paas/native",
|
|
12
|
+
"@gct-paas/render",
|
|
13
|
+
"@gct-paas/render-mobile",
|
|
14
|
+
"@gct-paas/render-pad",
|
|
15
|
+
"@gct-paas/render-web",
|
|
16
|
+
"@gct-paas/schema",
|
|
17
|
+
"@gct-paas/v-ben"
|
|
18
|
+
];
|
|
19
|
+
export const branch_2_tag = {
|
|
20
|
+
"paas-dev": "dev",
|
|
21
|
+
"paas-test": "test"
|
|
22
|
+
};
|