silgi 0.8.1 → 0.8.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/_chunks/index.mjs +1 -1
- package/dist/cli/prepare.mjs +1 -1
- package/dist/cli/run.mjs +11 -6
- package/dist/meta/index.d.mts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/_chunks/index.mjs
CHANGED
package/dist/cli/prepare.mjs
CHANGED
|
@@ -1544,7 +1544,7 @@ async function commands(silgi) {
|
|
|
1544
1544
|
filename: "cli.json",
|
|
1545
1545
|
where: ".silgi",
|
|
1546
1546
|
write: true,
|
|
1547
|
-
getContents: () => JSON.stringify(commands2, null, 2)
|
|
1547
|
+
getContents: () => Object.keys(commands2).length > 1 ? JSON.stringify(commands2, null, 2) : "{}"
|
|
1548
1548
|
});
|
|
1549
1549
|
}
|
|
1550
1550
|
|
package/dist/cli/run.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { execSync } from 'node:child_process';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
2
3
|
import * as p from '@clack/prompts';
|
|
3
4
|
import { defineCommand } from 'citty';
|
|
5
|
+
import { consola } from 'consola';
|
|
4
6
|
import { resolve } from 'pathe';
|
|
5
7
|
import color from 'picocolors';
|
|
6
8
|
import { version } from 'silgi/meta';
|
|
@@ -10,11 +12,9 @@ import 'c12';
|
|
|
10
12
|
import 'compatx';
|
|
11
13
|
import 'klona/full';
|
|
12
14
|
import 'std-env';
|
|
13
|
-
import 'consola';
|
|
14
15
|
import 'consola/utils';
|
|
15
16
|
import 'escape-string-regexp';
|
|
16
17
|
import 'mlly';
|
|
17
|
-
import 'node:fs';
|
|
18
18
|
import 'pkg-types';
|
|
19
19
|
import 'silgi/kit';
|
|
20
20
|
import 'silgi/runtime/meta';
|
|
@@ -37,16 +37,21 @@ const run = defineCommand({
|
|
|
37
37
|
p.intro(color.bold(`Silgi CLI ${color.green(`v${version}`)}`));
|
|
38
38
|
const silgiConfig = await loadOptions({});
|
|
39
39
|
const getCli = resolve(silgiConfig.build.dir, "cli.json");
|
|
40
|
-
const cli =
|
|
41
|
-
const
|
|
40
|
+
const cli = readFileSync(getCli, "utf-8");
|
|
41
|
+
const cliJson = JSON.parse(cli);
|
|
42
|
+
if (Object.keys(cliJson).length === 0) {
|
|
43
|
+
consola.info("Empty command list, maybe forgot pnpm silgi prepare?");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
42
46
|
const commandName = await p.select({
|
|
43
47
|
message: "Select a command to run",
|
|
44
|
-
options: Object.keys(
|
|
48
|
+
options: Object.keys(cliJson).map((key) => ({
|
|
45
49
|
label: key,
|
|
46
50
|
value: key
|
|
47
51
|
}))
|
|
48
52
|
});
|
|
49
|
-
const scripts =
|
|
53
|
+
const scripts = cliJson[commandName];
|
|
54
|
+
console.log("scripts", scripts);
|
|
50
55
|
const scriptName = await p.select({
|
|
51
56
|
message: "Select a script to run",
|
|
52
57
|
options: Object.keys(scripts).map((key) => ({
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED