silgi 0.8.14 → 0.8.16
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/index.mjs +2 -1
- package/dist/cli/install.mjs +57 -0
- package/dist/cli/prepare.mjs +21 -1
- 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/index.mjs
CHANGED
|
@@ -16,7 +16,8 @@ const main = defineCommand({
|
|
|
16
16
|
subCommands: {
|
|
17
17
|
prepare: () => import('./prepare.mjs').then((m) => m.default),
|
|
18
18
|
init: () => import('./init.mjs').then((m) => m.default),
|
|
19
|
-
run: () => import('./run.mjs').then((m) => m.default)
|
|
19
|
+
run: () => import('./run.mjs').then((m) => m.default),
|
|
20
|
+
install: () => import('./install.mjs').then((m) => m.default)
|
|
20
21
|
},
|
|
21
22
|
run({ args }) {
|
|
22
23
|
if (args.version)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { defineCommand } from 'citty';
|
|
4
|
+
import { consola } from 'consola';
|
|
5
|
+
import { resolve } from 'pathe';
|
|
6
|
+
import { version } from 'silgi/meta';
|
|
7
|
+
import { c as commonArgs } from './common.mjs';
|
|
8
|
+
import { l as loadOptions } from './loader.mjs';
|
|
9
|
+
import 'c12';
|
|
10
|
+
import 'compatx';
|
|
11
|
+
import 'klona/full';
|
|
12
|
+
import 'std-env';
|
|
13
|
+
import 'consola/utils';
|
|
14
|
+
import 'escape-string-regexp';
|
|
15
|
+
import 'mlly';
|
|
16
|
+
import 'pkg-types';
|
|
17
|
+
import 'silgi/kit';
|
|
18
|
+
import 'silgi/runtime/meta';
|
|
19
|
+
import 'ufo';
|
|
20
|
+
|
|
21
|
+
const install = defineCommand({
|
|
22
|
+
meta: {
|
|
23
|
+
name: "install",
|
|
24
|
+
description: "Install dependencies from the install.json file.",
|
|
25
|
+
version: version
|
|
26
|
+
},
|
|
27
|
+
args: {
|
|
28
|
+
...commonArgs,
|
|
29
|
+
preset: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "The build preset to use (you can also use `SILGI_PRESET` environment variable)."
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
async run() {
|
|
35
|
+
const silgiConfig = await loadOptions({});
|
|
36
|
+
const getCli = resolve(silgiConfig.build.dir, "install.json");
|
|
37
|
+
const cli = readFileSync(getCli, "utf-8");
|
|
38
|
+
const cliJson = JSON.parse(cli);
|
|
39
|
+
if (Object.keys(cliJson).length === 0) {
|
|
40
|
+
consola.info("Empty command list, maybe forgot pnpm silgi prepare?");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const deps = Object.keys(cliJson.dependencies || {}).join(" ");
|
|
44
|
+
const devDeps = Object.keys(cliJson.devDependencies || {}).join(" ");
|
|
45
|
+
if (deps) {
|
|
46
|
+
consola.info("Installing dependencies...");
|
|
47
|
+
execSync(`ni ${deps}`, { stdio: "inherit" });
|
|
48
|
+
}
|
|
49
|
+
if (devDeps) {
|
|
50
|
+
consola.info("Installing dev dependencies...");
|
|
51
|
+
execSync(`ni ${devDeps} -D`, { stdio: "inherit" });
|
|
52
|
+
}
|
|
53
|
+
consola.success("All dependencies installed successfully.");
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export { install as default };
|
package/dist/cli/prepare.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineCommand } from 'citty';
|
|
2
2
|
import { join, resolve, isAbsolute, relative, dirname, basename, extname } from 'pathe';
|
|
3
|
-
import { version } from 'silgi/meta';
|
|
3
|
+
import { devDependencies, version } from 'silgi/meta';
|
|
4
4
|
import { runtimeDir } from 'silgi/runtime/meta';
|
|
5
5
|
import { promises, existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
6
6
|
import { readdir } from 'node:fs/promises';
|
|
@@ -1542,6 +1542,25 @@ async function commands(silgi) {
|
|
|
1542
1542
|
});
|
|
1543
1543
|
}
|
|
1544
1544
|
|
|
1545
|
+
async function installPackages(silgi) {
|
|
1546
|
+
const packages = {
|
|
1547
|
+
dependencies: {
|
|
1548
|
+
"@fastify/deepmerge": devDependencies["@fastify/deepmerge"],
|
|
1549
|
+
...silgi.options.installPackages?.dependencies
|
|
1550
|
+
},
|
|
1551
|
+
devDependencies: {
|
|
1552
|
+
...silgi.options.installPackages?.devDependencies
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
1555
|
+
await silgi.callHook("prepare:installPackages", packages);
|
|
1556
|
+
addTemplate({
|
|
1557
|
+
filename: "install.json",
|
|
1558
|
+
where: ".silgi",
|
|
1559
|
+
write: true,
|
|
1560
|
+
getContents: () => JSON.stringify(packages, null, 2)
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1545
1564
|
const GLOB_SCAN_PATTERN = "**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}";
|
|
1546
1565
|
async function scanAndSyncOptions(silgi) {
|
|
1547
1566
|
const scannedModules = await scanModules(silgi);
|
|
@@ -1631,6 +1650,7 @@ async function createSilgiCLI(config = {}, opts = {}) {
|
|
|
1631
1650
|
await installModules(silgi);
|
|
1632
1651
|
await silgi.hooks.callHook("scanFiles:done", silgi);
|
|
1633
1652
|
await commands(silgi);
|
|
1653
|
+
await installPackages(silgi);
|
|
1634
1654
|
await generateApp(silgi);
|
|
1635
1655
|
if (silgi.options.imports) {
|
|
1636
1656
|
silgi.unimport = createUnimport(silgi.options.imports);
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED