silgi 0.8.15 → 0.8.17

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.
@@ -1,4 +1,4 @@
1
- const version = "0.8.15";
1
+ const version = "0.8.17";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.2.0",
4
4
  "@fastify/deepmerge": "^2.0.2",
@@ -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 };
@@ -1546,13 +1546,22 @@ async function installPackages(silgi) {
1546
1546
  const packages = {
1547
1547
  dependencies: {
1548
1548
  "@fastify/deepmerge": devDependencies["@fastify/deepmerge"],
1549
- ...silgi.options.installPackages.dependencies
1549
+ ...silgi.options.installPackages?.dependencies
1550
1550
  },
1551
1551
  devDependencies: {
1552
- ...silgi.options.installPackages.devDependencies
1552
+ ...silgi.options.installPackages?.devDependencies
1553
1553
  }
1554
1554
  };
1555
1555
  await silgi.callHook("prepare:installPackages", packages);
1556
+ if (silgi.options.preset === "npm-package") {
1557
+ packages.devDependencies = {
1558
+ ...packages.devDependencies,
1559
+ ...packages.dependencies,
1560
+ "@types/node": devDependencies["@types/node"],
1561
+ "typescript": devDependencies.typescript
1562
+ };
1563
+ packages.dependencies = {};
1564
+ }
1556
1565
  addTemplate({
1557
1566
  filename: "install.json",
1558
1567
  where: ".silgi",
@@ -1,4 +1,4 @@
1
- const version = "0.8.15";
1
+ const version = "0.8.17";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.2.0",
4
4
  "@fastify/deepmerge": "^2.0.2",
@@ -1,4 +1,4 @@
1
- const version = "0.8.15";
1
+ const version = "0.8.17";
2
2
  const devDependencies = {
3
3
  "@antfu/eslint-config": "^4.2.0",
4
4
  "@fastify/deepmerge": "^2.0.2",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.8.15",
4
+ "version": "0.8.17",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {