silgi 0.26.3 → 0.26.5
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/cli/dev.mjs +0 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/init.mjs +0 -1
- package/dist/cli/install.mjs +0 -1
- package/dist/cli/prepare.mjs +4 -40
- package/dist/cli/writeTypesAndFiles.mjs +1 -1
- package/package.json +1 -1
package/dist/cli/dev.mjs
CHANGED
package/dist/cli/index.mjs
CHANGED
package/dist/cli/init.mjs
CHANGED
package/dist/cli/install.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -1,53 +1,17 @@
|
|
|
1
1
|
import { defineCommand, runCommand } from 'citty';
|
|
2
|
-
import {
|
|
2
|
+
import { resolve } from 'pathe';
|
|
3
3
|
import { version } from 'silgi/meta';
|
|
4
|
-
import { d as prepareEnv, c as createSilgiCLI, a as prepare$2, b as writeTypesAndFiles, w as writeCoreFile, p as prepareBuild } from './writeTypesAndFiles.mjs';
|
|
5
|
-
import { generateDTS } from 'apiful/openapi';
|
|
6
|
-
import { consola } from 'consola';
|
|
7
|
-
import { hasSilgiModule, addTemplate } from 'silgi/kit';
|
|
4
|
+
import { d as prepareEnv, c as createSilgiCLI, a as prepare$2, b as writeTypesAndFiles, w as writeCoreFile, p as prepareBuild, g as generateApp } from './writeTypesAndFiles.mjs';
|
|
8
5
|
import { execSync } from 'node:child_process';
|
|
9
6
|
import { readFileSync } from 'node:fs';
|
|
10
7
|
import * as p from '@clack/prompts';
|
|
8
|
+
import { consola } from 'consola';
|
|
11
9
|
import { createJiti } from 'dev-jiti';
|
|
12
10
|
import color from 'picocolors';
|
|
13
11
|
import { useSilgiCLI } from 'silgi';
|
|
14
12
|
import { a as silgiCLIIClose } from '../_chunks/silgiApp.mjs';
|
|
15
13
|
import { l as loadOptions } from './types.mjs';
|
|
16
14
|
|
|
17
|
-
async function generateApiFul(silgi) {
|
|
18
|
-
const config = silgi.options.apiFul;
|
|
19
|
-
if (!config.services || hasSilgiModule("openapi")) {
|
|
20
|
-
config.services ??= {};
|
|
21
|
-
config.services = {
|
|
22
|
-
silgi: {
|
|
23
|
-
schema: join(silgi.options.build.dir, "openapi.json")
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const resolvedOpenAPIServices = Object.fromEntries(
|
|
28
|
-
Object.entries(config?.services ?? {}).filter(([, service]) => Boolean(service.schema))
|
|
29
|
-
);
|
|
30
|
-
if (Object.keys(resolvedOpenAPIServices).length === 0) {
|
|
31
|
-
consola.info("No OpenAPI schemas found, skipping generation");
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
for (const service of Object.values(resolvedOpenAPIServices)) {
|
|
35
|
-
if (typeof service.schema === "string" && !service.schema.startsWith("http")) {
|
|
36
|
-
service.schema = resolve(silgi.options.rootDir, service.schema);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const types = await generateDTS(resolvedOpenAPIServices);
|
|
40
|
-
silgi.hook("prepare:types", (opts) => {
|
|
41
|
-
opts.references.push({ path: "./apiful.d.ts" });
|
|
42
|
-
});
|
|
43
|
-
addTemplate({
|
|
44
|
-
filename: "types/apiful.d.ts",
|
|
45
|
-
where: ".silgi",
|
|
46
|
-
write: true,
|
|
47
|
-
getContents: () => types
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
15
|
const commonArgs = {
|
|
52
16
|
dir: {
|
|
53
17
|
type: "string",
|
|
@@ -266,7 +230,7 @@ const prepare = defineCommand({
|
|
|
266
230
|
await writeTypesAndFiles(silgi);
|
|
267
231
|
await writeCoreFile(silgi);
|
|
268
232
|
await prepareBuild(silgi);
|
|
269
|
-
await
|
|
233
|
+
await generateApp(silgi);
|
|
270
234
|
if (!args.commands) {
|
|
271
235
|
await runCommand(run, {
|
|
272
236
|
rawArgs: ["--tag", "init", "--active", "false"]
|
|
@@ -2372,4 +2372,4 @@ async function writeTypesAndFiles(silgi) {
|
|
|
2372
2372
|
}
|
|
2373
2373
|
}
|
|
2374
2374
|
|
|
2375
|
-
export { prepare as a, writeTypesAndFiles as b, createSilgiCLI as c, prepareEnv as d, prepareBuild as p, writeCoreFile as w };
|
|
2375
|
+
export { prepare as a, writeTypesAndFiles as b, createSilgiCLI as c, prepareEnv as d, generateApp as g, prepareBuild as p, writeCoreFile as w };
|