silgi 0.8.0 → 0.8.1

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.0";
1
+ const version = "0.8.1";
2
2
  const packageJson = {
3
3
  version: version};
4
4
 
@@ -1537,10 +1537,7 @@ async function compileTemplate(template, ctx) {
1537
1537
 
1538
1538
  async function commands(silgi) {
1539
1539
  const commands2 = {
1540
- module1: {
1541
- dev: 'echo "module dev"',
1542
- build: 'echo "module build"'
1543
- }
1540
+ ...silgi.options.commands
1544
1541
  };
1545
1542
  await silgi.callHook("prepare:commands", commands2);
1546
1543
  addTemplate({
package/dist/cli/run.mjs CHANGED
@@ -55,7 +55,13 @@ const run = defineCommand({
55
55
  }))
56
56
  });
57
57
  const script = scripts[scriptName];
58
- execSync(script, { stdio: "inherit" });
58
+ if (script.type === "command") {
59
+ execSync(script.handler, { stdio: "inherit" });
60
+ }
61
+ if (script.type === "function") {
62
+ const fn = eval(`(${script.handler})`);
63
+ fn();
64
+ }
59
65
  }
60
66
  });
61
67
 
@@ -1,3 +1,3 @@
1
- const version = "0.8.0";
1
+ const version = "0.8.1";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "0.8.0";
1
+ const version = "0.8.1";
2
2
 
3
3
  export { version };
@@ -8,9 +8,6 @@ const h3 = defineSilgiPreset(
8
8
  },
9
9
  prerender: {
10
10
  crawlLinks: true
11
- },
12
- commands: {
13
- preview: "npx serve ./public"
14
11
  }
15
12
  },
16
13
  {
@@ -12,9 +12,6 @@ const nitro = defineSilgiPreset(
12
12
  typescript: {
13
13
  generateTsConfig: false,
14
14
  tsconfigPath: ".nitro/types/silgi.tsconfig.json"
15
- },
16
- commands: {
17
- preview: "npx serve ./public"
18
15
  }
19
16
  },
20
17
  {
@@ -9,10 +9,7 @@ const npmPackage = defineSilgiPreset(
9
9
  silgi: {
10
10
  serverDir: "{{ serverDir }}/silgi"
11
11
  },
12
- modules: ["./src"],
13
- commands: {
14
- preview: "npx serve ./public"
15
- }
12
+ modules: ["./src"]
16
13
  },
17
14
  {
18
15
  name: "npm-package",
@@ -12,9 +12,6 @@ const nuxt = defineSilgiPreset(
12
12
  typescript: {
13
13
  generateTsConfig: false,
14
14
  tsconfigPath: ".nuxt/silgi.tsconfig.json"
15
- },
16
- commands: {
17
- preview: "npx serve ./public"
18
15
  }
19
16
  },
20
17
  {
@@ -351,7 +351,11 @@ interface SilgiCLIHooks extends SilgiHooks {
351
351
  */
352
352
  'app:templatesGenerated': (app: SilgiCLI, templates: ResolvedSilgiTemplate[], options?: GenerateAppOptions) => HookResult;
353
353
  'scanFiles:done': (app: SilgiCLI) => HookResult;
354
- 'prepare:commands': (commands: Record<string, Record<string, string>>) => HookResult;
354
+ 'prepare:commands': (commands: Record<string, Record<string, {
355
+ type: 'function' | 'command';
356
+ handler: string;
357
+ description?: string;
358
+ }>>) => HookResult;
355
359
  }
356
360
 
357
361
  /**
@@ -726,7 +730,11 @@ interface SilgiCLIOptions extends PresetOptions {
726
730
  * ```
727
731
  */
728
732
  ignoreOptions: Options;
729
- commands: Record<string, string>;
733
+ commands: Record<string, Record<string, {
734
+ type: 'function' | 'command';
735
+ handler: string;
736
+ description?: string;
737
+ }>>;
730
738
  }
731
739
  /**
732
740
  * Silgi input config (silgi.config)
@@ -351,7 +351,11 @@ interface SilgiCLIHooks extends SilgiHooks {
351
351
  */
352
352
  'app:templatesGenerated': (app: SilgiCLI, templates: ResolvedSilgiTemplate[], options?: GenerateAppOptions) => HookResult;
353
353
  'scanFiles:done': (app: SilgiCLI) => HookResult;
354
- 'prepare:commands': (commands: Record<string, Record<string, string>>) => HookResult;
354
+ 'prepare:commands': (commands: Record<string, Record<string, {
355
+ type: 'function' | 'command';
356
+ handler: string;
357
+ description?: string;
358
+ }>>) => HookResult;
355
359
  }
356
360
 
357
361
  /**
@@ -726,7 +730,11 @@ interface SilgiCLIOptions extends PresetOptions {
726
730
  * ```
727
731
  */
728
732
  ignoreOptions: Options;
729
- commands: Record<string, string>;
733
+ commands: Record<string, Record<string, {
734
+ type: 'function' | 'command';
735
+ handler: string;
736
+ description?: string;
737
+ }>>;
730
738
  }
731
739
  /**
732
740
  * Silgi input config (silgi.config)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.8.0",
4
+ "version": "0.8.1",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {