@akanjs/devkit 0.9.58 → 0.9.59
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/cjs/src/aiEditor.js +1 -1
- package/cjs/src/auth.js +1 -1
- package/cjs/src/capacitorApp.js +8 -8
- package/cjs/src/commandDecorators/command.js +11 -8
- package/cjs/src/executors.js +11 -7
- package/cjs/src/scanInfo.js +25 -26
- package/cjs/src/spinner.js +2 -2
- package/esm/src/aiEditor.js +1 -1
- package/esm/src/auth.js +1 -1
- package/esm/src/capacitorApp.js +8 -8
- package/esm/src/commandDecorators/command.js +11 -8
- package/esm/src/executors.js +11 -7
- package/esm/src/scanInfo.js +25 -26
- package/esm/src/spinner.js +2 -2
- package/package.json +1 -1
- package/src/commandDecorators/argMeta.d.ts +4 -1
- package/src/executors.d.ts +7 -3
package/cjs/src/aiEditor.js
CHANGED
package/cjs/src/auth.js
CHANGED
|
@@ -50,7 +50,7 @@ const getHostConfig = (host = import_constants.akanCloudHost) => {
|
|
|
50
50
|
};
|
|
51
51
|
const setHostConfig = (host = import_constants.akanCloudHost, config = {}) => {
|
|
52
52
|
const akanConfig = getAkanGlobalConfig();
|
|
53
|
-
akanConfig[host] = config;
|
|
53
|
+
akanConfig.cloudHost[host] = config;
|
|
54
54
|
setAkanGlobalConfig(akanConfig);
|
|
55
55
|
};
|
|
56
56
|
const getSelf = async (token) => {
|
package/cjs/src/capacitorApp.js
CHANGED
|
@@ -37,24 +37,24 @@ var import_fileEditor = require("./fileEditor");
|
|
|
37
37
|
class CapacitorApp {
|
|
38
38
|
constructor(app) {
|
|
39
39
|
this.app = app;
|
|
40
|
+
this.project = new import_project.MobileProject(this.app.cwdPath, {
|
|
41
|
+
android: { path: "android" },
|
|
42
|
+
ios: { path: "ios/App" }
|
|
43
|
+
});
|
|
40
44
|
}
|
|
41
45
|
project;
|
|
42
46
|
iosTargetName = "App";
|
|
43
47
|
async init() {
|
|
44
|
-
const project =
|
|
45
|
-
|
|
46
|
-
ios: { path: "ios/App" }
|
|
47
|
-
});
|
|
48
|
-
await project.load();
|
|
48
|
+
const project = this.project;
|
|
49
|
+
await this.project.load();
|
|
49
50
|
if (!project.android) {
|
|
50
51
|
await this.app.spawn("npx", ["cap", "add", "android"]);
|
|
51
|
-
await project.load();
|
|
52
|
+
await this.project.load();
|
|
52
53
|
}
|
|
53
54
|
if (!project.ios) {
|
|
54
55
|
await this.app.spawn("npx", ["cap", "add", "ios"]);
|
|
55
|
-
await project.load();
|
|
56
|
+
await this.project.load();
|
|
56
57
|
}
|
|
57
|
-
this.project = project;
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
60
60
|
async save() {
|
|
@@ -47,13 +47,16 @@ const handleOption = (programCommand, argMeta) => {
|
|
|
47
47
|
flag = argMeta.name.slice(0, 1).toLowerCase(),
|
|
48
48
|
desc = argMeta.name,
|
|
49
49
|
example,
|
|
50
|
-
enum:
|
|
50
|
+
enum: enumChoices,
|
|
51
51
|
ask
|
|
52
52
|
} = argMeta.argsOption;
|
|
53
53
|
const kebabName = camelToKebabCase(argMeta.name);
|
|
54
|
+
const choices = enumChoices?.map(
|
|
55
|
+
(choice) => typeof choice === "object" ? { value: choice.value, name: choice.label } : { value: choice, name: choice.toString() }
|
|
56
|
+
);
|
|
54
57
|
programCommand.option(
|
|
55
58
|
`-${flag}, --${kebabName}${type === "boolean" ? " [boolean]" : ` <${kebabName}>`}`,
|
|
56
|
-
`${desc}${ask ? ` (${ask})` : ""}${example ? ` (example: ${example})` : ""}${choices ? ` (choices: ${choices.join(", ")})` : ""}`
|
|
59
|
+
`${desc}${ask ? ` (${ask})` : ""}${example ? ` (example: ${example})` : ""}${choices ? ` (choices: ${choices.map((choice) => choice.name).join(", ")})` : ""}`
|
|
57
60
|
);
|
|
58
61
|
return programCommand;
|
|
59
62
|
};
|
|
@@ -78,7 +81,7 @@ const convertOptionValue = (value, type) => {
|
|
|
78
81
|
const getOptionValue = async (argMeta, opt) => {
|
|
79
82
|
const {
|
|
80
83
|
name,
|
|
81
|
-
argsOption: { enum:
|
|
84
|
+
argsOption: { enum: enumChoices, default: defaultValue, type, desc, nullable, example, ask }
|
|
82
85
|
} = argMeta;
|
|
83
86
|
if (opt[argMeta.name] !== void 0)
|
|
84
87
|
return convertOptionValue(opt[argMeta.name], type ?? "string");
|
|
@@ -86,11 +89,11 @@ const getOptionValue = async (argMeta, opt) => {
|
|
|
86
89
|
return defaultValue;
|
|
87
90
|
else if (nullable)
|
|
88
91
|
return null;
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
92
|
+
if (enumChoices) {
|
|
93
|
+
const choices = enumChoices.map(
|
|
94
|
+
(choice2) => typeof choice2 === "object" ? { value: choice2.value, name: choice2.label } : { value: choice2, name: choice2.toString() }
|
|
95
|
+
);
|
|
96
|
+
const choice = await (0, import_prompts.select)({ message: ask ?? desc ?? `Select the ${name} value`, choices });
|
|
94
97
|
return choice;
|
|
95
98
|
} else if (type === "boolean") {
|
|
96
99
|
const message = ask ?? desc ?? `Do you want to set ${name}? ${desc ? ` (${desc})` : ""}: `;
|
package/cjs/src/executors.js
CHANGED
|
@@ -330,10 +330,10 @@ class Executor {
|
|
|
330
330
|
targetPath,
|
|
331
331
|
scanInfo,
|
|
332
332
|
overwrite = true
|
|
333
|
-
}, dict = {}) {
|
|
333
|
+
}, dict = {}, options = {}) {
|
|
334
334
|
if (targetPath.endsWith(".js") || targetPath.endsWith(".jsx")) {
|
|
335
335
|
const getContent = await import(templatePath);
|
|
336
|
-
const result = getContent.default(scanInfo ?? null, dict);
|
|
336
|
+
const result = getContent.default(scanInfo ?? null, dict, options);
|
|
337
337
|
if (result === null)
|
|
338
338
|
return null;
|
|
339
339
|
const filename = typeof result === "object" ? result.filename : import_path.default.basename(targetPath).replace(".js", ".ts");
|
|
@@ -365,6 +365,7 @@ class Executor {
|
|
|
365
365
|
template,
|
|
366
366
|
scanInfo,
|
|
367
367
|
dict = {},
|
|
368
|
+
options = {},
|
|
368
369
|
overwrite = true
|
|
369
370
|
}) {
|
|
370
371
|
const templatePath = `${(0, import_getDirname.getDirname)(import_meta.url)}/src/templates${template ? `/${template}` : ""}`;
|
|
@@ -373,7 +374,8 @@ class Executor {
|
|
|
373
374
|
const filename = import_path.default.basename(prefixTemplatePath);
|
|
374
375
|
const fileContent = await this.#applyTemplateFile(
|
|
375
376
|
{ templatePath: prefixTemplatePath, targetPath: import_path.default.join(basePath, filename), scanInfo, overwrite },
|
|
376
|
-
dict
|
|
377
|
+
dict,
|
|
378
|
+
options
|
|
377
379
|
);
|
|
378
380
|
return fileContent ? [fileContent] : [];
|
|
379
381
|
} else {
|
|
@@ -384,7 +386,8 @@ class Executor {
|
|
|
384
386
|
if (import_fs.default.statSync(subpath).isFile()) {
|
|
385
387
|
const fileContent = await this.#applyTemplateFile(
|
|
386
388
|
{ templatePath: subpath, targetPath: import_path.default.join(basePath, subdir), scanInfo, overwrite },
|
|
387
|
-
dict
|
|
389
|
+
dict,
|
|
390
|
+
options
|
|
388
391
|
);
|
|
389
392
|
return fileContent ? [fileContent] : [];
|
|
390
393
|
} else
|
|
@@ -393,7 +396,8 @@ class Executor {
|
|
|
393
396
|
template: import_path.default.join(template, subdir),
|
|
394
397
|
scanInfo,
|
|
395
398
|
dict,
|
|
396
|
-
overwrite
|
|
399
|
+
overwrite,
|
|
400
|
+
options
|
|
397
401
|
});
|
|
398
402
|
})
|
|
399
403
|
)).flat();
|
|
@@ -634,6 +638,7 @@ class SysExecutor extends Executor {
|
|
|
634
638
|
const scanInfo = this.type === "app" ? await import_scanInfo.AppInfo.fromExecutor(this, { refresh }) : await import_scanInfo.LibInfo.fromExecutor(this, { refresh });
|
|
635
639
|
if (write) {
|
|
636
640
|
await Promise.all([
|
|
641
|
+
this._applyTemplate({ basePath: "env", template: "env", scanInfo }),
|
|
637
642
|
this._applyTemplate({ basePath: "lib", template: "lib", scanInfo }),
|
|
638
643
|
this._applyTemplate({ basePath: ".", template: "server.ts", scanInfo }),
|
|
639
644
|
this._applyTemplate({ basePath: ".", template: "client.ts", scanInfo }),
|
|
@@ -662,6 +667,7 @@ class SysExecutor extends Executor {
|
|
|
662
667
|
const libInfos = [...scanInfo.getLibInfos().values()];
|
|
663
668
|
await Promise.all(
|
|
664
669
|
libInfos.map((libInfo) => [
|
|
670
|
+
libInfo.exec._applyTemplate({ basePath: "env", template: "env", scanInfo: libInfo }),
|
|
665
671
|
libInfo.exec._applyTemplate({ basePath: "lib", template: "lib", scanInfo: libInfo }),
|
|
666
672
|
libInfo.exec._applyTemplate({ basePath: ".", template: "server.ts", scanInfo: libInfo }),
|
|
667
673
|
libInfo.exec._applyTemplate({ basePath: ".", template: "client.ts", scanInfo: libInfo }),
|
|
@@ -859,8 +865,6 @@ class AppExecutor extends SysExecutor {
|
|
|
859
865
|
}
|
|
860
866
|
}
|
|
861
867
|
class LibExecutor extends SysExecutor {
|
|
862
|
-
workspaceRoot;
|
|
863
|
-
repoName;
|
|
864
868
|
dist;
|
|
865
869
|
emoji = execEmoji.lib;
|
|
866
870
|
constructor({ workspace, name }) {
|
package/cjs/src/scanInfo.js
CHANGED
|
@@ -206,32 +206,31 @@ class ScanInfo {
|
|
|
206
206
|
constructor(scanResult) {
|
|
207
207
|
this.name = scanResult.name;
|
|
208
208
|
this.scanResult = scanResult;
|
|
209
|
-
Object.entries(scanResult.files).forEach(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
);
|
|
209
|
+
Object.entries(scanResult.files).forEach(([_key, value]) => {
|
|
210
|
+
const key = _key;
|
|
211
|
+
const { databases, services, scalars } = value;
|
|
212
|
+
databases.forEach((modelName) => {
|
|
213
|
+
const model = this.database.get(modelName) ?? /* @__PURE__ */ new Set();
|
|
214
|
+
model.add(key);
|
|
215
|
+
this.database.set(modelName, model);
|
|
216
|
+
this.file[key].all.add(modelName);
|
|
217
|
+
this.file[key].databases.add(modelName);
|
|
218
|
+
});
|
|
219
|
+
services?.forEach((serviceName) => {
|
|
220
|
+
const service = this.service.get(serviceName) ?? /* @__PURE__ */ new Set();
|
|
221
|
+
service.add(key);
|
|
222
|
+
this.service.set(serviceName, service);
|
|
223
|
+
this.file[key].all.add(serviceName);
|
|
224
|
+
this.file[key].services.add(serviceName);
|
|
225
|
+
});
|
|
226
|
+
scalars?.forEach((scalarName) => {
|
|
227
|
+
const scalar = this.scalar.get(scalarName) ?? /* @__PURE__ */ new Set();
|
|
228
|
+
scalar.add(key);
|
|
229
|
+
this.scalar.set(scalarName, scalar);
|
|
230
|
+
this.file[key].all.add(scalarName);
|
|
231
|
+
this.file[key].scalars.add(scalarName);
|
|
232
|
+
});
|
|
233
|
+
});
|
|
235
234
|
}
|
|
236
235
|
getScanResult() {
|
|
237
236
|
return this.scanResult;
|
package/cjs/src/spinner.js
CHANGED
package/esm/src/aiEditor.js
CHANGED
package/esm/src/auth.js
CHANGED
|
@@ -21,7 +21,7 @@ const getHostConfig = (host = akanCloudHost) => {
|
|
|
21
21
|
};
|
|
22
22
|
const setHostConfig = (host = akanCloudHost, config = {}) => {
|
|
23
23
|
const akanConfig = getAkanGlobalConfig();
|
|
24
|
-
akanConfig[host] = config;
|
|
24
|
+
akanConfig.cloudHost[host] = config;
|
|
25
25
|
setAkanGlobalConfig(akanConfig);
|
|
26
26
|
};
|
|
27
27
|
const getSelf = async (token) => {
|
package/esm/src/capacitorApp.js
CHANGED
|
@@ -5,24 +5,24 @@ import { FileEditor } from "./fileEditor";
|
|
|
5
5
|
class CapacitorApp {
|
|
6
6
|
constructor(app) {
|
|
7
7
|
this.app = app;
|
|
8
|
+
this.project = new MobileProject(this.app.cwdPath, {
|
|
9
|
+
android: { path: "android" },
|
|
10
|
+
ios: { path: "ios/App" }
|
|
11
|
+
});
|
|
8
12
|
}
|
|
9
13
|
project;
|
|
10
14
|
iosTargetName = "App";
|
|
11
15
|
async init() {
|
|
12
|
-
const project =
|
|
13
|
-
|
|
14
|
-
ios: { path: "ios/App" }
|
|
15
|
-
});
|
|
16
|
-
await project.load();
|
|
16
|
+
const project = this.project;
|
|
17
|
+
await this.project.load();
|
|
17
18
|
if (!project.android) {
|
|
18
19
|
await this.app.spawn("npx", ["cap", "add", "android"]);
|
|
19
|
-
await project.load();
|
|
20
|
+
await this.project.load();
|
|
20
21
|
}
|
|
21
22
|
if (!project.ios) {
|
|
22
23
|
await this.app.spawn("npx", ["cap", "add", "ios"]);
|
|
23
|
-
await project.load();
|
|
24
|
+
await this.project.load();
|
|
24
25
|
}
|
|
25
|
-
this.project = project;
|
|
26
26
|
return this;
|
|
27
27
|
}
|
|
28
28
|
async save() {
|
|
@@ -14,13 +14,16 @@ const handleOption = (programCommand, argMeta) => {
|
|
|
14
14
|
flag = argMeta.name.slice(0, 1).toLowerCase(),
|
|
15
15
|
desc = argMeta.name,
|
|
16
16
|
example,
|
|
17
|
-
enum:
|
|
17
|
+
enum: enumChoices,
|
|
18
18
|
ask
|
|
19
19
|
} = argMeta.argsOption;
|
|
20
20
|
const kebabName = camelToKebabCase(argMeta.name);
|
|
21
|
+
const choices = enumChoices?.map(
|
|
22
|
+
(choice) => typeof choice === "object" ? { value: choice.value, name: choice.label } : { value: choice, name: choice.toString() }
|
|
23
|
+
);
|
|
21
24
|
programCommand.option(
|
|
22
25
|
`-${flag}, --${kebabName}${type === "boolean" ? " [boolean]" : ` <${kebabName}>`}`,
|
|
23
|
-
`${desc}${ask ? ` (${ask})` : ""}${example ? ` (example: ${example})` : ""}${choices ? ` (choices: ${choices.join(", ")})` : ""}`
|
|
26
|
+
`${desc}${ask ? ` (${ask})` : ""}${example ? ` (example: ${example})` : ""}${choices ? ` (choices: ${choices.map((choice) => choice.name).join(", ")})` : ""}`
|
|
24
27
|
);
|
|
25
28
|
return programCommand;
|
|
26
29
|
};
|
|
@@ -45,7 +48,7 @@ const convertOptionValue = (value, type) => {
|
|
|
45
48
|
const getOptionValue = async (argMeta, opt) => {
|
|
46
49
|
const {
|
|
47
50
|
name,
|
|
48
|
-
argsOption: { enum:
|
|
51
|
+
argsOption: { enum: enumChoices, default: defaultValue, type, desc, nullable, example, ask }
|
|
49
52
|
} = argMeta;
|
|
50
53
|
if (opt[argMeta.name] !== void 0)
|
|
51
54
|
return convertOptionValue(opt[argMeta.name], type ?? "string");
|
|
@@ -53,11 +56,11 @@ const getOptionValue = async (argMeta, opt) => {
|
|
|
53
56
|
return defaultValue;
|
|
54
57
|
else if (nullable)
|
|
55
58
|
return null;
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
59
|
+
if (enumChoices) {
|
|
60
|
+
const choices = enumChoices.map(
|
|
61
|
+
(choice2) => typeof choice2 === "object" ? { value: choice2.value, name: choice2.label } : { value: choice2, name: choice2.toString() }
|
|
62
|
+
);
|
|
63
|
+
const choice = await select({ message: ask ?? desc ?? `Select the ${name} value`, choices });
|
|
61
64
|
return choice;
|
|
62
65
|
} else if (type === "boolean") {
|
|
63
66
|
const message = ask ?? desc ?? `Do you want to set ${name}? ${desc ? ` (${desc})` : ""}: `;
|
package/esm/src/executors.js
CHANGED
|
@@ -295,10 +295,10 @@ class Executor {
|
|
|
295
295
|
targetPath,
|
|
296
296
|
scanInfo,
|
|
297
297
|
overwrite = true
|
|
298
|
-
}, dict = {}) {
|
|
298
|
+
}, dict = {}, options = {}) {
|
|
299
299
|
if (targetPath.endsWith(".js") || targetPath.endsWith(".jsx")) {
|
|
300
300
|
const getContent = await import(templatePath);
|
|
301
|
-
const result = getContent.default(scanInfo ?? null, dict);
|
|
301
|
+
const result = getContent.default(scanInfo ?? null, dict, options);
|
|
302
302
|
if (result === null)
|
|
303
303
|
return null;
|
|
304
304
|
const filename = typeof result === "object" ? result.filename : path.basename(targetPath).replace(".js", ".ts");
|
|
@@ -330,6 +330,7 @@ class Executor {
|
|
|
330
330
|
template,
|
|
331
331
|
scanInfo,
|
|
332
332
|
dict = {},
|
|
333
|
+
options = {},
|
|
333
334
|
overwrite = true
|
|
334
335
|
}) {
|
|
335
336
|
const templatePath = `${getDirname(import.meta.url)}/src/templates${template ? `/${template}` : ""}`;
|
|
@@ -338,7 +339,8 @@ class Executor {
|
|
|
338
339
|
const filename = path.basename(prefixTemplatePath);
|
|
339
340
|
const fileContent = await this.#applyTemplateFile(
|
|
340
341
|
{ templatePath: prefixTemplatePath, targetPath: path.join(basePath, filename), scanInfo, overwrite },
|
|
341
|
-
dict
|
|
342
|
+
dict,
|
|
343
|
+
options
|
|
342
344
|
);
|
|
343
345
|
return fileContent ? [fileContent] : [];
|
|
344
346
|
} else {
|
|
@@ -349,7 +351,8 @@ class Executor {
|
|
|
349
351
|
if (fs.statSync(subpath).isFile()) {
|
|
350
352
|
const fileContent = await this.#applyTemplateFile(
|
|
351
353
|
{ templatePath: subpath, targetPath: path.join(basePath, subdir), scanInfo, overwrite },
|
|
352
|
-
dict
|
|
354
|
+
dict,
|
|
355
|
+
options
|
|
353
356
|
);
|
|
354
357
|
return fileContent ? [fileContent] : [];
|
|
355
358
|
} else
|
|
@@ -358,7 +361,8 @@ class Executor {
|
|
|
358
361
|
template: path.join(template, subdir),
|
|
359
362
|
scanInfo,
|
|
360
363
|
dict,
|
|
361
|
-
overwrite
|
|
364
|
+
overwrite,
|
|
365
|
+
options
|
|
362
366
|
});
|
|
363
367
|
})
|
|
364
368
|
)).flat();
|
|
@@ -599,6 +603,7 @@ class SysExecutor extends Executor {
|
|
|
599
603
|
const scanInfo = this.type === "app" ? await AppInfo.fromExecutor(this, { refresh }) : await LibInfo.fromExecutor(this, { refresh });
|
|
600
604
|
if (write) {
|
|
601
605
|
await Promise.all([
|
|
606
|
+
this._applyTemplate({ basePath: "env", template: "env", scanInfo }),
|
|
602
607
|
this._applyTemplate({ basePath: "lib", template: "lib", scanInfo }),
|
|
603
608
|
this._applyTemplate({ basePath: ".", template: "server.ts", scanInfo }),
|
|
604
609
|
this._applyTemplate({ basePath: ".", template: "client.ts", scanInfo }),
|
|
@@ -627,6 +632,7 @@ class SysExecutor extends Executor {
|
|
|
627
632
|
const libInfos = [...scanInfo.getLibInfos().values()];
|
|
628
633
|
await Promise.all(
|
|
629
634
|
libInfos.map((libInfo) => [
|
|
635
|
+
libInfo.exec._applyTemplate({ basePath: "env", template: "env", scanInfo: libInfo }),
|
|
630
636
|
libInfo.exec._applyTemplate({ basePath: "lib", template: "lib", scanInfo: libInfo }),
|
|
631
637
|
libInfo.exec._applyTemplate({ basePath: ".", template: "server.ts", scanInfo: libInfo }),
|
|
632
638
|
libInfo.exec._applyTemplate({ basePath: ".", template: "client.ts", scanInfo: libInfo }),
|
|
@@ -824,8 +830,6 @@ class AppExecutor extends SysExecutor {
|
|
|
824
830
|
}
|
|
825
831
|
}
|
|
826
832
|
class LibExecutor extends SysExecutor {
|
|
827
|
-
workspaceRoot;
|
|
828
|
-
repoName;
|
|
829
833
|
dist;
|
|
830
834
|
emoji = execEmoji.lib;
|
|
831
835
|
constructor({ workspace, name }) {
|
package/esm/src/scanInfo.js
CHANGED
|
@@ -171,32 +171,31 @@ class ScanInfo {
|
|
|
171
171
|
constructor(scanResult) {
|
|
172
172
|
this.name = scanResult.name;
|
|
173
173
|
this.scanResult = scanResult;
|
|
174
|
-
Object.entries(scanResult.files).forEach(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
);
|
|
174
|
+
Object.entries(scanResult.files).forEach(([_key, value]) => {
|
|
175
|
+
const key = _key;
|
|
176
|
+
const { databases, services, scalars } = value;
|
|
177
|
+
databases.forEach((modelName) => {
|
|
178
|
+
const model = this.database.get(modelName) ?? /* @__PURE__ */ new Set();
|
|
179
|
+
model.add(key);
|
|
180
|
+
this.database.set(modelName, model);
|
|
181
|
+
this.file[key].all.add(modelName);
|
|
182
|
+
this.file[key].databases.add(modelName);
|
|
183
|
+
});
|
|
184
|
+
services?.forEach((serviceName) => {
|
|
185
|
+
const service = this.service.get(serviceName) ?? /* @__PURE__ */ new Set();
|
|
186
|
+
service.add(key);
|
|
187
|
+
this.service.set(serviceName, service);
|
|
188
|
+
this.file[key].all.add(serviceName);
|
|
189
|
+
this.file[key].services.add(serviceName);
|
|
190
|
+
});
|
|
191
|
+
scalars?.forEach((scalarName) => {
|
|
192
|
+
const scalar = this.scalar.get(scalarName) ?? /* @__PURE__ */ new Set();
|
|
193
|
+
scalar.add(key);
|
|
194
|
+
this.scalar.set(scalarName, scalar);
|
|
195
|
+
this.file[key].all.add(scalarName);
|
|
196
|
+
this.file[key].scalars.add(scalarName);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
200
199
|
}
|
|
201
200
|
getScanResult() {
|
|
202
201
|
return this.scanResult;
|
package/esm/src/spinner.js
CHANGED
package/package.json
CHANGED
|
@@ -12,7 +12,10 @@ interface ArgsOption {
|
|
|
12
12
|
default?: string | number | boolean;
|
|
13
13
|
nullable?: boolean;
|
|
14
14
|
example?: string | number | boolean;
|
|
15
|
-
enum?: (string | number)[] | readonly (string | number)[]
|
|
15
|
+
enum?: (string | number)[] | readonly (string | number)[] | {
|
|
16
|
+
label: string;
|
|
17
|
+
value: string | number | boolean;
|
|
18
|
+
}[];
|
|
16
19
|
ask?: string;
|
|
17
20
|
}
|
|
18
21
|
export interface ArgMeta {
|
package/src/executors.d.ts
CHANGED
|
@@ -69,13 +69,16 @@ export declare class Executor {
|
|
|
69
69
|
refresh?: boolean;
|
|
70
70
|
}): PackageJson;
|
|
71
71
|
setPackageJson(packageJson: PackageJson): void;
|
|
72
|
-
_applyTemplate({ basePath, template, scanInfo, dict, overwrite, }: {
|
|
72
|
+
_applyTemplate({ basePath, template, scanInfo, dict, options, overwrite, }: {
|
|
73
73
|
basePath: string;
|
|
74
74
|
template: string;
|
|
75
75
|
scanInfo?: AppInfo | LibInfo | null;
|
|
76
76
|
dict?: {
|
|
77
77
|
[key: string]: string;
|
|
78
78
|
};
|
|
79
|
+
options?: {
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
};
|
|
79
82
|
overwrite?: boolean;
|
|
80
83
|
}): Promise<FileContent[]>;
|
|
81
84
|
applyTemplate(options: {
|
|
@@ -84,6 +87,9 @@ export declare class Executor {
|
|
|
84
87
|
dict?: {
|
|
85
88
|
[key: string]: string;
|
|
86
89
|
};
|
|
90
|
+
options?: {
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
};
|
|
87
93
|
overwrite?: boolean;
|
|
88
94
|
}): Promise<FileContent[]>;
|
|
89
95
|
getTypeChecker(): TypeChecker;
|
|
@@ -252,8 +258,6 @@ interface LibExecutorOptions {
|
|
|
252
258
|
}
|
|
253
259
|
export declare class LibExecutor extends SysExecutor {
|
|
254
260
|
#private;
|
|
255
|
-
workspaceRoot: string;
|
|
256
|
-
repoName: string;
|
|
257
261
|
dist: Executor;
|
|
258
262
|
emoji: string;
|
|
259
263
|
constructor({ workspace, name }: LibExecutorOptions);
|