@arkstack/console 0.17.16 → 0.17.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,7 +1,9 @@
1
+ import { r as resolveStubsDir } from "./helpers-BfDN6Q79.js";
1
2
  import { existsSync } from "node:fs";
2
- import path, { isAbsolute, join } from "node:path";
3
+ import path, { join } from "node:path";
3
4
  import { Arkstack } from "@arkstack/contract";
4
5
  import { CliApp } from "resora";
6
+ import { disposeArkormRuntime } from "arkormx";
5
7
 
6
8
  //#region dist/config.js
7
9
  const defaultConfig = (app) => {
@@ -21,17 +23,6 @@ const defaultConfig = (app) => {
21
23
 
22
24
  //#endregion
23
25
  //#region dist/app.js
24
- const resolveStubsDir = (config, options, core) => {
25
- const configuredDir = config?.localStubsDir;
26
- if (configuredDir) return isAbsolute(configuredDir) ? configuredDir : join(Arkstack.rootDir(), configuredDir);
27
- if (!options?.stubsDir) {
28
- const driver = core?.getDriver().name ?? "h3";
29
- let stubsDir = path.resolve(Arkstack.rootDir(), `node_modules/@arkstack/driver-${driver}/stubs`);
30
- if (!existsSync(stubsDir)) stubsDir = path.resolve(Arkstack.rootDir(), "stubs");
31
- return stubsDir;
32
- }
33
- return options?.stubsDir;
34
- };
35
26
  var ArkstackConsoleApp = class extends CliApp {
36
27
  core;
37
28
  options;
@@ -41,11 +32,19 @@ var ArkstackConsoleApp = class extends CliApp {
41
32
  this.options = options;
42
33
  this.mergeConfig();
43
34
  }
35
+ registerMusketListeners(musket) {
36
+ musket.afterHandle.on(async () => {
37
+ await disposeArkormRuntime();
38
+ process.exit(0);
39
+ });
40
+ }
44
41
  makeController = (name, opts) => {
45
42
  this.mergeConfig();
46
43
  const normalized = name.endsWith("Controller") ? name.replace(/controller/i, "") : name;
47
44
  let controllerName = normalized.endsWith("Controller") ? normalized : `${normalized}Controller`;
48
- const outputPath = join(path.resolve(Arkstack.rootDir(), "src", "app/http/controllers"), `${controllerName}.${opts?.ext ?? "ts"}`);
45
+ const controllersDir = path.resolve(Arkstack.rootDir(), "src", "app/http/controllers");
46
+ const fileName = `${controllerName}.${opts?.ext ?? "ts"}`;
47
+ const outputPath = join(controllersDir, fileName);
49
48
  const stubsDir = resolveStubsDir(this.config, this.options, this.core);
50
49
  if (!stubsDir) {
51
50
  console.error("Error: stubsDir is not configured. Set stubsDir in resora.config.js.");
@@ -92,4 +91,4 @@ var ArkstackConsoleApp = class extends CliApp {
92
91
  };
93
92
 
94
93
  //#endregion
95
- export { resolveStubsDir as n, ArkstackConsoleApp as t };
94
+ export { ArkstackConsoleApp as t };
package/dist/app.d.ts CHANGED
@@ -1,14 +1,12 @@
1
1
  import { n as Core, t as ConsoleAppOptions } from "./types-C5drRyQu.js";
2
2
  import { CliApp } from "resora";
3
-
3
+ import { Musket } from "@h3ravel/musket";
4
4
  //#region src/app.d.ts
5
- declare const resolveStubsDir: (config: {
6
- localStubsDir?: string;
7
- } | undefined, options?: ConsoleAppOptions, core?: Core) => string;
8
5
  declare class ArkstackConsoleApp<TCore extends Core> extends CliApp {
9
6
  core: TCore;
10
7
  private readonly options;
11
8
  constructor(core: TCore, options: ConsoleAppOptions);
9
+ registerMusketListeners(musket: Musket<this>): void;
12
10
  makeController: (name: string, opts: any) => string;
13
11
  /**
14
12
  * Normalize a file path by removing the current working directory from it.
@@ -24,4 +22,4 @@ declare class ArkstackConsoleApp<TCore extends Core> extends CliApp {
24
22
  mergeConfig: () => void;
25
23
  }
26
24
  //#endregion
27
- export { ArkstackConsoleApp, resolveStubsDir };
25
+ export { ArkstackConsoleApp };
package/dist/app.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as resolveStubsDir, t as ArkstackConsoleApp } from "./app-Ek2hTWvh.js";
1
+ import { t as ArkstackConsoleApp } from "./app-CJ5PtXEI.js";
2
2
 
3
- export { ArkstackConsoleApp, resolveStubsDir };
3
+ export { ArkstackConsoleApp };
@@ -1,7 +1,7 @@
1
1
  import { Publisher } from "@arkstack/common";
2
2
  import { existsSync, readdirSync } from "node:fs";
3
3
  import { pathToFileURL } from "node:url";
4
- import { join } from "node:path";
4
+ import { isAbsolute, join, resolve } from "node:path";
5
5
  import { Arkstack } from "@arkstack/contract";
6
6
 
7
7
  //#region dist/helpers.js
@@ -44,6 +44,17 @@ function groupPublishables(groupBy = "tag") {
44
44
  description: groupBy === "package" ? `${g.name} has ${g.tags.size} tag${g.tags.size === 1 ? "" : "s"} and ${g.entries} publishable${g.entries === 1 ? "" : "s"}` : g.name === "untagged" ? `These publishables have no tag and include ${g.entries} publishable${g.entries === 1 ? "" : "s"} from ${g.packages.size} package${g.packages.size === 1 ? "" : "s"}` : `This tag exists in ${g.packages.size} package${g.packages.size === 1 ? "" : "s"} and has ${g.entries} publishable${g.entries === 1 ? "" : "s"}`
45
45
  }));
46
46
  }
47
+ const resolveStubsDir = (config, options, core) => {
48
+ const configuredDir = config?.localStubsDir;
49
+ if (configuredDir) return isAbsolute(configuredDir) ? configuredDir : join(Arkstack.rootDir(), configuredDir);
50
+ if (!options?.stubsDir) {
51
+ const driver = core?.getDriver().name ?? "h3";
52
+ let stubsDir = resolve(Arkstack.rootDir(), `node_modules/@arkstack/driver-${driver}/stubs`);
53
+ if (!existsSync(stubsDir)) stubsDir = resolve(Arkstack.rootDir(), "stubs");
54
+ return stubsDir;
55
+ }
56
+ return options?.stubsDir;
57
+ };
47
58
 
48
59
  //#endregion
49
- export { loadPackageSetups as n, groupPublishables as t };
60
+ export { loadPackageSetups as n, resolveStubsDir as r, groupPublishables as t };
package/dist/helpers.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { r as GroupedOption } from "./types-C5drRyQu.js";
2
-
1
+ import { n as Core, r as GroupedOption, t as ConsoleAppOptions } from "./types-C5drRyQu.js";
3
2
  //#region src/helpers.d.ts
4
3
  /**
5
4
  * Import the `setup` module of every installed `@arkstack/*` package so its
@@ -8,5 +7,8 @@ import { r as GroupedOption } from "./types-C5drRyQu.js";
8
7
  */
9
8
  declare const loadPackageSetups: () => Promise<void>;
10
9
  declare function groupPublishables(groupBy?: 'tag' | 'package'): GroupedOption[];
10
+ declare const resolveStubsDir: (config: {
11
+ localStubsDir?: string;
12
+ } | undefined, options?: ConsoleAppOptions, core?: Core) => string;
11
13
  //#endregion
12
- export { groupPublishables, loadPackageSetups };
14
+ export { groupPublishables, loadPackageSetups, resolveStubsDir };
package/dist/helpers.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as loadPackageSetups, t as groupPublishables } from "./helpers-CjopNM66.js";
1
+ import { n as loadPackageSetups, r as resolveStubsDir, t as groupPublishables } from "./helpers-BfDN6Q79.js";
2
2
 
3
- export { groupPublishables, loadPackageSetups };
3
+ export { groupPublishables, loadPackageSetups, resolveStubsDir };
package/dist/index.d.ts CHANGED
@@ -38,10 +38,10 @@ declare class BuildInterfaces {
38
38
  private static resolveEnvFile;
39
39
  /**
40
40
  * Parse `KEY=VALUE` lines, skipping blanks, comments and invalid names.
41
- *
42
- * @param contents
43
- * @returns
44
- */
41
+ *
42
+ * @param contents
43
+ * @returns
44
+ */
45
45
  private static parseEnvFile;
46
46
  /**
47
47
  * Infer a TS type from a value, mirroring env()'s runtime coercion.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as ArkstackConsoleApp } from "./app-Ek2hTWvh.js";
3
- import { n as loadPackageSetups, t as groupPublishables } from "./helpers-CjopNM66.js";
2
+ import { t as ArkstackConsoleApp } from "./app-CJ5PtXEI.js";
3
+ import { n as loadPackageSetups, t as groupPublishables } from "./helpers-BfDN6Q79.js";
4
4
  import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-BeMseJhx.js";
5
5
  import { createRequire } from "node:module";
6
6
  import { Publisher, abort, abortIf, assertFound, config, discoverCommands, env, importFile, initializeGlobalContext, loadPrototypes, outputDir, rebuildOutput } from "@arkstack/common";
@@ -12,7 +12,7 @@ import { MakeResource, applyRuntimeConfig, getDefaultConfig } from "resora";
12
12
  import { Command, Kernel } from "@h3ravel/musket";
13
13
  import { spawn } from "node:child_process";
14
14
  import { randomBytes } from "node:crypto";
15
- import { resolve } from "path";
15
+ import { resolve as resolve$1 } from "path";
16
16
  import { writeFile } from "fs/promises";
17
17
  import chalk from "chalk";
18
18
  import { str } from "@h3ravel/support";
@@ -25,7 +25,8 @@ var BuildCommand = class extends Command {
25
25
  description = "Build the application for production";
26
26
  async handle() {
27
27
  await new Promise((resolve, reject) => {
28
- const child = spawn(process.platform === "win32" ? "pnpm.cmd" : "pnpm", ["exec", "tsdown"], {
28
+ const command = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
29
+ const child = spawn(command, ["exec", "tsdown"], {
29
30
  cwd: Arkstack.rootDir(),
30
31
  stdio: "inherit",
31
32
  env: Object.assign(process.env, {
@@ -206,7 +207,7 @@ var MakeCommand = class extends Command {
206
207
  const name = String(this.argument("name")).replace(/\s+/g, "").replace(/\.js$/, "").trim();
207
208
  if (!name) return void this.error("Command name is required");
208
209
  const stubContent = this.stub(name);
209
- const filePath = resolve(Arkstack.rootDir(), "src", `app/console/commands/${name}.js`);
210
+ const filePath = resolve$1(Arkstack.rootDir(), "src", `app/console/commands/${name}.js`);
210
211
  await writeFile(filePath, stubContent, { flag: "wx" });
211
212
  this.success(`Command ${name} created successfully at ${filePath}`);
212
213
  }
package/dist/prepare.d.ts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
package/dist/prepare.js CHANGED
@@ -82,7 +82,8 @@ BuildInterfaces.tsconfig();
82
82
  await ArkormArtifacts.sync();
83
83
  const LOG_LEVEL = parseInt(process.env.VERBOSITY ?? "0") > 0 ? [] : ["--log-level=silent"];
84
84
  const NODE_ENV = process.env.NODE_ENV || "development";
85
- const child = spawn(process.platform === "win32" ? "pnpm.cmd" : "pnpm", [
85
+ const command = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
86
+ const child = spawn(command, [
86
87
  "exec",
87
88
  "tsdown",
88
89
  ...LOG_LEVEL
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/console",
3
- "version": "0.17.16",
3
+ "version": "0.17.17",
4
4
  "type": "module",
5
5
  "description": "Console module for Arkstack, providing the command-line runtime and console integration layer.",
6
6
  "homepage": "https://arkstack.toneflix.net/guide/cli",
@@ -40,18 +40,18 @@
40
40
  "access": "public"
41
41
  },
42
42
  "peerDependencies": {
43
- "arkormx": "^2.12.0",
44
- "clear-router": "^2.9.2",
45
- "@arkstack/database": "^0.17.16"
43
+ "arkormx": "^2.12.8",
44
+ "clear-router": "^2.9.3",
45
+ "@arkstack/database": "^0.17.17"
46
46
  },
47
47
  "dependencies": {
48
- "@h3ravel/musket": "^2.2.2",
49
- "@h3ravel/support": "^2.2.4",
48
+ "@h3ravel/musket": "^2.2.13",
49
+ "@h3ravel/support": "^2.2.7",
50
50
  "chalk": "^5.6.2",
51
- "resora": "^1.3.32",
51
+ "resora": "^1.3.34",
52
52
  "ts-morph": "^28.0.0",
53
- "@arkstack/common": "^0.17.16",
54
- "@arkstack/contract": "^0.17.16"
53
+ "@arkstack/common": "^0.17.17",
54
+ "@arkstack/contract": "^0.17.17"
55
55
  },
56
56
  "peerDependenciesMeta": {
57
57
  "@arkstack/database": {