@ldsg/cli 0.3.43 → 0.3.44
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 +15 -18
- package/.rush/temp/shrinkwrap-deps.json +1 -1
- package/.tsbuildinfo +1 -1
- package/CHANGELOG.json +23 -0
- package/CHANGELOG.md +8 -1
- package/README.md +3 -3
- package/dist/__tests__/bootstrap-generator.test.js +120 -0
- package/dist/__tests__/bootstrap-generator.test.js.map +1 -0
- package/dist/__tests__/generate-bootstrap.test.d.ts +1 -0
- package/dist/__tests__/generate-bootstrap.test.js +97 -0
- package/dist/__tests__/generate-bootstrap.test.js.map +1 -0
- package/dist/__tests__/resolve-module-builder.test.d.ts +1 -0
- package/dist/__tests__/resolve-module-builder.test.js +83 -0
- package/dist/__tests__/resolve-module-builder.test.js.map +1 -0
- package/dist/__tests__/resolve-root.test.d.ts +1 -0
- package/dist/__tests__/resolve-root.test.js +32 -0
- package/dist/__tests__/resolve-root.test.js.map +1 -0
- package/dist/cli.js +4 -431
- package/dist/cli.js.map +1 -1
- package/dist/commands/generate/index.d.ts +2 -0
- package/dist/commands/generate/index.js +35 -0
- package/dist/commands/generate/index.js.map +1 -0
- package/dist/commands/generate/types/generate.d.ts +12 -0
- package/dist/commands/generate/types/generate.js +3 -0
- package/dist/commands/generate/types/generate.js.map +1 -0
- package/dist/commands/generate/types/generator.d.ts +4 -0
- package/dist/commands/generate/types/generator.js +3 -0
- package/dist/commands/generate/types/generator.js.map +1 -0
- package/dist/commands/generate/types/index.d.ts +2 -0
- package/dist/commands/generate/types/index.js +19 -0
- package/dist/commands/generate/types/index.js.map +1 -0
- package/dist/commands/generate/types.d.ts +8 -0
- package/dist/{types/get-extend-app-data-params.js → commands/generate/types.js} +1 -1
- package/dist/commands/generate/types.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/index.d.ts +6 -0
- package/dist/commands/generate/utils/generate-application/index.js +28 -0
- package/dist/commands/generate/utils/generate-application/index.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/types/generator.d.ts +9 -0
- package/dist/commands/generate/utils/generate-application/types/generator.js +3 -0
- package/dist/commands/generate/utils/generate-application/types/generator.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/types/index.d.ts +1 -0
- package/dist/commands/generate/utils/generate-application/types/index.js +18 -0
- package/dist/commands/generate/utils/generate-application/types/index.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-app-generator/index.d.ts +9 -0
- package/dist/commands/generate/utils/generate-application/utils/build-app-generator/index.js +30 -0
- package/dist/commands/generate/utils/generate-application/utils/build-app-generator/index.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/index.d.ts +13 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/index.js +125 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/index.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/constants.d.ts +3 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/constants.js +7 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/constants.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/index.d.ts +4 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/index.js +69 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/index.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/prepare-bootstrap-app-files.d.ts +3 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/prepare-bootstrap-app-files.js +32 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/prepare-bootstrap-app-files.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/render-bootstrap-entry.d.ts +2 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/render-bootstrap-entry.js +62 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/render-bootstrap-entry.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/resolve-dependencies.d.ts +11 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/resolve-dependencies.js +84 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/generate-bootstrap/resolve-dependencies.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/resource-record/get-resource-record-by-id.d.ts +2 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/resource-record/get-resource-record-by-id.js +15 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/resource-record/get-resource-record-by-id.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/resource-record/resolve-resource-definition-resource-record.d.ts +2 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/resource-record/resolve-resource-definition-resource-record.js +21 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/resource-record/resolve-resource-definition-resource-record.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/resource-record/resolve-root-resource-record.d.ts +2 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/resource-record/resolve-root-resource-record.js +18 -0
- package/dist/commands/generate/utils/generate-application/utils/build-bootstrap/utils/resource-record/resolve-root-resource-record.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/build-meta-generator/index.d.ts +8 -0
- package/dist/commands/generate/utils/generate-application/utils/build-meta-generator/index.js +32 -0
- package/dist/commands/generate/utils/generate-application/utils/build-meta-generator/index.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/generate-app/index.d.ts +8 -0
- package/dist/commands/generate/utils/generate-application/utils/generate-app/index.js +10 -0
- package/dist/commands/generate/utils/generate-application/utils/generate-app/index.js.map +1 -0
- package/dist/commands/generate/utils/generate-application/utils/index.d.ts +3 -0
- package/dist/commands/generate/utils/generate-application/utils/index.js +20 -0
- package/dist/commands/generate/utils/generate-application/utils/index.js.map +1 -0
- package/dist/commands/generate/utils/parse-extra-options.d.ts +5 -0
- package/dist/commands/generate/utils/parse-extra-options.js +59 -0
- package/dist/commands/generate/utils/parse-extra-options.js.map +1 -0
- package/dist/commands/resource/index.d.ts +2 -0
- package/dist/commands/resource/index.js +392 -0
- package/dist/commands/resource/index.js.map +1 -0
- package/dist/generator/bootstrap-generator.d.ts +19 -0
- package/dist/generator/bootstrap-generator.js +59 -0
- package/dist/generator/bootstrap-generator.js.map +1 -0
- package/dist/generator/module-builder.d.ts +2 -0
- package/dist/generator/module-builder.js +284 -0
- package/dist/generator/module-builder.js.map +1 -0
- package/dist/generator/resolve-module-builder.d.ts +8 -0
- package/dist/generator/resolve-module-builder.js +41 -0
- package/dist/generator/resolve-module-builder.js.map +1 -0
- package/dist/generator/resolve-root.d.ts +5 -0
- package/dist/generator/resolve-root.js +48 -0
- package/dist/generator/resolve-root.js.map +1 -0
- package/jest.config.js +4 -1
- package/package.json +5 -5
- package/src/cli.ts +4 -510
- package/src/commands/generate/index.ts +54 -0
- package/src/commands/generate/utils/generate-application/index.ts +50 -0
- package/src/commands/generate/utils/generate-application/utils/build-app-generator/index.ts +39 -0
- package/src/commands/generate/utils/generate-application/utils/build-meta-generator/index.ts +45 -0
- package/src/commands/generate/utils/generate-application/utils/generate-app/index.ts +17 -0
- package/src/commands/generate/utils/generate-application/utils/index.ts +3 -0
- package/src/commands/generate/utils/parse-extra-options.ts +80 -0
- package/src/commands/resource/index.ts +455 -0
- package/dist/__tests__/get-extend-app-data-params-using-workspace-ldsg-module.test.js +0 -81
- package/dist/__tests__/get-extend-app-data-params-using-workspace-ldsg-module.test.js.map +0 -1
- package/dist/types/get-extend-app-data-params.d.ts +0 -10
- package/dist/types/get-extend-app-data-params.js.map +0 -1
- package/dist/utils/get-extend-app-data-params-using-npm-ldsg-module.d.ts +0 -2
- package/dist/utils/get-extend-app-data-params-using-npm-ldsg-module.js +0 -27
- package/dist/utils/get-extend-app-data-params-using-npm-ldsg-module.js.map +0 -1
- package/dist/utils/get-extend-app-data-params-using-workspace-ldsg-module/index.d.ts +0 -2
- package/dist/utils/get-extend-app-data-params-using-workspace-ldsg-module/index.js +0 -98
- package/dist/utils/get-extend-app-data-params-using-workspace-ldsg-module/index.js.map +0 -1
- package/src/__tests__/add-pnpm-overrides.test.ts +0 -91
- package/src/__tests__/commands.test.ts +0 -318
- package/src/__tests__/formatter.test.ts +0 -151
- package/src/__tests__/generate-app-index-ts.test.ts +0 -141
- package/src/__tests__/get-extend-app-data-params-using-workspace-ldsg-module.test.ts +0 -109
- package/src/__tests__/json-file-mutator.test.ts +0 -186
- package/src/__tests__/mutate.test.ts +0 -392
- package/src/__tests__/source-resolver.test.ts +0 -125
- package/src/types/get-extend-app-data-params.ts +0 -13
- package/src/utils/get-extend-app-data-params-using-npm-ldsg-module.ts +0 -34
- package/src/utils/get-extend-app-data-params-using-workspace-ldsg-module/index.ts +0 -159
- /package/dist/__tests__/{get-extend-app-data-params-using-workspace-ldsg-module.test.d.ts → bootstrap-generator.test.d.ts} +0 -0
package/dist/cli.js
CHANGED
|
@@ -1,442 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
4
|
const fs_1 = require("fs");
|
|
38
5
|
const path_1 = require("path");
|
|
39
|
-
const utils_1 = require("@ldsg/utils");
|
|
40
6
|
const commander_1 = require("commander");
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const get_extend_app_data_params_using_workspace_ldsg_module_1 = require("./utils/get-extend-app-data-params-using-workspace-ldsg-module");
|
|
44
|
-
const source_resolver_1 = require("./utils/source-resolver");
|
|
45
|
-
const formatter_1 = require("./utils/formatter");
|
|
46
|
-
const create_1 = require("./commands/resource/create");
|
|
47
|
-
const update_1 = require("./commands/resource/update");
|
|
48
|
-
const delete_1 = require("./commands/resource/delete");
|
|
49
|
-
const list_1 = require("./commands/resource/list");
|
|
50
|
-
const get_1 = require("./commands/resource/get");
|
|
51
|
-
const diff_1 = require("./commands/resource/diff");
|
|
52
|
-
const mutate_1 = require("./commands/resource/mutate");
|
|
7
|
+
const generate_1 = require("./commands/generate");
|
|
8
|
+
const resource_1 = require("./commands/resource");
|
|
53
9
|
const { version } = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, "..", "package.json"), "utf-8"));
|
|
54
10
|
const program = new commander_1.Command();
|
|
55
11
|
program.name("ldsg").description("LDSG CLI tools").version(version);
|
|
56
|
-
program
|
|
57
|
-
|
|
58
|
-
.aliases(["g", "gen"])
|
|
59
|
-
.description("Generate standalone application from resource records")
|
|
60
|
-
.option("--app-data-uri <uri>", "runtime app data URI")
|
|
61
|
-
.option("--app-data-expression <expression>", "runtime app data expression (jsonata), used to convert source data to standard ldsg resource records")
|
|
62
|
-
.option("--using-workspace-ldsg-module", "use workspace ldsg module mode")
|
|
63
|
-
.option("--layout <layout>", `app layout: nested or flat (default: flat for workspace mode, nested otherwise)`)
|
|
64
|
-
.option("--app-package-name <name>", "app package name (default: @ldsg/app)")
|
|
65
|
-
.option("-o, --output <path>", `output directory for prepared app code (default: ${constants_1.DEFAULT_OUTPUT_PATH})`)
|
|
66
|
-
.action(async (options) => {
|
|
67
|
-
const outputPath = options.output || constants_1.DEFAULT_OUTPUT_PATH;
|
|
68
|
-
const usingWorkspaceLdsgModule = options.usingWorkspaceLdsgModule ?? false;
|
|
69
|
-
const layout = options.layout === "nested"
|
|
70
|
-
? utils_1.ZipAppDataLayout.NESTED
|
|
71
|
-
: options.layout === "flat"
|
|
72
|
-
? utils_1.ZipAppDataLayout.FLAT
|
|
73
|
-
: undefined;
|
|
74
|
-
if (options.layout && layout === undefined) {
|
|
75
|
-
throw new Error(`invalid layout: ${options.layout} (expected nested or flat)`);
|
|
76
|
-
}
|
|
77
|
-
const { resourceRecords } = await (0, utils_1.loadAppResourceRecords)({
|
|
78
|
-
appDataUri: options.appDataUri,
|
|
79
|
-
appDataExpression: options.appDataExpression,
|
|
80
|
-
});
|
|
81
|
-
const appData = { resourceRecords };
|
|
82
|
-
let extendAppDataParams;
|
|
83
|
-
if (usingWorkspaceLdsgModule) {
|
|
84
|
-
extendAppDataParams = await (0, get_extend_app_data_params_using_workspace_ldsg_module_1.getExtendAppDataParamsUsingWorkspaceLdsgModule)({
|
|
85
|
-
appData,
|
|
86
|
-
...(layout ? { layout } : {}),
|
|
87
|
-
...(options.appPackageName ? { appPackageName: options.appPackageName } : {}),
|
|
88
|
-
outputPath,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
extendAppDataParams = await (0, get_extend_app_data_params_using_npm_ldsg_module_1.getExtendAppDataParamsUsingNpmLdsgModule)({ appData });
|
|
93
|
-
}
|
|
94
|
-
const extendAppDataRes = (0, utils_1.extendAppData)(extendAppDataParams);
|
|
95
|
-
await (0, utils_1.prepare)({
|
|
96
|
-
...extendAppDataRes,
|
|
97
|
-
outputPath,
|
|
98
|
-
...(layout ? { layout } : usingWorkspaceLdsgModule ? { layout: utils_1.ZipAppDataLayout.FLAT } : {}),
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
const resource = program.command("resource").aliases(["r"]).description("Manage resource records");
|
|
102
|
-
resource
|
|
103
|
-
.command("list")
|
|
104
|
-
.description("List resource records by filter")
|
|
105
|
-
.option("--source <path>", `data source (default: ${constants_1.DEFAULT_SOURCE_PATH})`)
|
|
106
|
-
.option("--kind <kind>", "filter by resource kind")
|
|
107
|
-
.option("--parent-id <id>", "filter by parent id")
|
|
108
|
-
.option("--root-id <id>", "filter by root resource id")
|
|
109
|
-
.option("--pretty", "human-readable output")
|
|
110
|
-
.action(async (options) => {
|
|
111
|
-
try {
|
|
112
|
-
const sourceDesc = (0, source_resolver_1.getSourceDescription)(options.source);
|
|
113
|
-
const sourceData = await (0, source_resolver_1.resolveSource)(options.source);
|
|
114
|
-
const { total, resources } = await (0, list_1.listResources)(sourceData.resourceRecords, {
|
|
115
|
-
kind: options.kind,
|
|
116
|
-
parentId: options.parentId,
|
|
117
|
-
rootId: options.rootId,
|
|
118
|
-
});
|
|
119
|
-
if (options.pretty) {
|
|
120
|
-
console.log((0, formatter_1.formatPrettyList)(resources.map((r) => ({
|
|
121
|
-
id: r.id,
|
|
122
|
-
kind: r.kind,
|
|
123
|
-
parentId: r.parentId,
|
|
124
|
-
title: r.settings?.title,
|
|
125
|
-
}))));
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)({ source: sourceDesc, total, resources })));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("LIST_ERROR", error.message)));
|
|
133
|
-
process.exit(1);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
resource
|
|
137
|
-
.command("get <id>")
|
|
138
|
-
.description("Get a resource record by id")
|
|
139
|
-
.option("--source <path>", `data source (default: ${constants_1.DEFAULT_SOURCE_PATH})`)
|
|
140
|
-
.option("--children", "include direct children")
|
|
141
|
-
.option("--tree", "include full subtree")
|
|
142
|
-
.option("--pretty", "human-readable output")
|
|
143
|
-
.action(async (id, options) => {
|
|
144
|
-
try {
|
|
145
|
-
const sourceDesc = (0, source_resolver_1.getSourceDescription)(options.source);
|
|
146
|
-
const sourceData = await (0, source_resolver_1.resolveSource)(options.source);
|
|
147
|
-
const record = await (0, get_1.getResource)(sourceData.resourceRecords, id, {
|
|
148
|
-
children: options.children,
|
|
149
|
-
tree: options.tree,
|
|
150
|
-
});
|
|
151
|
-
if (!record) {
|
|
152
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("NOT_FOUND", `Resource with id "${id}" not found`)));
|
|
153
|
-
process.exit(1);
|
|
154
|
-
}
|
|
155
|
-
if (options.pretty) {
|
|
156
|
-
console.log((0, formatter_1.formatJson)(record));
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)({ source: sourceDesc, record })));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
catch (error) {
|
|
163
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("GET_ERROR", error.message)));
|
|
164
|
-
process.exit(1);
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
resource
|
|
168
|
-
.command("tree [root-id]")
|
|
169
|
-
.description("Display resource tree")
|
|
170
|
-
.option("--source <path>", `data source (default: ${constants_1.DEFAULT_SOURCE_PATH})`)
|
|
171
|
-
.option("--show-kind", "show resource kind prefix")
|
|
172
|
-
.option("--pretty", "human-readable output")
|
|
173
|
-
.action(async (rootId, options) => {
|
|
174
|
-
try {
|
|
175
|
-
const sourceDesc = (0, source_resolver_1.getSourceDescription)(options.source);
|
|
176
|
-
const sourceData = await (0, source_resolver_1.resolveSource)(options.source);
|
|
177
|
-
const result = await (0, list_1.getTree)(sourceData.resourceRecords, rootId, options.showKind);
|
|
178
|
-
if (options.pretty) {
|
|
179
|
-
console.log((0, formatter_1.formatPrettyTree)(result.tree, options.showKind ?? false));
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)({ source: sourceDesc, ...result })));
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("TREE_ERROR", error.message)));
|
|
187
|
-
process.exit(1);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
resource
|
|
191
|
-
.command("create")
|
|
192
|
-
.description("Create a new resource record")
|
|
193
|
-
.option("--source <path>", `data source (default: ${constants_1.DEFAULT_SOURCE_PATH})`)
|
|
194
|
-
.option("--kind <kind>", "resource kind")
|
|
195
|
-
.option("--parent-id <id>", "parent resource id")
|
|
196
|
-
.option("--settings <json>", "resource settings as JSON string")
|
|
197
|
-
.option("--from-file <path>", "read full resource record from JSON file")
|
|
198
|
-
.option("--from-stdin", "read full resource record from stdin")
|
|
199
|
-
.option("--dry-run", "preview without writing")
|
|
200
|
-
.action(async (options) => {
|
|
201
|
-
try {
|
|
202
|
-
if ((0, source_resolver_1.isStdinSource)(options.source)) {
|
|
203
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("STDIN_NOT_WRITABLE", "stdin source does not support write operations")));
|
|
204
|
-
process.exit(1);
|
|
205
|
-
}
|
|
206
|
-
const sourceData = await (0, source_resolver_1.resolveSource)(options.source);
|
|
207
|
-
let fromFileRecord;
|
|
208
|
-
if (options.fromFile) {
|
|
209
|
-
const fs = await Promise.resolve().then(() => __importStar(require("fs-extra")));
|
|
210
|
-
fromFileRecord = await fs.readJson(options.fromFile);
|
|
211
|
-
}
|
|
212
|
-
else if (options.fromStdin) {
|
|
213
|
-
const chunks = [];
|
|
214
|
-
process.stdin.setEncoding("utf-8");
|
|
215
|
-
for await (const chunk of process.stdin) {
|
|
216
|
-
chunks.push(Buffer.from(chunk));
|
|
217
|
-
}
|
|
218
|
-
const raw = Buffer.concat(chunks).toString("utf-8");
|
|
219
|
-
fromFileRecord = JSON.parse(raw);
|
|
220
|
-
}
|
|
221
|
-
let settings;
|
|
222
|
-
if (options.settings) {
|
|
223
|
-
settings = JSON.parse(options.settings);
|
|
224
|
-
}
|
|
225
|
-
const { record } = await (0, create_1.createResource)({
|
|
226
|
-
sourceData,
|
|
227
|
-
kind: options.kind,
|
|
228
|
-
parentId: options.parentId,
|
|
229
|
-
settings,
|
|
230
|
-
fromFileRecord: fromFileRecord,
|
|
231
|
-
dryRun: options.dryRun,
|
|
232
|
-
});
|
|
233
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)({ record, dryRun: options.dryRun ?? false })));
|
|
234
|
-
}
|
|
235
|
-
catch (error) {
|
|
236
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("CREATE_ERROR", error.message)));
|
|
237
|
-
process.exit(1);
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
resource
|
|
241
|
-
.command("update <id>")
|
|
242
|
-
.description("Update a resource record")
|
|
243
|
-
.option("--source <path>", `data source (default: ${constants_1.DEFAULT_SOURCE_PATH})`)
|
|
244
|
-
.option("--settings <json>", "resource settings to merge (JSON string, required)")
|
|
245
|
-
.option("--dry-run", "preview without writing")
|
|
246
|
-
.action(async (id, options) => {
|
|
247
|
-
try {
|
|
248
|
-
if ((0, source_resolver_1.isStdinSource)(options.source)) {
|
|
249
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("STDIN_NOT_WRITABLE", "stdin source does not support write operations")));
|
|
250
|
-
process.exit(1);
|
|
251
|
-
}
|
|
252
|
-
const sourceData = await (0, source_resolver_1.resolveSource)(options.source);
|
|
253
|
-
if (!options.settings) {
|
|
254
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("MISSING_SETTINGS", "Required option: --settings <json>")));
|
|
255
|
-
process.exit(1);
|
|
256
|
-
}
|
|
257
|
-
const settings = JSON.parse(options.settings);
|
|
258
|
-
const { record } = await (0, update_1.updateResource)({
|
|
259
|
-
sourceData,
|
|
260
|
-
id,
|
|
261
|
-
settings,
|
|
262
|
-
dryRun: options.dryRun,
|
|
263
|
-
});
|
|
264
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)({ record, dryRun: options.dryRun ?? false })));
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("UPDATE_ERROR", error.message)));
|
|
268
|
-
process.exit(1);
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
resource
|
|
272
|
-
.command("delete <id>")
|
|
273
|
-
.description("Delete a resource record and its children")
|
|
274
|
-
.option("--source <path>", `data source (default: ${constants_1.DEFAULT_SOURCE_PATH})`)
|
|
275
|
-
.option("--dry-run", "preview deletion scope without writing")
|
|
276
|
-
.action(async (id, options) => {
|
|
277
|
-
try {
|
|
278
|
-
if ((0, source_resolver_1.isStdinSource)(options.source)) {
|
|
279
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("STDIN_NOT_WRITABLE", "stdin source does not support write operations")));
|
|
280
|
-
process.exit(1);
|
|
281
|
-
}
|
|
282
|
-
const sourceData = await (0, source_resolver_1.resolveSource)(options.source);
|
|
283
|
-
const { removed } = await (0, delete_1.deleteResource)({
|
|
284
|
-
sourceData,
|
|
285
|
-
id,
|
|
286
|
-
dryRun: options.dryRun,
|
|
287
|
-
});
|
|
288
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)({
|
|
289
|
-
dryRun: options.dryRun ?? false,
|
|
290
|
-
removedCount: removed.length,
|
|
291
|
-
removed: removed.map((r) => ({ id: r.id, kind: r.kind })),
|
|
292
|
-
})));
|
|
293
|
-
}
|
|
294
|
-
catch (error) {
|
|
295
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("DELETE_ERROR", error.message)));
|
|
296
|
-
process.exit(1);
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
resource
|
|
300
|
-
.command("diff <id>")
|
|
301
|
-
.description("Diff a resource between two sources")
|
|
302
|
-
.option("--source-a <path>", "first source file (required)")
|
|
303
|
-
.option("--source-b <path>", "second source file (required)")
|
|
304
|
-
.option("--pretty", "human-readable output")
|
|
305
|
-
.action(async (id, options) => {
|
|
306
|
-
try {
|
|
307
|
-
if (!options.sourceA || !options.sourceB) {
|
|
308
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("MISSING_ARGS", "Required options: --source-a, --source-b")));
|
|
309
|
-
process.exit(1);
|
|
310
|
-
}
|
|
311
|
-
const sourceDataA = await (0, source_resolver_1.resolveSource)(options.sourceA);
|
|
312
|
-
const sourceDataB = await (0, source_resolver_1.resolveSource)(options.sourceB);
|
|
313
|
-
const result = await (0, diff_1.diffResource)({
|
|
314
|
-
sourceA: (0, source_resolver_1.getSourceDescription)(options.sourceA),
|
|
315
|
-
sourceB: (0, source_resolver_1.getSourceDescription)(options.sourceB),
|
|
316
|
-
id,
|
|
317
|
-
recordsA: sourceDataA.resourceRecords,
|
|
318
|
-
recordsB: sourceDataB.resourceRecords,
|
|
319
|
-
});
|
|
320
|
-
if (options.pretty) {
|
|
321
|
-
console.log((0, formatter_1.formatPrettyDiff)(result));
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)(result)));
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
catch (error) {
|
|
328
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("DIFF_ERROR", error.message)));
|
|
329
|
-
process.exit(1);
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
resource
|
|
333
|
-
.command("pull")
|
|
334
|
-
.description("Pull resource records from RRM to a local file (read-only)")
|
|
335
|
-
.option("--endpoint <url>", "RRM GraphQL endpoint")
|
|
336
|
-
.option("--path <regex>", "scope remote records to a path regex (e.g. application id)")
|
|
337
|
-
.option("-o, --output <path>", `output file (default: ${constants_1.DEFAULT_SOURCE_PATH})`)
|
|
338
|
-
.action(async (options) => {
|
|
339
|
-
try {
|
|
340
|
-
const result = await (0, mutate_1.pullRemoteResourceRecords)({
|
|
341
|
-
endpoint: options.endpoint,
|
|
342
|
-
path: options.path,
|
|
343
|
-
output: options.output,
|
|
344
|
-
});
|
|
345
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)(result)));
|
|
346
|
-
}
|
|
347
|
-
catch (error) {
|
|
348
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("PULL_ERROR", error.message)));
|
|
349
|
-
process.exit(1);
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
async function parseExplicitRecords(value, file) {
|
|
353
|
-
if (value && file) {
|
|
354
|
-
throw new Error("Cannot use both an inline value and a file for the same record list");
|
|
355
|
-
}
|
|
356
|
-
let data;
|
|
357
|
-
if (file) {
|
|
358
|
-
const fs = await Promise.resolve().then(() => __importStar(require("fs-extra")));
|
|
359
|
-
data = await fs.readJson(file);
|
|
360
|
-
}
|
|
361
|
-
else if (value) {
|
|
362
|
-
data = JSON.parse(value);
|
|
363
|
-
}
|
|
364
|
-
else {
|
|
365
|
-
return undefined;
|
|
366
|
-
}
|
|
367
|
-
const list = Array.isArray(data) ? data : [data];
|
|
368
|
-
return list.map((record) => (0, mutate_1.purifyResourceRecord)(record));
|
|
369
|
-
}
|
|
370
|
-
resource
|
|
371
|
-
.command("mutate")
|
|
372
|
-
.description("Mutate local resource records on RRM via mutateResourceRecords")
|
|
373
|
-
.option("--source <path>", `data source (default: ${constants_1.DEFAULT_SOURCE_PATH})`)
|
|
374
|
-
.option("--endpoint <url>", "RRM GraphQL endpoint")
|
|
375
|
-
.option("--token <token>", "RRM Bearer token (or RRM_ACCESS_TOKEN env)")
|
|
376
|
-
.option("--path <regex>", "scope remote records to a path regex (e.g. application id) before splitting")
|
|
377
|
-
.option("--no-delete-missing", "do not soft-delete remote-only records (default: soft-delete like console)")
|
|
378
|
-
.option("--no-write-back", "do not write server-assigned ids back to the local source file")
|
|
379
|
-
.option("--yes", "confirm soft-deletion without prompting")
|
|
380
|
-
.option("--dry-run", "preview the plan without sending")
|
|
381
|
-
.option("--create <json>", "explicit create records as JSON (skip auto split)")
|
|
382
|
-
.option("--update <json>", "explicit update records as JSON (skip auto split)")
|
|
383
|
-
.option("--create-file <path>", "explicit create records from JSON file (skip auto split)")
|
|
384
|
-
.option("--update-file <path>", "explicit update records from JSON file (skip auto split)")
|
|
385
|
-
.action(async (options) => {
|
|
386
|
-
try {
|
|
387
|
-
const explicitCreate = await parseExplicitRecords(options.create, options.createFile);
|
|
388
|
-
const explicitUpdate = await parseExplicitRecords(options.update, options.updateFile);
|
|
389
|
-
if (explicitCreate !== undefined || explicitUpdate !== undefined) {
|
|
390
|
-
const result = await (0, mutate_1.mutateRecordsDirect)({
|
|
391
|
-
endpoint: options.endpoint,
|
|
392
|
-
token: options.token,
|
|
393
|
-
createResourceRecords: explicitCreate ?? [],
|
|
394
|
-
updateResourceRecords: explicitUpdate ?? [],
|
|
395
|
-
dryRun: options.dryRun,
|
|
396
|
-
});
|
|
397
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)({
|
|
398
|
-
mode: "explicit",
|
|
399
|
-
dryRun: result.dryRun,
|
|
400
|
-
createCount: result.createCount,
|
|
401
|
-
updateCount: result.updateCount,
|
|
402
|
-
createdResourceRecords: result.createdResourceRecords,
|
|
403
|
-
updatedResourceRecords: result.updatedResourceRecords,
|
|
404
|
-
})));
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
if ((0, source_resolver_1.isStdinSource)(options.source)) {
|
|
408
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("STDIN_NOT_SUPPORTED", "stdin source is not supported for mutate; use a local JSON file")));
|
|
409
|
-
process.exit(1);
|
|
410
|
-
}
|
|
411
|
-
const sourceData = await (0, source_resolver_1.resolveSource)(options.source);
|
|
412
|
-
const result = await (0, mutate_1.mutateResources)({
|
|
413
|
-
sourceData,
|
|
414
|
-
endpoint: options.endpoint,
|
|
415
|
-
token: options.token,
|
|
416
|
-
path: options.path,
|
|
417
|
-
deleteMissing: options.deleteMissing,
|
|
418
|
-
writeBack: options.writeBack,
|
|
419
|
-
yes: options.yes,
|
|
420
|
-
dryRun: options.dryRun,
|
|
421
|
-
});
|
|
422
|
-
const { plan } = result;
|
|
423
|
-
console.log((0, formatter_1.formatJson)((0, formatter_1.formatSuccess)({
|
|
424
|
-
mode: "auto",
|
|
425
|
-
dryRun: result.dryRun,
|
|
426
|
-
source: (0, source_resolver_1.getSourceDescription)(options.source),
|
|
427
|
-
remoteCount: plan.remoteCount,
|
|
428
|
-
localCount: plan.localCount,
|
|
429
|
-
createCount: plan.createResourceRecords.length,
|
|
430
|
-
updateCount: plan.updateResourceRecords.length,
|
|
431
|
-
deleteCount: plan.deleteResourceRecords.length,
|
|
432
|
-
idMap: result.idMap,
|
|
433
|
-
writeBackPath: result.writeBackPath,
|
|
434
|
-
})));
|
|
435
|
-
}
|
|
436
|
-
catch (error) {
|
|
437
|
-
console.error((0, formatter_1.formatJson)((0, formatter_1.formatError)("MUTATE_ERROR", error.message)));
|
|
438
|
-
process.exit(1);
|
|
439
|
-
}
|
|
440
|
-
});
|
|
12
|
+
(0, generate_1.registerGenerateCommand)(program);
|
|
13
|
+
(0, resource_1.registerResourceCommand)(program);
|
|
441
14
|
program.parse(process.argv);
|
|
442
15
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAAkC;AAClC,+BAA4B;AAE5B,uCAMqB;AACrB,yCAAoC;AACpC,2CAA4F;AAC5F,+HAAoH;AACpH,2IAAgI;AAChI,6DAA6F;AAC7F,iDAO2B;AAC3B,uDAA4D;AAC5D,uDAA4D;AAC5D,uDAA4D;AAC5D,mDAAkE;AAClE,iDAAsD;AACtD,mDAAwD;AACxD,uDAKoC;AAEpC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAE7F,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpE,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,OAAO,CAAC,CAA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uBAAW,EAAC,cAAc,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AACA,2BAAkC;AAClC,+BAA4B;AAC5B,yCAAoC;AACpC,kDAA8D;AAC9D,kDAA8D;AAE9D,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAE7F,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpE,IAAA,kCAAuB,EAAC,OAAO,CAAC,CAAC;AACjC,IAAA,kCAAuB,EAAC,OAAO,CAAC,CAAC;AAEjC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerGenerateCommand = registerGenerateCommand;
|
|
4
|
+
const utils_1 = require("@ldsg/utils");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const parse_extra_options_1 = require("./utils/parse-extra-options");
|
|
7
|
+
const generate_application_1 = require("./utils/generate-application");
|
|
8
|
+
function registerGenerateCommand(program) {
|
|
9
|
+
program
|
|
10
|
+
.command("generate")
|
|
11
|
+
.aliases(["g", "gen"])
|
|
12
|
+
.description("Generate standalone application from ldsg data source")
|
|
13
|
+
.usage(`[options] [output]\n\n output: output directory for prepared source code, or zip file path when --zip (default: ${constants_1.DEFAULT_OUTPUT_PATH})`)
|
|
14
|
+
.option("--data-uri <uri>", "ldsg source data URI")
|
|
15
|
+
.option("--data-expression <expression>", "ldsg data expression (jsonata), used to convert source data to ldsg data")
|
|
16
|
+
.option("-z, --zip", "write the prepared source code as a zip file")
|
|
17
|
+
.allowUnknownOption(true)
|
|
18
|
+
.action(async (options, command) => {
|
|
19
|
+
const { dataUri, dataExpression, zip: isZip = false } = options;
|
|
20
|
+
const { options: extraOptions, positionals } = (0, parse_extra_options_1.parseExtraOptions)(command.args);
|
|
21
|
+
const outputPath = positionals[positionals.length - 1] ?? constants_1.DEFAULT_OUTPUT_PATH;
|
|
22
|
+
const data = await (0, utils_1.loadData)({
|
|
23
|
+
dataUri,
|
|
24
|
+
dataExpression,
|
|
25
|
+
});
|
|
26
|
+
const generateParams = {
|
|
27
|
+
data,
|
|
28
|
+
outputPath,
|
|
29
|
+
isZip,
|
|
30
|
+
extraOptions,
|
|
31
|
+
};
|
|
32
|
+
await (0, generate_application_1.generateApplication)(generateParams);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/generate/index.ts"],"names":[],"mappings":";;AAYA,0DAyCC;AArDD,uCAAuC;AAEvC,+CAAsD;AACtD,qEAAgE;AAEhE,uEAAmE;AAOnE,SAAgB,uBAAuB,CAAC,OAAgB;IACtD,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,OAAO,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SACrB,WAAW,CAAC,uDAAuD,CAAC;SAGpE,KAAK,CACJ,oHAAoH,+BAAmB,GAAG,CAC3I;SACA,MAAM,CAAC,kBAAkB,EAAE,sBAAsB,CAAC;SAClD,MAAM,CACL,gCAAgC,EAChC,0EAA0E,CAC3E;SACA,MAAM,CAAC,WAAW,EAAE,8CAA8C,CAAC;SACnE,kBAAkB,CAAC,IAAI,CAAC;SACxB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACjC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;QAGhE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,IAAA,uCAAiB,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/E,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,+BAAmB,CAAC;QAE9E,MAAM,IAAI,GAAG,MAAM,IAAA,gBAAQ,EAAC;YAC1B,OAAO;YACP,cAAc;SACf,CAAC,CAAC;QAKH,MAAM,cAAc,GAAmB;YACrC,IAAI;YACJ,UAAU;YACV,KAAK;YACL,YAAY;SACb,CAAC;QAEF,MAAM,IAAA,0CAAmB,EAAC,cAAc,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Data } from "@ldsg/utils";
|
|
2
|
+
export type ExtraOptions = Record<string, string | number | boolean>;
|
|
3
|
+
export interface GenerateParams {
|
|
4
|
+
data: Data;
|
|
5
|
+
outputPath: string;
|
|
6
|
+
isZip: boolean;
|
|
7
|
+
extraOptions?: ExtraOptions;
|
|
8
|
+
}
|
|
9
|
+
export interface GenerateRes {
|
|
10
|
+
archive: Buffer<ArrayBufferLike>;
|
|
11
|
+
}
|
|
12
|
+
export type Generate = (params: GenerateParams) => Promise<GenerateRes>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../../src/commands/generate/types/generate.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../src/commands/generate/types/generator.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./generate"), exports);
|
|
18
|
+
__exportStar(require("./generator"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/generate/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/generate/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GenerateParams } from "@ldsg/types";
|
|
2
|
+
interface GenerateApplicationParams extends GenerateParams {
|
|
3
|
+
}
|
|
4
|
+
type GenerateApplication = (params: GenerateApplicationParams) => Promise<void>;
|
|
5
|
+
export declare const generateApplication: GenerateApplication;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
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.generateApplication = void 0;
|
|
7
|
+
const utils_1 = require("@ldsg/utils");
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const utils_2 = require("./utils");
|
|
11
|
+
const generateApplication = async (params) => {
|
|
12
|
+
const { outputPath, isZip } = params;
|
|
13
|
+
const { metaGenerator } = await (0, utils_2.buildMetaGenerator)(params);
|
|
14
|
+
const { appGenerator } = await (0, utils_2.buildAppGenerator)({ metaGenerator, ...params });
|
|
15
|
+
const generateAppRes = await (0, utils_2.generateApp)({ appGenerator, ...params });
|
|
16
|
+
{
|
|
17
|
+
const { archive } = generateAppRes;
|
|
18
|
+
if (isZip) {
|
|
19
|
+
const zipOutputPath = node_path_1.default.join(outputPath, "app.zip");
|
|
20
|
+
await fs_extra_1.default.outputFile(zipOutputPath, archive);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
(0, utils_1.extractZipToFolder)({ archive, outputPath });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.generateApplication = generateApplication;
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/generate/utils/generate-application/index.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAiD;AACjD,wDAA0B;AAC1B,0DAA6B;AAE7B,mCAA6E;AAatE,MAAM,mBAAmB,GAAwB,KAAK,EAAE,MAAM,EAAE,EAAE;IACvE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAKrC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,IAAA,0BAAkB,EAAC,MAAM,CAAC,CAAC;IAK3D,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,yBAAiB,EAAC,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAK/E,MAAM,cAAc,GAAG,MAAM,IAAA,mBAAW,EAAC,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAKtE,CAAC;QACC,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;QAEnC,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,aAAa,GAAG,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YAEvD,MAAM,kBAAE,CAAC,UAAU,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,IAAA,0BAAkB,EAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAhCW,QAAA,mBAAmB,uBAgC9B"}
|