silgi 0.29.0 → 0.29.2
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 +3 -3
- package/dist/cli/index.mjs +2 -2
- package/dist/cli/init.mjs +4 -4
- package/dist/cli/install.mjs +4 -4
- package/dist/cli/prepare.mjs +23 -18
- package/dist/cli/silgi.mjs +1 -0
- package/dist/cli/types.mjs +2 -2
- package/dist/kit/index.d.mts +6 -1
- package/dist/kit/index.mjs +4 -1
- package/dist/presets/h3/preset.mjs +6 -7
- package/dist/presets/nitro/preset.mjs +6 -7
- package/dist/presets/nuxt/preset.mjs +6 -7
- package/dist/types/index.d.mts +17 -16
- package/package.json +1 -1
package/dist/cli/dev.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { join } from 'pathe';
|
|
|
6
6
|
import { useSilgiCLI } from 'silgi';
|
|
7
7
|
import { version } from 'silgi/meta';
|
|
8
8
|
import { a as silgiCLIIClose } from '../_chunks/silgiApp.mjs';
|
|
9
|
-
import {
|
|
9
|
+
import { c as commonArgs, p as prepare } from './prepare.mjs';
|
|
10
10
|
import 'unctx';
|
|
11
11
|
import './silgi.mjs';
|
|
12
12
|
import 'apiful/openapi';
|
|
@@ -70,7 +70,7 @@ const dev = defineCommand({
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
async run() {
|
|
73
|
-
await runCommand(
|
|
73
|
+
await runCommand(prepare, {
|
|
74
74
|
rawArgs: ["--commands", "run", "--dev", "true"]
|
|
75
75
|
});
|
|
76
76
|
const silgi = useSilgiCLI();
|
|
@@ -103,7 +103,7 @@ const dev = defineCommand({
|
|
|
103
103
|
silgi.errors = [];
|
|
104
104
|
try {
|
|
105
105
|
await reloadScan(path, stats);
|
|
106
|
-
await runCommand(
|
|
106
|
+
await runCommand(prepare, {
|
|
107
107
|
rawArgs: ["--commands", "run", "--dev", "true"]
|
|
108
108
|
});
|
|
109
109
|
} catch (error) {
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { defineCommand, runMain } from 'citty';
|
|
3
3
|
|
|
4
|
-
const version = "0.29.
|
|
4
|
+
const version = "0.29.2";
|
|
5
5
|
const packageJson = {
|
|
6
6
|
version: version};
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ const main = defineCommand({
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
subCommands: {
|
|
21
|
-
prepare: () => import('./prepare.mjs').then(function (n) { return n.
|
|
21
|
+
prepare: () => import('./prepare.mjs').then(function (n) { return n.a; }).then((m) => m.default),
|
|
22
22
|
init: () => import('./init.mjs').then((m) => m.default),
|
|
23
23
|
run: () => import('./prepare.mjs').then(function (n) { return n.r; }).then((m) => m.default),
|
|
24
24
|
install: () => import('./install.mjs').then((m) => m.default),
|
package/dist/cli/init.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import * as p from '@clack/prompts';
|
|
|
4
4
|
import { defineCommand, runCommand } from 'citty';
|
|
5
5
|
import consola from 'consola';
|
|
6
6
|
import { dirname } from 'pathe';
|
|
7
|
-
import {
|
|
7
|
+
import { p as prepare } from './prepare.mjs';
|
|
8
8
|
import 'silgi/meta';
|
|
9
9
|
import './silgi.mjs';
|
|
10
10
|
import 'apiful/openapi';
|
|
@@ -45,7 +45,7 @@ import 'node:child_process';
|
|
|
45
45
|
import '../_chunks/silgiApp.mjs';
|
|
46
46
|
import 'unctx';
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const init = defineCommand({
|
|
49
49
|
meta: {
|
|
50
50
|
name: "Silgi Init",
|
|
51
51
|
description: "Initialize silgi config",
|
|
@@ -100,7 +100,7 @@ const command = defineCommand({
|
|
|
100
100
|
await fsp.mkdir(dirname(file), { recursive: true });
|
|
101
101
|
writeFileSync(file, plugin.join("\n"));
|
|
102
102
|
consola.success("Silgi plugin created, see server/plugins/silgi.ts");
|
|
103
|
-
runCommand(
|
|
103
|
+
runCommand(prepare, {
|
|
104
104
|
rawArgs: ["--env", ".env"]
|
|
105
105
|
});
|
|
106
106
|
}
|
|
@@ -109,4 +109,4 @@ const command = defineCommand({
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
export {
|
|
112
|
+
export { init as default };
|
package/dist/cli/install.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { resolve } from 'pathe';
|
|
|
6
6
|
import { version } from 'silgi/meta';
|
|
7
7
|
import { addNPMPackage, addTemplate } from 'silgi/kit';
|
|
8
8
|
import { u as useSilgiCLI } from '../_chunks/silgiApp.mjs';
|
|
9
|
-
import {
|
|
9
|
+
import { c as commonArgs, p as prepare } from './prepare.mjs';
|
|
10
10
|
import { l as loadOptions } from './types.mjs';
|
|
11
11
|
import 'unctx';
|
|
12
12
|
import './silgi.mjs';
|
|
@@ -83,7 +83,7 @@ async function installPackages(silgi = useSilgiCLI()) {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const
|
|
86
|
+
const install = defineCommand({
|
|
87
87
|
meta: {
|
|
88
88
|
name: "install",
|
|
89
89
|
description: "Install dependencies from the install.json file.",
|
|
@@ -97,7 +97,7 @@ const command = defineCommand({
|
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
async run() {
|
|
100
|
-
await runCommand(
|
|
100
|
+
await runCommand(prepare, {
|
|
101
101
|
rawArgs: []
|
|
102
102
|
}).catch(() => {
|
|
103
103
|
});
|
|
@@ -130,4 +130,4 @@ const command = defineCommand({
|
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
export {
|
|
133
|
+
export { install as default };
|
package/dist/cli/prepare.mjs
CHANGED
|
@@ -91,7 +91,7 @@ function cancelOnCancel({
|
|
|
91
91
|
handleCancel();
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
const
|
|
94
|
+
const run = defineCommand({
|
|
95
95
|
meta: {
|
|
96
96
|
name: "run",
|
|
97
97
|
description: "Run a command from the CLI",
|
|
@@ -113,7 +113,7 @@ const command$1 = defineCommand({
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
async run({ args }) {
|
|
116
|
-
const data = args.active ? await runCommand(
|
|
116
|
+
const data = args.active ? await runCommand(prepare, {
|
|
117
117
|
rawArgs: ["--commands", "run"]
|
|
118
118
|
}) : void 0;
|
|
119
119
|
const silgi = useSilgiCLI$1();
|
|
@@ -135,14 +135,15 @@ const command$1 = defineCommand({
|
|
|
135
135
|
message: "Select commands to run",
|
|
136
136
|
required: true,
|
|
137
137
|
options: {
|
|
138
|
-
...selectedCommands.reduce((acc, cmd) => {
|
|
139
|
-
acc[cmd.group || ""]
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
138
|
+
...selectedCommands.sort((a, b) => (a.order || Infinity) - (b.order || Infinity)).reduce((acc, cmd) => {
|
|
139
|
+
if (!acc[cmd.group || ""]) {
|
|
140
|
+
acc[cmd.group || ""] = [];
|
|
141
|
+
}
|
|
142
|
+
acc[cmd.group || ""].push({
|
|
143
|
+
label: cmd.name,
|
|
144
|
+
value: cmd,
|
|
145
|
+
hint: cmd.description
|
|
146
|
+
});
|
|
146
147
|
return acc;
|
|
147
148
|
}, {})
|
|
148
149
|
}
|
|
@@ -180,12 +181,12 @@ const command$1 = defineCommand({
|
|
|
180
181
|
}
|
|
181
182
|
});
|
|
182
183
|
|
|
183
|
-
const run = {
|
|
184
|
+
const run$1 = {
|
|
184
185
|
__proto__: null,
|
|
185
|
-
default:
|
|
186
|
+
default: run
|
|
186
187
|
};
|
|
187
188
|
|
|
188
|
-
const
|
|
189
|
+
const prepare = defineCommand({
|
|
189
190
|
meta: {
|
|
190
191
|
name: "prepare",
|
|
191
192
|
description: "Generate types for the project",
|
|
@@ -212,6 +213,10 @@ const command = defineCommand({
|
|
|
212
213
|
commands: {
|
|
213
214
|
type: "string",
|
|
214
215
|
description: "The commands to run"
|
|
216
|
+
},
|
|
217
|
+
command_type: {
|
|
218
|
+
type: "string",
|
|
219
|
+
description: "The command type to run"
|
|
215
220
|
}
|
|
216
221
|
},
|
|
217
222
|
async run({ args }) {
|
|
@@ -221,12 +226,12 @@ const command = defineCommand({
|
|
|
221
226
|
dev: args.dev || args.stub,
|
|
222
227
|
stub: args.stub,
|
|
223
228
|
preset: args.preset,
|
|
224
|
-
commandType: "prepare",
|
|
229
|
+
commandType: args.command_type || "prepare",
|
|
225
230
|
activeEnvironment: args.env
|
|
226
231
|
});
|
|
227
232
|
await build(silgi);
|
|
228
233
|
if (!args.commands) {
|
|
229
|
-
await runCommand(
|
|
234
|
+
await runCommand(run, {
|
|
230
235
|
rawArgs: ["--tag", "init", "--active", "false"]
|
|
231
236
|
});
|
|
232
237
|
}
|
|
@@ -236,9 +241,9 @@ const command = defineCommand({
|
|
|
236
241
|
}
|
|
237
242
|
});
|
|
238
243
|
|
|
239
|
-
const prepare = {
|
|
244
|
+
const prepare$1 = {
|
|
240
245
|
__proto__: null,
|
|
241
|
-
default:
|
|
246
|
+
default: prepare
|
|
242
247
|
};
|
|
243
248
|
|
|
244
|
-
export {
|
|
249
|
+
export { prepare$1 as a, commonArgs as c, prepare as p, run$1 as r };
|
package/dist/cli/silgi.mjs
CHANGED
|
@@ -2293,6 +2293,7 @@ async function createSilgiCLI(config = {}, opts = {}) {
|
|
|
2293
2293
|
silgiCLICtx.set(silgi);
|
|
2294
2294
|
silgi.hook("close", () => silgiCLICtx.unset());
|
|
2295
2295
|
}
|
|
2296
|
+
await silgi.hooks.callHook("ready", silgi);
|
|
2296
2297
|
if (silgi.options.debug) {
|
|
2297
2298
|
createDebugger(silgi.hooks, { tag: "silgi" });
|
|
2298
2299
|
silgi.options.plugins.push({
|
package/dist/cli/types.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { watchConfig, loadConfig } from 'c12';
|
|
2
2
|
import { resolveCompatibilityDatesFromEnv, formatDate, resolveCompatibilityDates } from 'compatx';
|
|
3
3
|
import { klona } from 'klona/full';
|
|
4
|
-
import {
|
|
4
|
+
import { isTest, isDebug } from 'std-env';
|
|
5
5
|
import consola from 'consola';
|
|
6
6
|
import { colors } from 'consola/utils';
|
|
7
7
|
import { relative, join, resolve, dirname, isAbsolute } from 'pathe';
|
|
@@ -16,7 +16,7 @@ import { defu } from 'defu';
|
|
|
16
16
|
|
|
17
17
|
const SilgiCLIDefaults = {
|
|
18
18
|
// General
|
|
19
|
-
debug: isDebug,
|
|
19
|
+
debug: isDebug === true ? true : void 0,
|
|
20
20
|
// timing: isDebug,
|
|
21
21
|
logLevel: isTest ? 1 : 3,
|
|
22
22
|
// runtimeConfig: { app: {}, silgi: {} },
|
package/dist/kit/index.d.mts
CHANGED
|
@@ -11,7 +11,12 @@ declare function addNPMPackage(data: {
|
|
|
11
11
|
version?: string;
|
|
12
12
|
isDev?: boolean;
|
|
13
13
|
when?: boolean;
|
|
14
|
-
}[]
|
|
14
|
+
}[] | {
|
|
15
|
+
name: string;
|
|
16
|
+
version?: string;
|
|
17
|
+
isDev?: boolean;
|
|
18
|
+
when?: boolean;
|
|
19
|
+
}): Promise<void>;
|
|
15
20
|
|
|
16
21
|
declare function hasError(type: SilgiCLI['errors'][0]['type'], silgi?: SilgiCLI): boolean;
|
|
17
22
|
|
package/dist/kit/index.mjs
CHANGED
|
@@ -70,7 +70,10 @@ async function addCommands(data) {
|
|
|
70
70
|
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
71
71
|
async function addNPMPackage(data) {
|
|
72
72
|
const silgi = useSilgiCLI$1();
|
|
73
|
-
|
|
73
|
+
if (silgi.options.commandType !== "install") {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
for (const item of toArray(data)) {
|
|
74
77
|
if (item.when === false) {
|
|
75
78
|
continue;
|
|
76
79
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { defineSilgiPreset } from "silgi/kit";
|
|
2
|
-
import { peerDependencies } from "silgi/meta";
|
|
1
|
+
import { addNPMPackage, defineSilgiPreset } from "silgi/kit";
|
|
3
2
|
const h3 = defineSilgiPreset(
|
|
4
3
|
{
|
|
5
4
|
static: true,
|
|
@@ -11,11 +10,11 @@ const h3 = defineSilgiPreset(
|
|
|
11
10
|
crawlLinks: true
|
|
12
11
|
},
|
|
13
12
|
hooks: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
13
|
+
ready: async () => {
|
|
14
|
+
await addNPMPackage({
|
|
15
|
+
name: "h3",
|
|
16
|
+
isDev: true
|
|
17
|
+
});
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
20
|
},
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { defineSilgiPreset } from "silgi/kit";
|
|
2
|
-
import { peerDependencies } from "silgi/meta";
|
|
1
|
+
import { addNPMPackage, defineSilgiPreset } from "silgi/kit";
|
|
3
2
|
const nitro = defineSilgiPreset(
|
|
4
3
|
{
|
|
5
4
|
static: true,
|
|
@@ -26,11 +25,11 @@ const nitro = defineSilgiPreset(
|
|
|
26
25
|
]
|
|
27
26
|
},
|
|
28
27
|
hooks: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
28
|
+
ready: async () => {
|
|
29
|
+
await addNPMPackage({
|
|
30
|
+
name: "h3",
|
|
31
|
+
isDev: true
|
|
32
|
+
});
|
|
34
33
|
}
|
|
35
34
|
},
|
|
36
35
|
storages: ["data", "/assets"]
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { defineSilgiPreset } from "silgi/kit";
|
|
2
|
-
import { peerDependencies } from "silgi/meta";
|
|
1
|
+
import { addNPMPackage, defineSilgiPreset } from "silgi/kit";
|
|
3
2
|
const nuxt = defineSilgiPreset(
|
|
4
3
|
{
|
|
5
4
|
static: true,
|
|
@@ -27,11 +26,11 @@ const nuxt = defineSilgiPreset(
|
|
|
27
26
|
]
|
|
28
27
|
},
|
|
29
28
|
hooks: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
29
|
+
ready: async () => {
|
|
30
|
+
await addNPMPackage({
|
|
31
|
+
name: "h3",
|
|
32
|
+
isDev: true
|
|
33
|
+
});
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
36
|
storages: ["data", "/assets"]
|
package/dist/types/index.d.mts
CHANGED
|
@@ -147,6 +147,21 @@ interface ResolvedSilgiTemplate<Options = TemplateDefaultOptions> extends SilgiT
|
|
|
147
147
|
modified?: boolean;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
interface SilgiCommands {
|
|
151
|
+
}
|
|
152
|
+
interface Commands {
|
|
153
|
+
name: string;
|
|
154
|
+
description?: string;
|
|
155
|
+
group: string;
|
|
156
|
+
when?: boolean;
|
|
157
|
+
type: 'function' | 'command';
|
|
158
|
+
tags?: (keyof SilgiCommands)[] | (string | object)[];
|
|
159
|
+
getContents: (data: {
|
|
160
|
+
app: SilgiCLI;
|
|
161
|
+
}) => string;
|
|
162
|
+
order?: number;
|
|
163
|
+
}
|
|
164
|
+
|
|
150
165
|
interface SilgiCLIHooks extends SilgiHooks {
|
|
151
166
|
/**
|
|
152
167
|
* Called after Silgi initialization, when the Silgi instance is ready to work.
|
|
@@ -263,7 +278,7 @@ interface SilgiCLIHooks extends SilgiHooks {
|
|
|
263
278
|
*/
|
|
264
279
|
'app:templatesGenerated': (app: SilgiCLI, templates: ResolvedSilgiTemplate[], options?: GenerateAppOptions) => HookResult;
|
|
265
280
|
'scanFiles:done': (app: SilgiCLI) => HookResult;
|
|
266
|
-
'prepare:commands': (commands:
|
|
281
|
+
'prepare:commands': (commands: Commands[]) => HookResult;
|
|
267
282
|
}
|
|
268
283
|
type TSReference = {
|
|
269
284
|
types: string;
|
|
@@ -519,7 +534,7 @@ interface SilgiRuntimeMethods {
|
|
|
519
534
|
}
|
|
520
535
|
interface SilgiNamespaces {
|
|
521
536
|
}
|
|
522
|
-
type CommandType = 'run' | 'prepare' | 'install';
|
|
537
|
+
type CommandType = 'run' | 'prepare' | 'install' | 'dev' | 'init';
|
|
523
538
|
interface DefaultNamespaces extends SilgiNamespaces {
|
|
524
539
|
}
|
|
525
540
|
interface SilgiRouterTypes {
|
|
@@ -1147,20 +1162,6 @@ interface GraphQLJSON {
|
|
|
1147
1162
|
references: any;
|
|
1148
1163
|
}
|
|
1149
1164
|
|
|
1150
|
-
interface SilgiCommands {
|
|
1151
|
-
}
|
|
1152
|
-
interface Commands {
|
|
1153
|
-
name: string;
|
|
1154
|
-
description?: string;
|
|
1155
|
-
group: string;
|
|
1156
|
-
when?: boolean;
|
|
1157
|
-
type: 'function' | 'command';
|
|
1158
|
-
tags?: (keyof SilgiCommands)[] | (string | object)[];
|
|
1159
|
-
getContents: (data: {
|
|
1160
|
-
app: SilgiCLI;
|
|
1161
|
-
}) => string;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
1165
|
interface BaseNamespaceType extends Record<keyof DefaultNamespaces, Record<string, BaseSchemaType<StandardSchemaV1>>> {
|
|
1165
1166
|
}
|
|
1166
1167
|
type Namespaces<T extends BaseNamespaceType> = {
|