silgi 0.41.43 → 0.41.45
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/build.mjs +17 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/init.mjs +1 -1
- package/dist/cli/install.mjs +1 -1
- package/dist/cli/loader.mjs +1 -0
- package/dist/cli/prepare.mjs +7 -1
- package/dist/kit/index.mjs +17 -1
- package/dist/types/index.d.mts +4 -3
- package/package.json +1 -1
package/dist/cli/build.mjs
CHANGED
|
@@ -1552,7 +1552,23 @@ async function generateApp(app, options = {}) {
|
|
|
1552
1552
|
app.templates = Object.values(defaultTemplates).concat(app.options.build.templates);
|
|
1553
1553
|
await app.callHook("app:templates", app);
|
|
1554
1554
|
app.templates = app.templates.map((tmpl) => {
|
|
1555
|
-
|
|
1555
|
+
let dir;
|
|
1556
|
+
switch (tmpl.where) {
|
|
1557
|
+
case ".silgi":
|
|
1558
|
+
dir = app.options.build.dir;
|
|
1559
|
+
break;
|
|
1560
|
+
case "server":
|
|
1561
|
+
dir = app.options.silgi.serverDir;
|
|
1562
|
+
break;
|
|
1563
|
+
case "client":
|
|
1564
|
+
dir = app.options.silgi.clientDir;
|
|
1565
|
+
break;
|
|
1566
|
+
case "root":
|
|
1567
|
+
dir = app.options.rootDir;
|
|
1568
|
+
break;
|
|
1569
|
+
default:
|
|
1570
|
+
dir = app.options.silgi.vfsDir;
|
|
1571
|
+
}
|
|
1556
1572
|
return normalizeTemplate(tmpl, dir);
|
|
1557
1573
|
});
|
|
1558
1574
|
const filteredTemplates = {
|
package/dist/cli/index.mjs
CHANGED
package/dist/cli/init.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { defineCommand, runCommand } from 'citty';
|
|
|
5
5
|
import consola from 'consola';
|
|
6
6
|
import { dirname } from 'pathe';
|
|
7
7
|
import { c as cancelOnCancel, a as command$1 } from './prepare.mjs';
|
|
8
|
+
import 'pkg-types';
|
|
8
9
|
import 'silgi/meta';
|
|
9
10
|
import './build.mjs';
|
|
10
11
|
import 'hookable';
|
|
@@ -37,7 +38,6 @@ import 'klona/full';
|
|
|
37
38
|
import 'std-env';
|
|
38
39
|
import 'consola/utils';
|
|
39
40
|
import 'escape-string-regexp';
|
|
40
|
-
import 'pkg-types';
|
|
41
41
|
import 'apiful/openapi';
|
|
42
42
|
import '../_chunks/silgiApp.mjs';
|
|
43
43
|
import 'unctx';
|
package/dist/cli/install.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { c as commonArgs } from './common.mjs';
|
|
|
8
8
|
import { a as command$1 } from './prepare.mjs';
|
|
9
9
|
import 'unctx';
|
|
10
10
|
import 'pathe';
|
|
11
|
+
import 'pkg-types';
|
|
11
12
|
import './build.mjs';
|
|
12
13
|
import 'hookable';
|
|
13
14
|
import 'silgi';
|
|
@@ -41,7 +42,6 @@ import 'klona/full';
|
|
|
41
42
|
import 'std-env';
|
|
42
43
|
import 'consola/utils';
|
|
43
44
|
import 'escape-string-regexp';
|
|
44
|
-
import 'pkg-types';
|
|
45
45
|
import 'apiful/openapi';
|
|
46
46
|
import 'pathe/utils';
|
|
47
47
|
import 'untyped';
|
package/dist/cli/loader.mjs
CHANGED
|
@@ -580,6 +580,7 @@ async function _loadUserConfig(configOverrides = {}, opts = {}) {
|
|
|
580
580
|
options._c12 = loadedConfig;
|
|
581
581
|
const _presetName = (loadedConfig.layers || []).find((l) => l.config?._meta?.name)?.config?._meta?.name || presetOverride;
|
|
582
582
|
options.preset = _presetName;
|
|
583
|
+
options.package.present = _presetName;
|
|
583
584
|
options.compatibilityDate = resolveCompatibilityDates(
|
|
584
585
|
compatibilityDate,
|
|
585
586
|
options.compatibilityDate
|
package/dist/cli/prepare.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineCommand, runCommand } from 'citty';
|
|
2
2
|
import { resolve } from 'pathe';
|
|
3
|
+
import { readPackageJSON } from 'pkg-types';
|
|
3
4
|
import { version } from 'silgi/meta';
|
|
4
5
|
import { p as prepareEnv, c as createSilgiCLI, b as build } from './build.mjs';
|
|
5
6
|
import { c as commonArgs } from './common.mjs';
|
|
@@ -157,13 +158,18 @@ const command = defineCommand({
|
|
|
157
158
|
},
|
|
158
159
|
async run({ args }) {
|
|
159
160
|
const rootDir = resolve(args.dir || args._dir || ".");
|
|
161
|
+
const packageJson = await readPackageJSON(rootDir);
|
|
162
|
+
const packageName = packageJson.name || "";
|
|
160
163
|
const silgi = await createSilgiCLI({
|
|
161
164
|
rootDir,
|
|
162
165
|
dev: args.dev || args.stub,
|
|
163
166
|
stub: args.stub,
|
|
164
167
|
preset: args.preset,
|
|
165
168
|
commandType: args.commandType || "prepare",
|
|
166
|
-
activeEnvironment: args.env
|
|
169
|
+
activeEnvironment: args.env,
|
|
170
|
+
package: {
|
|
171
|
+
name: packageName
|
|
172
|
+
}
|
|
167
173
|
});
|
|
168
174
|
await build(silgi);
|
|
169
175
|
if (args.commandType !== "commands") {
|
package/dist/kit/index.mjs
CHANGED
|
@@ -944,7 +944,23 @@ function normalizeTemplate(template, buildDir) {
|
|
|
944
944
|
}
|
|
945
945
|
if (!template.dst) {
|
|
946
946
|
const silgi = useSilgiCLI();
|
|
947
|
-
|
|
947
|
+
let dir;
|
|
948
|
+
switch (template.where) {
|
|
949
|
+
case ".silgi":
|
|
950
|
+
dir = silgi.options.build.dir;
|
|
951
|
+
break;
|
|
952
|
+
case "server":
|
|
953
|
+
dir = silgi.options.silgi.serverDir;
|
|
954
|
+
break;
|
|
955
|
+
case "client":
|
|
956
|
+
dir = silgi.options.silgi.clientDir;
|
|
957
|
+
break;
|
|
958
|
+
case "root":
|
|
959
|
+
dir = silgi.options.rootDir;
|
|
960
|
+
break;
|
|
961
|
+
default:
|
|
962
|
+
dir = silgi.options.rootDir;
|
|
963
|
+
}
|
|
948
964
|
template.dst = resolve(buildDir ?? dir, template.filename);
|
|
949
965
|
}
|
|
950
966
|
return template;
|
package/dist/types/index.d.mts
CHANGED
|
@@ -840,7 +840,7 @@ interface SilgiTemplate<Options = TemplateDefaultOptions> {
|
|
|
840
840
|
/** The resolved path to the source file to be template */
|
|
841
841
|
src?: string;
|
|
842
842
|
/** Provided compile option instead of src */
|
|
843
|
-
where?: 'server' | 'client' | '.silgi';
|
|
843
|
+
where?: 'server' | 'client' | '.silgi' | 'root';
|
|
844
844
|
getContents?: (data: {
|
|
845
845
|
app: SilgiCLI;
|
|
846
846
|
options: Options;
|
|
@@ -1435,8 +1435,9 @@ type Schema = 'zod' | 'valibot' | 'arkType' | 'typebox';
|
|
|
1435
1435
|
interface SilgiCLIOptions extends PresetOptions {
|
|
1436
1436
|
_config: SilgiCLIConfig;
|
|
1437
1437
|
_c12: ResolvedConfig<SilgiCLIConfig> | ConfigWatcher<SilgiCLIConfig>;
|
|
1438
|
-
|
|
1439
|
-
|
|
1438
|
+
package: {
|
|
1439
|
+
present: PresetName;
|
|
1440
|
+
name: string;
|
|
1440
1441
|
};
|
|
1441
1442
|
commandType: CommandType;
|
|
1442
1443
|
commands: Commands[];
|