@ldsg/cli 0.3.38 → 0.3.40
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/.rush/temp/package-deps_build.json +36 -33
- package/.rush/temp/shrinkwrap-deps.json +4 -1
- package/.tsbuildinfo +1 -1
- package/CHANGELOG.json +46 -0
- package/CHANGELOG.md +15 -1
- package/README.md +87 -4
- package/dist/__tests__/commands.test.js +68 -12
- package/dist/__tests__/commands.test.js.map +1 -1
- package/dist/__tests__/formatter.test.js +18 -3
- package/dist/__tests__/formatter.test.js.map +1 -1
- package/dist/__tests__/generate-app-index-ts.test.d.ts +1 -0
- package/dist/__tests__/generate-app-index-ts.test.js +109 -0
- package/dist/__tests__/generate-app-index-ts.test.js.map +1 -0
- package/dist/__tests__/get-extend-app-data-params-using-workspace-ldsg-module.test.d.ts +1 -0
- package/dist/__tests__/get-extend-app-data-params-using-workspace-ldsg-module.test.js +81 -0
- package/dist/__tests__/get-extend-app-data-params-using-workspace-ldsg-module.test.js.map +1 -0
- package/dist/__tests__/json-file-mutator.test.js +54 -9
- package/dist/__tests__/json-file-mutator.test.js.map +1 -1
- package/dist/__tests__/mutate.test.d.ts +1 -0
- package/dist/__tests__/mutate.test.js +334 -0
- package/dist/__tests__/mutate.test.js.map +1 -0
- package/dist/cli.js +131 -50
- package/dist/cli.js.map +1 -1
- package/dist/commands/resource/create.js +1 -1
- package/dist/commands/resource/create.js.map +1 -1
- package/dist/commands/resource/list.js +1 -1
- package/dist/commands/resource/list.js.map +1 -1
- package/dist/commands/resource/mutate.d.ts +80 -0
- package/dist/commands/resource/mutate.js +311 -0
- package/dist/commands/resource/mutate.js.map +1 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +4 -1
- package/dist/constants.js.map +1 -1
- package/dist/types/get-extend-app-data-params.d.ts +4 -1
- package/dist/utils/get-extend-app-data-params-using-workspace-ldsg-module/index.js +22 -6
- package/dist/utils/get-extend-app-data-params-using-workspace-ldsg-module/index.js.map +1 -1
- package/jest.config.js +3 -4
- package/package.json +4 -5
- package/src/__tests__/commands.test.ts +68 -12
- package/src/__tests__/formatter.test.ts +18 -3
- package/src/__tests__/generate-app-index-ts.test.ts +141 -0
- package/src/__tests__/get-extend-app-data-params-using-workspace-ldsg-module.test.ts +109 -0
- package/src/__tests__/json-file-mutator.test.ts +54 -9
- package/src/__tests__/mutate.test.ts +392 -0
- package/src/cli.ts +179 -54
- package/src/commands/resource/create.ts +3 -3
- package/src/commands/resource/list.ts +1 -1
- package/src/commands/resource/mutate.ts +542 -0
- package/src/constants.ts +4 -0
- package/src/types/get-extend-app-data-params.ts +4 -1
- package/src/utils/get-extend-app-data-params-using-workspace-ldsg-module/index.ts +43 -7
- package/.rush/temp/chunked-rush-logs/cli.format.chunks.jsonl +0 -2
- package/.rush/temp/package-deps_format.json +0 -38
- package/dist/commands/resource/convert.d.ts +0 -11
- package/dist/commands/resource/convert.js +0 -44
- package/dist/commands/resource/convert.js.map +0 -1
- package/rush-logs/cli.format.log +0 -2
- package/src/commands/resource/convert.ts +0 -54
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"files": {
|
|
3
|
-
"libs/cli/.gitignore": "2046f6707adc56560e4b09323bd7c931e9e2e2e1",
|
|
4
|
-
"libs/cli/.rush/temp/shrinkwrap-deps.json": "3f58bdd5d1553299ca0513ca5e4df62c3cfb19c3",
|
|
5
|
-
"libs/cli/CHANGELOG.json": "8f5c3cd3c09856ca89aeebf85e2cfe26fac961da",
|
|
6
|
-
"libs/cli/CHANGELOG.md": "82b0998c3d13a98c54dfc6f715a235d954aff378",
|
|
7
|
-
"libs/cli/Dockerfile": "358c4efbccbba2db03e3f642cf0c81be9cc39125",
|
|
8
|
-
"libs/cli/README.md": "a93bf4ce40d95b9f8652810ccfce11d48fd55c21",
|
|
9
|
-
"libs/cli/jest.config.js": "deadf1c1f4507057bc1abd64a65bcfda7797ef93",
|
|
10
|
-
"libs/cli/package.json": "be700a5349e85ab7ef1489516cccedd90fad1d1e",
|
|
11
|
-
"libs/cli/src/__tests__/add-pnpm-overrides.test.ts": "94e7bd1812a26b255a89d9bae49d1a55df943761",
|
|
12
|
-
"libs/cli/src/__tests__/commands.test.ts": "9771db3e71cd8093ef6e2fb62ae5b924ef7fff25",
|
|
13
|
-
"libs/cli/src/__tests__/formatter.test.ts": "6cab4efa00c9a00beaf44666b405607fd1770c09",
|
|
14
|
-
"libs/cli/src/__tests__/json-file-mutator.test.ts": "315c13e63be496e49a57b8670c7238c224967a41",
|
|
15
|
-
"libs/cli/src/__tests__/source-resolver.test.ts": "0e361b8d01d34239c2a3a1f999a44c7ae5c8a6e5",
|
|
16
|
-
"libs/cli/src/cli.ts": "a9cb0b06463e5927927d305763069f07522e0ab9",
|
|
17
|
-
"libs/cli/src/commands/resource/convert.ts": "7dd4fc5b13dd48311e180fdc735d48d6dc5941a4",
|
|
18
|
-
"libs/cli/src/commands/resource/create.ts": "f681a87231a038067539a807dba907fc9d80346c",
|
|
19
|
-
"libs/cli/src/commands/resource/delete.ts": "778ab0c4da1c84b9f8b7d900c599f40ef3382dee",
|
|
20
|
-
"libs/cli/src/commands/resource/diff.ts": "bea12eef0af87d2ce3b8bab36d924e0490862f3c",
|
|
21
|
-
"libs/cli/src/commands/resource/get.ts": "60a9e6987f757da7f2b2e3182844d8bfaf31b9ee",
|
|
22
|
-
"libs/cli/src/commands/resource/list.ts": "619ca83e263bc30f429ae3465b6c554ae326163c",
|
|
23
|
-
"libs/cli/src/commands/resource/tree.ts": "ac20774dfc5c5742db9c6cb9e714dfb67a67eab4",
|
|
24
|
-
"libs/cli/src/commands/resource/update.ts": "ad9e9fdc64d00667b4e1c8dccef2aad462e89ee7",
|
|
25
|
-
"libs/cli/src/constants.ts": "ff27f82f068e550ffb48651cfb0216b1e0193f25",
|
|
26
|
-
"libs/cli/src/types/get-extend-app-data-params.ts": "28feff2f9edfea30156a2cf7005fd3f2ceb886f9",
|
|
27
|
-
"libs/cli/src/types/resource-record.ts": "78ed6b6279655b9a9aeb8b84b745d7814eb957a0",
|
|
28
|
-
"libs/cli/src/utils/add-pnpm-overrides.ts": "eef15f26dfce35e8cba33e8dd5a50a5b8d446adf",
|
|
29
|
-
"libs/cli/src/utils/formatter.ts": "f02a8cf49a44947a5baa3879c48a3bbc2ae83ce0",
|
|
30
|
-
"libs/cli/src/utils/get-extend-app-data-params-using-npm-ldsg-module.ts": "f99c43d04fb3b01de2917ffb55e5bf4d753ed94c",
|
|
31
|
-
"libs/cli/src/utils/get-extend-app-data-params-using-workspace-ldsg-module/index.ts": "ff415d55568502495c41b300f95fd253d7d8dd73",
|
|
32
|
-
"libs/cli/src/utils/json-file-mutator.ts": "f3e83e4ad83691bbe2ef00561747700b9a8a4e7d",
|
|
33
|
-
"libs/cli/src/utils/source-resolver.ts": "0bd3d5424952ffed1b5c0bf6d9cc5d2f1b33afcb",
|
|
34
|
-
"libs/cli/tsconfig.build.json": "b90fc83e04c260510b7986e68871e1f385a5c0cb",
|
|
35
|
-
"libs/cli/tsconfig.json": "1d619ec9e9c99d68b852a5038721953a952c97be"
|
|
36
|
-
},
|
|
37
|
-
"arguments": "oxfmt --write src/ "
|
|
38
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ResourceRecords } from "@ldsg/types";
|
|
2
|
-
export interface ConvertOptions {
|
|
3
|
-
from: string;
|
|
4
|
-
to: string;
|
|
5
|
-
input: string;
|
|
6
|
-
output?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function convertResource(options: ConvertOptions): Promise<{
|
|
9
|
-
outputPath?: string;
|
|
10
|
-
data: ResourceRecords;
|
|
11
|
-
}>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.convertResource = convertResource;
|
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
const apaas_to_runtime_1 = require("@ldsg/apaas-to-runtime");
|
|
9
|
-
async function convertResource(options) {
|
|
10
|
-
const { from, to, input, output } = options;
|
|
11
|
-
if (from === "runtime" && to === "apaas") {
|
|
12
|
-
throw new Error("Runtime → aPaaS conversion is not supported yet");
|
|
13
|
-
}
|
|
14
|
-
if (from !== "apaas" || to !== "runtime") {
|
|
15
|
-
throw new Error(`Unsupported conversion: ${from} → ${to}`);
|
|
16
|
-
}
|
|
17
|
-
if (!(await fs_extra_1.default.pathExists(input))) {
|
|
18
|
-
throw new Error(`Input file not found: ${input}`);
|
|
19
|
-
}
|
|
20
|
-
const rawData = await fs_extra_1.default.readJson(input);
|
|
21
|
-
let resourceRecords;
|
|
22
|
-
if (Array.isArray(rawData)) {
|
|
23
|
-
resourceRecords = rawData;
|
|
24
|
-
}
|
|
25
|
-
else if (rawData && typeof rawData === "object" && Array.isArray(rawData.resourceRecords)) {
|
|
26
|
-
resourceRecords = rawData.resourceRecords;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
throw new Error("Invalid input format: expected an array or { resourceRecords: [] }");
|
|
30
|
-
}
|
|
31
|
-
const { targetResourceRecords } = (0, apaas_to_runtime_1.convertApaasResourceRecordsToResourceRecords)({
|
|
32
|
-
resourceRecords,
|
|
33
|
-
});
|
|
34
|
-
if (output) {
|
|
35
|
-
const isArrayInput = Array.isArray(rawData);
|
|
36
|
-
const outputData = isArrayInput
|
|
37
|
-
? targetResourceRecords
|
|
38
|
-
: { resourceRecords: targetResourceRecords };
|
|
39
|
-
await fs_extra_1.default.writeJson(output, outputData, { spaces: 2 });
|
|
40
|
-
return { outputPath: output, data: targetResourceRecords };
|
|
41
|
-
}
|
|
42
|
-
return { data: targetResourceRecords };
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=convert.js.map
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7E,eAAe;KAChB,CAAC,CAAC;IAEH,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,UAAU,GAAG,YAAY;YAC7B,CAAC,CAAC,qBAAqB;YACvB,CAAC,CAAC,EAAE,eAAe,EAAE,qBAAqB,EAAE,CAAC;QAC/C,MAAM,kBAAE,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QACtD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;IAC7D,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;AACzC,CAAC"}
|
package/rush-logs/cli.format.log
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import fs from "fs-extra";
|
|
2
|
-
import { convertApaasResourceRecordsToResourceRecords } from "@ldsg/apaas-to-runtime";
|
|
3
|
-
import { ResourceRecords } from "@ldsg/types";
|
|
4
|
-
|
|
5
|
-
export interface ConvertOptions {
|
|
6
|
-
from: string;
|
|
7
|
-
to: string;
|
|
8
|
-
input: string;
|
|
9
|
-
output?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export async function convertResource(
|
|
13
|
-
options: ConvertOptions,
|
|
14
|
-
): Promise<{ outputPath?: string; data: ResourceRecords }> {
|
|
15
|
-
const { from, to, input, output } = options;
|
|
16
|
-
|
|
17
|
-
if (from === "runtime" && to === "apaas") {
|
|
18
|
-
throw new Error("Runtime → aPaaS conversion is not supported yet");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (from !== "apaas" || to !== "runtime") {
|
|
22
|
-
throw new Error(`Unsupported conversion: ${from} → ${to}`);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (!(await fs.pathExists(input))) {
|
|
26
|
-
throw new Error(`Input file not found: ${input}`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const rawData = await fs.readJson(input);
|
|
30
|
-
let resourceRecords: ResourceRecords;
|
|
31
|
-
|
|
32
|
-
if (Array.isArray(rawData)) {
|
|
33
|
-
resourceRecords = rawData as ResourceRecords;
|
|
34
|
-
} else if (rawData && typeof rawData === "object" && Array.isArray(rawData.resourceRecords)) {
|
|
35
|
-
resourceRecords = rawData.resourceRecords as ResourceRecords;
|
|
36
|
-
} else {
|
|
37
|
-
throw new Error("Invalid input format: expected an array or { resourceRecords: [] }");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const { targetResourceRecords } = convertApaasResourceRecordsToResourceRecords({
|
|
41
|
-
resourceRecords,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
if (output) {
|
|
45
|
-
const isArrayInput = Array.isArray(rawData);
|
|
46
|
-
const outputData = isArrayInput
|
|
47
|
-
? targetResourceRecords
|
|
48
|
-
: { resourceRecords: targetResourceRecords };
|
|
49
|
-
await fs.writeJson(output, outputData, { spaces: 2 });
|
|
50
|
-
return { outputPath: output, data: targetResourceRecords };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return { data: targetResourceRecords };
|
|
54
|
-
}
|