@kumori/kdsl 0.0.14 → 0.0.16
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/dist/build/deployment_spec.d.ts +2586 -0
- package/dist/build/deployment_spec.js +293 -0
- package/dist/build/deployment_spec.js.map +1 -0
- package/dist/build/helpers/builtin.d.ts +17 -0
- package/dist/build/helpers/builtin.js +80 -0
- package/dist/build/helpers/builtin.js.map +1 -0
- package/dist/build/helpers/component.d.ts +17 -0
- package/dist/build/helpers/component.js +212 -0
- package/dist/build/helpers/component.js.map +1 -0
- package/dist/build/helpers/connector.d.ts +13 -0
- package/dist/build/helpers/connector.js +189 -0
- package/dist/build/helpers/connector.js.map +1 -0
- package/dist/build/helpers/deployment.d.ts +326 -0
- package/dist/build/helpers/deployment.js +85 -0
- package/dist/build/helpers/deployment.js.map +1 -0
- package/dist/build/helpers/resource.d.ts +97 -0
- package/dist/build/helpers/resource.js +54 -0
- package/dist/build/helpers/resource.js.map +1 -0
- package/dist/build/helpers/service.d.ts +27 -0
- package/dist/build/helpers/service.js +196 -0
- package/dist/build/helpers/service.js.map +1 -0
- package/dist/build/helpers/utils.d.ts +30 -0
- package/dist/build/helpers/utils.js +77 -0
- package/dist/build/helpers/utils.js.map +1 -0
- package/dist/build/main.d.ts +17 -0
- package/dist/build/main.js +188 -0
- package/dist/build/main.js.map +1 -0
- package/dist/build/solution.d.ts +20 -0
- package/dist/build/solution.js +71 -0
- package/dist/build/solution.js.map +1 -0
- package/dist/check/main.d.ts +21 -0
- package/dist/check/main.js +99 -0
- package/dist/check/main.js.map +1 -0
- package/dist/clean/main.d.ts +11 -0
- package/dist/clean/main.js +26 -0
- package/dist/clean/main.js.map +1 -0
- package/dist/deployment/gen/deployment-template.kumori +33 -0
- package/dist/deployment/gen/main.d.ts +15 -0
- package/dist/deployment/gen/main.js +158 -0
- package/dist/deployment/gen/main.js.map +1 -0
- package/dist/deployment/gen/types.d.ts +27 -0
- package/dist/deployment/gen/types.js +2 -0
- package/dist/deployment/gen/types.js.map +1 -0
- package/dist/deployment/main.d.ts +8 -0
- package/dist/deployment/main.js +17 -0
- package/dist/deployment/main.js.map +1 -0
- package/dist/help/main.d.ts +13 -0
- package/dist/help/main.js +49 -0
- package/dist/help/main.js.map +1 -0
- package/dist/help/topic/build.d.ts +2 -0
- package/dist/help/topic/build.js +7 -0
- package/dist/help/topic/build.js.map +1 -0
- package/dist/help/topic/mod_dep.d.ts +2 -0
- package/dist/help/topic/mod_dep.js +8 -0
- package/dist/help/topic/mod_dep.js.map +1 -0
- package/dist/help/topic/mod_dl.d.ts +2 -0
- package/dist/help/topic/mod_dl.js +25 -0
- package/dist/help/topic/mod_dl.js.map +1 -0
- package/dist/index/create/main.d.ts +14 -0
- package/dist/index/create/main.js +286 -0
- package/dist/index/create/main.js.map +1 -0
- package/dist/index/main.d.ts +8 -0
- package/dist/index/main.js +17 -0
- package/dist/index/main.js.map +1 -0
- package/dist/lib/build.d.ts +42 -0
- package/dist/lib/build.js +42 -0
- package/dist/lib/build.js.map +1 -0
- package/dist/lib/check.d.ts +41 -0
- package/dist/lib/check.js +45 -0
- package/dist/lib/check.js.map +1 -0
- package/dist/lib/clean.d.ts +31 -0
- package/dist/lib/clean.js +39 -0
- package/dist/lib/clean.js.map +1 -0
- package/dist/lib/deployment.d.ts +35 -0
- package/dist/lib/deployment.js +31 -0
- package/dist/lib/deployment.js.map +1 -0
- package/dist/lib/index-cmd.d.ts +54 -0
- package/dist/lib/index-cmd.js +60 -0
- package/dist/lib/index-cmd.js.map +1 -0
- package/dist/lib/index.d.ts +58 -0
- package/dist/lib/index.js +54 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/io/lib.kumori +5 -0
- package/dist/lib/kumori/builtin/httpinbound.h.kumori +27 -0
- package/dist/lib/kumori/builtin/tcpinbound.h.kumori +25 -0
- package/dist/lib/kumori/builtin.kumori +18 -0
- package/dist/lib/kumori/component.kumori +120 -0
- package/dist/lib/kumori/deployment.kumori +16 -0
- package/dist/lib/kumori/resource.kumori +25 -0
- package/dist/lib/kumori/service.kumori +49 -0
- package/dist/lib/kumori/shared.kumori +11 -0
- package/dist/lib/kumori/sized.kumori +25 -0
- package/dist/lib/logger.d.ts +10 -0
- package/dist/lib/logger.js +23 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/mod.d.ts +156 -0
- package/dist/lib/mod.js +144 -0
- package/dist/lib/mod.js.map +1 -0
- package/dist/lib/registry.d.ts +61 -0
- package/dist/lib/registry.js +67 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/sized.kumori +8 -0
- package/dist/lib/std.kumori +8 -0
- package/dist/lib/strconv/lib.kumori +11 -0
- package/dist/lib/types.d.ts +26 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +37 -0
- package/dist/main.js.map +1 -0
- package/dist/mod/checksum/main.d.ts +11 -0
- package/dist/mod/checksum/main.js +33 -0
- package/dist/mod/checksum/main.js.map +1 -0
- package/dist/mod/dependency/main.d.ts +19 -0
- package/dist/mod/dependency/main.js +163 -0
- package/dist/mod/dependency/main.js.map +1 -0
- package/dist/mod/download/functions.d.ts +53 -0
- package/dist/mod/download/functions.js +235 -0
- package/dist/mod/download/functions.js.map +1 -0
- package/dist/mod/download/main.d.ts +26 -0
- package/dist/mod/download/main.js +99 -0
- package/dist/mod/download/main.js.map +1 -0
- package/dist/mod/init/main.d.ts +13 -0
- package/dist/mod/init/main.js +66 -0
- package/dist/mod/init/main.js.map +1 -0
- package/dist/mod/jsonschema/gen/main.d.ts +11 -0
- package/dist/mod/jsonschema/gen/main.js +288 -0
- package/dist/mod/jsonschema/gen/main.js.map +1 -0
- package/dist/mod/jsonschema/get/kdslschema.d.ts +28 -0
- package/dist/mod/jsonschema/get/kdslschema.js +3 -0
- package/dist/mod/jsonschema/get/kdslschema.js.map +1 -0
- package/dist/mod/jsonschema/get/main.d.ts +76 -0
- package/dist/mod/jsonschema/get/main.js +346 -0
- package/dist/mod/jsonschema/get/main.js.map +1 -0
- package/dist/mod/jsonschema/main.d.ts +8 -0
- package/dist/mod/jsonschema/main.js +20 -0
- package/dist/mod/jsonschema/main.js.map +1 -0
- package/dist/mod/main.d.ts +8 -0
- package/dist/mod/main.js +27 -0
- package/dist/mod/main.js.map +1 -0
- package/dist/mod/update/main.d.ts +17 -0
- package/dist/mod/update/main.js +68 -0
- package/dist/mod/update/main.js.map +1 -0
- package/dist/registry/add.d.ts +15 -0
- package/dist/registry/add.js +58 -0
- package/dist/registry/add.js.map +1 -0
- package/dist/registry/list.d.ts +15 -0
- package/dist/registry/list.js +29 -0
- package/dist/registry/list.js.map +1 -0
- package/dist/registry/main.d.ts +8 -0
- package/dist/registry/main.js +21 -0
- package/dist/registry/main.js.map +1 -0
- package/dist/registry/remove.d.ts +15 -0
- package/dist/registry/remove.js +34 -0
- package/dist/registry/remove.js.map +1 -0
- package/dist/util/err-format.d.ts +2 -0
- package/dist/util/err-format.js +10 -0
- package/dist/util/err-format.js.map +1 -0
- package/dist/util/err-handler.d.ts +3 -0
- package/dist/util/err-handler.js +11 -0
- package/dist/util/err-handler.js.map +1 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.js +2 -0
- package/dist/util.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/out/deployment/gen/deployment-template.kumori +33 -0
- package/out/deployment-template.kumori +33 -0
- package/out/main.cjs +378 -209
- package/package.json +67 -17
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { createKumoriServices } from "@kumori/kdsl-lsp/language/kumori.js";
|
|
2
|
+
import { NodeFileSystem } from "langium/node";
|
|
3
|
+
import { ModuleContext } from "@kumori/kdsl-lsp/module/context.js";
|
|
4
|
+
import { URI } from "langium";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { Result } from "@kumori/kdsl-lsp/util/result.js";
|
|
7
|
+
import { RegistryManager } from "@kumori/kdsl-lsp/module/registry/manager.js";
|
|
8
|
+
import { GatherModuleDocuments } from "@kumori/kdsl-lsp/module/documents.js";
|
|
9
|
+
import { promises as nodefs } from "node:fs";
|
|
10
|
+
import { CalculateChecksum } from "@kumori/kdsl-lsp/module/integrity/checksum.js";
|
|
11
|
+
import { confirm, input } from "@inquirer/prompts";
|
|
12
|
+
import { GetSchema } from "../../mod/jsonschema/get/main.js";
|
|
13
|
+
import { Check } from "../../check/main.js";
|
|
14
|
+
const Summary = `Creates an index file`;
|
|
15
|
+
export const Description = `
|
|
16
|
+
Creates a new index file entry for the current module. Additionally, you can provide
|
|
17
|
+
the location of the module from which generate the entry for.
|
|
18
|
+
|
|
19
|
+
This command will generate the entry for the current module:
|
|
20
|
+
kdsl index create
|
|
21
|
+
|
|
22
|
+
Or you can provide a module location to generate the entry for:
|
|
23
|
+
kdsl index create --module path/to/module
|
|
24
|
+
|
|
25
|
+
The generated index entry will be printed to the standard output. However, you can directly add
|
|
26
|
+
the new entry onto an existing index file by providing the --index option:
|
|
27
|
+
kdsl index create --index path/to/index/file.json
|
|
28
|
+
|
|
29
|
+
If the index file is empty, a new index file will be created with just the new entry. Otherwise,
|
|
30
|
+
if the index file already contains entries, the new entry will be appended to the existing ones.
|
|
31
|
+
`.trim();
|
|
32
|
+
export default { Register };
|
|
33
|
+
export function Register(cmd, log) {
|
|
34
|
+
const c = cmd
|
|
35
|
+
.command("create")
|
|
36
|
+
.option("--module <module>", "Path to the module to generate the index entry for. It can be either a relative or absolute path. Defaults to the current directory.")
|
|
37
|
+
.option("--index <index>", "Path to the index file to append the new entry to. It can be either a relative or absolute path. If not provided, the entry will be printed to standard output.")
|
|
38
|
+
.summary(Summary)
|
|
39
|
+
.description(Description)
|
|
40
|
+
.helpOption(true)
|
|
41
|
+
.showHelpAfterError(true)
|
|
42
|
+
.action(Action(log));
|
|
43
|
+
return c;
|
|
44
|
+
}
|
|
45
|
+
export function Action(log) {
|
|
46
|
+
return async (options) => {
|
|
47
|
+
const svcs = createKumoriServices(NodeFileSystem).Kumori;
|
|
48
|
+
const kumoriFs = svcs.shared.workspace.FileSystemProvider;
|
|
49
|
+
let location = process.cwd();
|
|
50
|
+
if (options.module) {
|
|
51
|
+
const isPath = options.module[0] === "." || path.isAbsolute(options.module);
|
|
52
|
+
if (isPath) {
|
|
53
|
+
// If the path is relative, build an absolute path based on the current working directory
|
|
54
|
+
location = path.isAbsolute(options.module)
|
|
55
|
+
? options.module
|
|
56
|
+
: path.resolve(process.cwd(), options.module);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const ctx = await ModuleContext(kumoriFs, URI.file(location));
|
|
60
|
+
if (Result.isErr(ctx)) {
|
|
61
|
+
throw new Error(ctx.err);
|
|
62
|
+
}
|
|
63
|
+
// The module has been located, it has been downloaded and its context
|
|
64
|
+
// initialized. Now, let's download (and check) its dependencies.
|
|
65
|
+
await Check(log, svcs, ctx.value);
|
|
66
|
+
let indexLocation = null;
|
|
67
|
+
if (options.index) {
|
|
68
|
+
const isPath = options.index[0] === "." || path.isAbsolute(options.index);
|
|
69
|
+
if (isPath) {
|
|
70
|
+
// If the path is relative, build an absolute path based on the current working directory
|
|
71
|
+
indexLocation = path.isAbsolute(options.index)
|
|
72
|
+
? options.index
|
|
73
|
+
: path.resolve(process.cwd(), options.index);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
indexLocation = path.resolve(process.cwd(), options.index);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Read the index file and validate against the JSON Schema
|
|
80
|
+
let parsed = null;
|
|
81
|
+
if (indexLocation) {
|
|
82
|
+
try {
|
|
83
|
+
let data = null;
|
|
84
|
+
try {
|
|
85
|
+
data = await kumoriFs.readFile(URI.file(indexLocation));
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// File does not exist, will create a new one
|
|
89
|
+
data = "";
|
|
90
|
+
}
|
|
91
|
+
if (data === null || data === "") {
|
|
92
|
+
// Empty index file, initialize a new one
|
|
93
|
+
parsed = { modules: [] };
|
|
94
|
+
log.info(`Index file at ${indexLocation} is either missing or empty. A new one will be created.`);
|
|
95
|
+
try {
|
|
96
|
+
await nodefs.mkdir(path.dirname(indexLocation), { recursive: true });
|
|
97
|
+
await nodefs.writeFile(URI.file(indexLocation).fsPath, JSON.stringify(parsed, null, 2));
|
|
98
|
+
log.info(`Created new index file at ${indexLocation}`);
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
log.error(`Failed to create new index file at ${indexLocation}: ${err}`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
data = await kumoriFs.readFile(URI.file(indexLocation));
|
|
107
|
+
parsed = (await JSON.parse(data));
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
throw new Error(`Failed to parse index file at ${indexLocation}: ${e}`);
|
|
111
|
+
}
|
|
112
|
+
const manager = new RegistryManager();
|
|
113
|
+
const isValid = manager.validateIndexSchema(parsed);
|
|
114
|
+
if (!isValid) {
|
|
115
|
+
throw new Error(`Index schema validation failed for ${indexLocation}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
log.error(`Failed to read index file at ${indexLocation}: ${err}`);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Attempt to find the current module in the index file
|
|
124
|
+
let moduleAlreadyInIndex = undefined;
|
|
125
|
+
if (parsed?.modules) {
|
|
126
|
+
moduleAlreadyInIndex = parsed.modules.find((m) => m.domain === ctx.value.Current.Manifest.module &&
|
|
127
|
+
m.version === ctx.value.Current.Manifest.version);
|
|
128
|
+
}
|
|
129
|
+
if (moduleAlreadyInIndex) {
|
|
130
|
+
log.warn(`Module ${moduleAlreadyInIndex.domain} version ${moduleAlreadyInIndex.version} already exists in the index file at ${indexLocation}. Proceeding will override the current entry.`);
|
|
131
|
+
const proceed = await confirm({
|
|
132
|
+
message: `Do you want to proceed anyway?`,
|
|
133
|
+
default: false,
|
|
134
|
+
});
|
|
135
|
+
if (!proceed) {
|
|
136
|
+
log.info(`Aborting index entry creation.`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Gather all module documents
|
|
141
|
+
const moduleDocuments = await GatherModuleDocuments(svcs.shared, ctx.value.Current.Root);
|
|
142
|
+
const artifactNames = [];
|
|
143
|
+
for (const doc of moduleDocuments) {
|
|
144
|
+
const fileName = path.basename(doc.path);
|
|
145
|
+
if (fileName.endsWith(".h.kumori")) {
|
|
146
|
+
// Remove location and filename from the path to get the route
|
|
147
|
+
const route = doc.path.substring(URI.parse(location).fsPath.length);
|
|
148
|
+
const routeWithoutFileName = path.dirname(route);
|
|
149
|
+
const content = await kumoriFs.readFile(doc);
|
|
150
|
+
const lines = content.split("\n");
|
|
151
|
+
// Find package name from the file content
|
|
152
|
+
let packageName = "";
|
|
153
|
+
for (const line of lines) {
|
|
154
|
+
const packageMatch = line.match(/package\s+(\w+)/);
|
|
155
|
+
if (packageMatch) {
|
|
156
|
+
packageName = packageMatch[1];
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
for (const line of lines) {
|
|
161
|
+
const serviceMatch = line.match(/service\s+(\w+)/);
|
|
162
|
+
const componentMatch = line.match(/component\s+(\w+)/);
|
|
163
|
+
if (serviceMatch) {
|
|
164
|
+
artifactNames.push({
|
|
165
|
+
location: routeWithoutFileName,
|
|
166
|
+
package: packageName,
|
|
167
|
+
name: serviceMatch[1],
|
|
168
|
+
type: "service",
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
else if (componentMatch) {
|
|
172
|
+
artifactNames.push({
|
|
173
|
+
location: routeWithoutFileName,
|
|
174
|
+
package: packageName,
|
|
175
|
+
name: componentMatch[1],
|
|
176
|
+
type: "component",
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const currentManifest = ctx.value.Current.Manifest;
|
|
183
|
+
const checksum = await CalculateChecksum(location);
|
|
184
|
+
// Prompt the user for the module location
|
|
185
|
+
const moduleLocation = await input({
|
|
186
|
+
message: "Enter the module location (remember it has to be a valid Git repository):",
|
|
187
|
+
required: true,
|
|
188
|
+
});
|
|
189
|
+
const moduleEntry = {
|
|
190
|
+
domain: currentManifest.module,
|
|
191
|
+
version: currentManifest.version,
|
|
192
|
+
location: moduleLocation,
|
|
193
|
+
checksum: checksum,
|
|
194
|
+
releaseDate: new Date().toISOString().split("T")[0],
|
|
195
|
+
artifacts: [],
|
|
196
|
+
};
|
|
197
|
+
// For each artifact, create an index entry
|
|
198
|
+
for (const artifact of artifactNames) {
|
|
199
|
+
// Ask the user if we want to include this artifact
|
|
200
|
+
const includeArtifact = await confirm({
|
|
201
|
+
message: `Do you want to include artifact ${artifact.name} located at route ${artifact.location} in the index?`,
|
|
202
|
+
default: true,
|
|
203
|
+
});
|
|
204
|
+
if (!includeArtifact) {
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
// Generate the JSON Schema for the given artifact
|
|
208
|
+
const artifactSchema = await GetSchema(svcs, ctx.value, artifact.location, artifact.name);
|
|
209
|
+
if (Result.isErr(artifactSchema)) {
|
|
210
|
+
throw new Error(`Failed to generate JSON Schema for artifact ${artifact.name} at route ${artifact.location}: ${artifactSchema.err}`);
|
|
211
|
+
}
|
|
212
|
+
// Let's start asking the user for input for this artifact
|
|
213
|
+
let artifactLocation = "";
|
|
214
|
+
if (artifact.location === "") {
|
|
215
|
+
artifactLocation = artifact.package;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
artifactLocation =
|
|
219
|
+
artifact.package !== ""
|
|
220
|
+
? `${artifact.location}/${artifact.package}`
|
|
221
|
+
: artifact.location;
|
|
222
|
+
}
|
|
223
|
+
const artifactRoute = await input({
|
|
224
|
+
message: `Enter the <route>/<package> for artifact ${artifact.name} (default: ${artifactLocation}):`,
|
|
225
|
+
default: artifactLocation,
|
|
226
|
+
required: true,
|
|
227
|
+
});
|
|
228
|
+
const artifactDescription = await input({
|
|
229
|
+
message: `Enter a description for artifact ${artifact.name} (optional):`,
|
|
230
|
+
});
|
|
231
|
+
const publishToMarketPlace = await confirm({
|
|
232
|
+
message: `Do you want to publish artifact ${artifact.name} to the marketplace?`,
|
|
233
|
+
default: true,
|
|
234
|
+
});
|
|
235
|
+
const iconRoute = await input({
|
|
236
|
+
message: `Enter an icon route for artifact ${artifact.name}. This is an optional field and it should be a path to an image file within the artifact route.
|
|
237
|
+
For example, your icon could be located at ${artifactRoute}/icon.png or ${artifactRoute}/img/icon.jpg`,
|
|
238
|
+
});
|
|
239
|
+
const categories = await input({
|
|
240
|
+
message: `Enter categories for artifact ${artifact.name}, separated by commas. For example: utility,network,storage (optional):`,
|
|
241
|
+
}).then((res) => (res ? res.split(",").map((c) => c.trim()) : []));
|
|
242
|
+
const tags = await input({
|
|
243
|
+
message: `Enter tags for artifact ${artifact.name}, separated by commas. For example: sql,database,relational (optional):`,
|
|
244
|
+
}).then((res) => (res ? res.split(",").map((t) => t.trim()) : []));
|
|
245
|
+
moduleEntry.artifacts.push({
|
|
246
|
+
name: artifact.name,
|
|
247
|
+
description: artifactDescription,
|
|
248
|
+
location: artifactRoute,
|
|
249
|
+
type: artifact.type,
|
|
250
|
+
marketplace: publishToMarketPlace,
|
|
251
|
+
schema: artifactSchema.value,
|
|
252
|
+
icon: iconRoute,
|
|
253
|
+
categories: categories,
|
|
254
|
+
tags: tags,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
if (indexLocation && parsed) {
|
|
258
|
+
if (!moduleAlreadyInIndex) {
|
|
259
|
+
parsed.modules.push(moduleEntry);
|
|
260
|
+
const updatedIndex = JSON.stringify(parsed, null, 2);
|
|
261
|
+
await nodefs.writeFile(URI.file(indexLocation).fsPath, updatedIndex);
|
|
262
|
+
log.info(`Appended new module entry to index file at ${indexLocation}`);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
// Override existing module entry
|
|
266
|
+
parsed.modules = parsed.modules.map((m) => {
|
|
267
|
+
if (m.domain === moduleAlreadyInIndex.domain &&
|
|
268
|
+
m.version === moduleAlreadyInIndex.version) {
|
|
269
|
+
return moduleEntry;
|
|
270
|
+
}
|
|
271
|
+
return m;
|
|
272
|
+
});
|
|
273
|
+
const updatedIndex = JSON.stringify(parsed, null, 2);
|
|
274
|
+
await nodefs.writeFile(URI.file(indexLocation).fsPath, updatedIndex);
|
|
275
|
+
log.info(`Updated module entry in index file at ${indexLocation}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
const newIndex = {
|
|
280
|
+
modules: [moduleEntry],
|
|
281
|
+
};
|
|
282
|
+
console.log(JSON.stringify(newIndex, null, 2));
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/index/create/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAG1E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAKxD,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AAC5E,OAAO,EAAE,QAAQ,IAAI,MAAM,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,EAAE,O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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import { ILogLayer } from "loglayer";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
Register: typeof Register;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare function Register(cmd: Command, log: ILogLayer): Command<[], {}, {}>;
|
|
8
|
+
export declare const Description: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import create from "./create/main.js";
|
|
2
|
+
export default { Register };
|
|
3
|
+
export function Register(cmd, log) {
|
|
4
|
+
const program = cmd
|
|
5
|
+
.command("index")
|
|
6
|
+
.summary(Summary)
|
|
7
|
+
.description(Description)
|
|
8
|
+
.helpCommand(false)
|
|
9
|
+
.helpOption(false);
|
|
10
|
+
create.Register(program, log);
|
|
11
|
+
return program;
|
|
12
|
+
}
|
|
13
|
+
const Summary = `index operations`;
|
|
14
|
+
export const Description = `
|
|
15
|
+
Provides access to operations over indexes.
|
|
16
|
+
`.trim();
|
|
17
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/index/main.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,kBAAkB,CAAA;AAErC,eAAe,EAAE,QAAQ,EAAE,CAAA;AAC3B,MAAM,UAAU,QAAQ,CAAC,GAAY,EAAE,GAAc;IACnD,MAAM,OAAO,GAAG,GAAG;SAChB,OAAO,CAAC,OAAO,CAAC;SAChB,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,WAAW,CAAC;SACxB,WAAW,CAAC,KAAK,CAAC;SAClB,UAAU,CAAC,KAAK,CAAC,CAAA;IAEpB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;IAE7B,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,OAAO,GAAG,kBAAkB,CAAA;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG;;CAE1B,CAAC,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { LibraryOptions, LibraryResult } from "./types.js";
|
|
2
|
+
export interface BuildOptions extends LibraryOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Package containing the target deployment.
|
|
5
|
+
* Defaults to '.' (current directory)
|
|
6
|
+
*/
|
|
7
|
+
package?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Directory containing the Kumori module.
|
|
10
|
+
* Defaults to cwd or '.'
|
|
11
|
+
*/
|
|
12
|
+
directory?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Produces deployable artifact specifications.
|
|
16
|
+
* Generates a solution.json file for a specified Kumori package.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Build command options
|
|
19
|
+
* @returns Result with void on success, or string[] of errors
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { createKumoriServices } from '@kumori/kdsl-lsp/language/kumori.js'
|
|
24
|
+
* import { NodeFileSystem } from 'langium/node'
|
|
25
|
+
* import { build } from '@kumori/kdsl'
|
|
26
|
+
*
|
|
27
|
+
* const services = createKumoriServices(NodeFileSystem).Kumori
|
|
28
|
+
*
|
|
29
|
+
* const result = await build({
|
|
30
|
+
* services,
|
|
31
|
+
* package: 'my-package',
|
|
32
|
+
* directory: '.'
|
|
33
|
+
* })
|
|
34
|
+
*
|
|
35
|
+
* if (result.ok) {
|
|
36
|
+
* console.log('Build succeeded!')
|
|
37
|
+
* } else {
|
|
38
|
+
* console.error('Errors:', result.err)
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function build(options: BuildOptions): Promise<LibraryResult<void>>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { getLogger } from "./logger.js";
|
|
2
|
+
import { RegistryManager } from "@kumori/kdsl-lsp/module/registry/manager.js";
|
|
3
|
+
import { BuildImpl } from "../build/main.js";
|
|
4
|
+
/**
|
|
5
|
+
* Produces deployable artifact specifications.
|
|
6
|
+
* Generates a solution.json file for a specified Kumori package.
|
|
7
|
+
*
|
|
8
|
+
* @param options - Build command options
|
|
9
|
+
* @returns Result with void on success, or string[] of errors
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { createKumoriServices } from '@kumori/kdsl-lsp/language/kumori.js'
|
|
14
|
+
* import { NodeFileSystem } from 'langium/node'
|
|
15
|
+
* import { build } from '@kumori/kdsl'
|
|
16
|
+
*
|
|
17
|
+
* const services = createKumoriServices(NodeFileSystem).Kumori
|
|
18
|
+
*
|
|
19
|
+
* const result = await build({
|
|
20
|
+
* services,
|
|
21
|
+
* package: 'my-package',
|
|
22
|
+
* directory: '.'
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* if (result.ok) {
|
|
26
|
+
* console.log('Build succeeded!')
|
|
27
|
+
* } else {
|
|
28
|
+
* console.error('Errors:', result.err)
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export async function build(options) {
|
|
33
|
+
const log = getLogger(options.logger);
|
|
34
|
+
const pkgStr = options.package ?? ".";
|
|
35
|
+
const target = options.directory ?? options.cwd ?? ".";
|
|
36
|
+
const svcs = options.services;
|
|
37
|
+
const manager = new RegistryManager();
|
|
38
|
+
await manager.ensureIndexes();
|
|
39
|
+
// Use the shared BuildImpl function
|
|
40
|
+
return await BuildImpl(log, svcs, pkgStr, target);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/lib/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAgB5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,OAAqB;IAErB,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACrC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,IAAI,GAAG,CAAA;IACrC,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,CAAA;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAA;IAE7B,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAA;IACrC,MAAM,OAAO,CAAC,aAAa,EAAE,CAAA;IAE7B,oCAAoC;IACpC,OAAO,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LibraryOptions, LibraryResult } from "./types.js";
|
|
2
|
+
export interface CheckOptions extends LibraryOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Directory containing the module to check.
|
|
5
|
+
* Defaults to cwd or '.'
|
|
6
|
+
*/
|
|
7
|
+
directory?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Skip downloading dependencies before checking.
|
|
10
|
+
* Defaults to false.
|
|
11
|
+
*/
|
|
12
|
+
skipDownload?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Typecheck and validate a Kumori module.
|
|
16
|
+
* Downloads dependencies unless skipDownload is true.
|
|
17
|
+
*
|
|
18
|
+
* @param options - Check command options
|
|
19
|
+
* @returns Result with void on success, or string[] of errors
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { createKumoriServices } from '@kumori/kdsl-lsp/language/kumori.js'
|
|
24
|
+
* import { NodeFileSystem } from 'langium/node'
|
|
25
|
+
* import { check } from '@kumori/kdsl'
|
|
26
|
+
*
|
|
27
|
+
* const services = createKumoriServices(NodeFileSystem).Kumori
|
|
28
|
+
*
|
|
29
|
+
* const result = await check({
|
|
30
|
+
* services,
|
|
31
|
+
* directory: './my-module'
|
|
32
|
+
* })
|
|
33
|
+
*
|
|
34
|
+
* if (result.ok) {
|
|
35
|
+
* console.log('Check passed!')
|
|
36
|
+
* } else {
|
|
37
|
+
* console.error('Errors:', result.err)
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function check(options: CheckOptions): Promise<LibraryResult<void>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getLogger } from "./logger.js";
|
|
2
|
+
import { Check as CheckImpl } from "../check/main.js";
|
|
3
|
+
import { ModuleContext } from "@kumori/kdsl-lsp/module/context.js";
|
|
4
|
+
import { URI } from "langium";
|
|
5
|
+
import { Result, Err } from "@kumori/kdsl-lsp/util/result.js";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
/**
|
|
8
|
+
* Typecheck and validate a Kumori module.
|
|
9
|
+
* Downloads dependencies unless skipDownload is true.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Check command options
|
|
12
|
+
* @returns Result with void on success, or string[] of errors
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { createKumoriServices } from '@kumori/kdsl-lsp/language/kumori.js'
|
|
17
|
+
* import { NodeFileSystem } from 'langium/node'
|
|
18
|
+
* import { check } from '@kumori/kdsl'
|
|
19
|
+
*
|
|
20
|
+
* const services = createKumoriServices(NodeFileSystem).Kumori
|
|
21
|
+
*
|
|
22
|
+
* const result = await check({
|
|
23
|
+
* services,
|
|
24
|
+
* directory: './my-module'
|
|
25
|
+
* })
|
|
26
|
+
*
|
|
27
|
+
* if (result.ok) {
|
|
28
|
+
* console.log('Check passed!')
|
|
29
|
+
* } else {
|
|
30
|
+
* console.error('Errors:', result.err)
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export async function check(options) {
|
|
35
|
+
const log = getLogger(options.logger);
|
|
36
|
+
const target = options.directory ?? options.cwd ?? ".";
|
|
37
|
+
const svcs = options.services;
|
|
38
|
+
const fs = svcs.shared.workspace.FileSystemProvider;
|
|
39
|
+
const ctx = await ModuleContext(fs, URI.file(path.resolve(target)));
|
|
40
|
+
if (Result.isErr(ctx)) {
|
|
41
|
+
return Err([ctx.err]);
|
|
42
|
+
}
|
|
43
|
+
return await CheckImpl(log, svcs, ctx.value);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/lib/check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAA;AAgB5B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,OAAqB;IAErB,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACrC,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,CAAA;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAA;IAE7B,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAA;IACnD,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IAEnE,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,OAAO,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;AAC9C,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LibraryOptions, LibraryResult } from "./types.js";
|
|
2
|
+
export interface CleanOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Optional logger for output.
|
|
5
|
+
* If not provided, a silent logger is used.
|
|
6
|
+
*/
|
|
7
|
+
logger?: LibraryOptions["logger"];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Remove cached files.
|
|
11
|
+
*
|
|
12
|
+
* The kdsl command builds most artifacts in a temporary directory,
|
|
13
|
+
* so clean is mainly concerned with files left by manual invocations.
|
|
14
|
+
*
|
|
15
|
+
* @param options - Clean command options
|
|
16
|
+
* @returns Result with void on success, or string[] of errors
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { clean } from '@kumori/kdsl'
|
|
21
|
+
*
|
|
22
|
+
* const result = await clean()
|
|
23
|
+
*
|
|
24
|
+
* if (result.ok) {
|
|
25
|
+
* console.log('Cache cleaned!')
|
|
26
|
+
* } else {
|
|
27
|
+
* console.error('Errors:', result.err)
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function clean(options?: CleanOptions): Promise<LibraryResult<void>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getLogger } from "./logger.js";
|
|
2
|
+
import { TempCache } from "@kumori/kdsl-lsp/util/tmp.js";
|
|
3
|
+
import { rm } from "fs/promises";
|
|
4
|
+
import { Ok, Err } from "@kumori/kdsl-lsp/util/result.js";
|
|
5
|
+
/**
|
|
6
|
+
* Remove cached files.
|
|
7
|
+
*
|
|
8
|
+
* The kdsl command builds most artifacts in a temporary directory,
|
|
9
|
+
* so clean is mainly concerned with files left by manual invocations.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Clean command options
|
|
12
|
+
* @returns Result with void on success, or string[] of errors
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { clean } from '@kumori/kdsl'
|
|
17
|
+
*
|
|
18
|
+
* const result = await clean()
|
|
19
|
+
*
|
|
20
|
+
* if (result.ok) {
|
|
21
|
+
* console.log('Cache cleaned!')
|
|
22
|
+
* } else {
|
|
23
|
+
* console.error('Errors:', result.err)
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export async function clean(options = {}) {
|
|
28
|
+
const log = getLogger(options.logger);
|
|
29
|
+
try {
|
|
30
|
+
const location = await TempCache();
|
|
31
|
+
log.info(location.fsPath);
|
|
32
|
+
await rm(location.fsPath, { force: true, recursive: true });
|
|
33
|
+
return Ok(undefined);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
return Err([String(err)]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=clean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean.js","sourceRoot":"","sources":["../../src/lib/clean.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAA;AAUzD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,UAAwB,EAAE;IAE1B,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAErC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,SAAS,EAAE,CAAA;QAClC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QACzB,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAC3D,OAAO,EAAE,CAAO,SAAS,CAAC,CAAA;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC3B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LibraryOptions, LibraryResult } from "./types.js";
|
|
2
|
+
export interface DeploymentGenOptions extends LibraryOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Path to the deployment-config.json file.
|
|
5
|
+
* Defaults to 'deployment-config.json' in the current directory.
|
|
6
|
+
*/
|
|
7
|
+
input?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Output directory for generated deployment artifacts.
|
|
10
|
+
* Defaults to cwd or '.'
|
|
11
|
+
*/
|
|
12
|
+
output?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generates deployment artifacts based on the provided deployment configuration.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Deployment generation options
|
|
18
|
+
* @returns Promise that resolves when generation is complete
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { createKumoriServices } from '@kumori/kdsl-lsp/language/kumori.js'
|
|
23
|
+
* import { NodeFileSystem } from 'langium/node'
|
|
24
|
+
* import { generateDeployment } from '@kumori/kdsl'
|
|
25
|
+
*
|
|
26
|
+
* const services = createKumoriServices(NodeFileSystem).Kumori
|
|
27
|
+
*
|
|
28
|
+
* await generateDeployment({
|
|
29
|
+
* services,
|
|
30
|
+
* input: 'path/to/deployment-config.json',
|
|
31
|
+
* output: 'path/to/output/directory'
|
|
32
|
+
* })
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function generateDeployment(options: DeploymentGenOptions): Promise<LibraryResult<void>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getLogger } from "./logger.js";
|
|
2
|
+
import { GenDeployment } from "../deployment/gen/main.js";
|
|
3
|
+
/**
|
|
4
|
+
* Generates deployment artifacts based on the provided deployment configuration.
|
|
5
|
+
*
|
|
6
|
+
* @param options - Deployment generation options
|
|
7
|
+
* @returns Promise that resolves when generation is complete
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createKumoriServices } from '@kumori/kdsl-lsp/language/kumori.js'
|
|
12
|
+
* import { NodeFileSystem } from 'langium/node'
|
|
13
|
+
* import { generateDeployment } from '@kumori/kdsl'
|
|
14
|
+
*
|
|
15
|
+
* const services = createKumoriServices(NodeFileSystem).Kumori
|
|
16
|
+
*
|
|
17
|
+
* await generateDeployment({
|
|
18
|
+
* services,
|
|
19
|
+
* input: 'path/to/deployment-config.json',
|
|
20
|
+
* output: 'path/to/output/directory'
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export async function generateDeployment(options) {
|
|
25
|
+
const log = getLogger(options.logger);
|
|
26
|
+
const inputPath = options.input ?? "deployment-config.json";
|
|
27
|
+
const outputDir = options.output ?? options.cwd ?? ".";
|
|
28
|
+
const svcs = options.services;
|
|
29
|
+
return await GenDeployment(log, svcs, inputPath, outputDir);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=deployment.js.map
|