@arkstack/console-slim 0.9.0 → 0.10.0

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,5 @@
1
1
  import path, { isAbsolute, join } from "node:path";
2
+ import { Arkstack } from "@arkstack/contract";
2
3
  import { CliApp } from "resora";
3
4
  import { existsSync } from "node:fs";
4
5
 
@@ -22,11 +23,11 @@ const defaultConfig = (app) => {
22
23
  //#region dist/app.js
23
24
  const resolveStubsDir = (config, options, core) => {
24
25
  const configuredDir = config?.localStubsDir;
25
- if (configuredDir) return isAbsolute(configuredDir) ? configuredDir : join(process.cwd(), configuredDir);
26
+ if (configuredDir) return isAbsolute(configuredDir) ? configuredDir : join(Arkstack.rootDir(), configuredDir);
26
27
  if (!options?.stubsDir) {
27
28
  const driver = core?.getDriver().name ?? "h3";
28
- let stubsDir = path.resolve(process.cwd(), `node_modules/@arkstack/driver-${driver}/stubs`);
29
- if (!existsSync(stubsDir)) stubsDir = path.resolve(process.cwd(), "stubs");
29
+ let stubsDir = path.resolve(Arkstack.rootDir(), `node_modules/@arkstack/driver-${driver}/stubs`);
30
+ if (!existsSync(stubsDir)) stubsDir = path.resolve(Arkstack.rootDir(), "stubs");
30
31
  return stubsDir;
31
32
  }
32
33
  return options?.stubsDir;
@@ -44,7 +45,7 @@ var ArkstackConsoleApp = class extends CliApp {
44
45
  this.mergeConfig();
45
46
  const normalized = name.endsWith("Controller") ? name.replace(/controller/i, "") : name;
46
47
  let controllerName = normalized.endsWith("Controller") ? normalized : `${normalized}Controller`;
47
- const outputPath = join(path.resolve(process.cwd(), "src", "app/http/controllers"), `${controllerName}.${opts?.ext ?? "ts"}`);
48
+ const outputPath = join(path.resolve(Arkstack.rootDir(), "src", "app/http/controllers"), `${controllerName}.${opts?.ext ?? "ts"}`);
48
49
  const stubsDir = resolveStubsDir(this.config, this.options, this.core);
49
50
  if (!stubsDir) {
50
51
  console.error("Error: stubsDir is not configured. Set stubsDir in resora.config.js.");
@@ -71,7 +72,7 @@ var ArkstackConsoleApp = class extends CliApp {
71
72
  * @returns
72
73
  */
73
74
  normalizePath = (p) => {
74
- return p.replace(process.cwd(), "");
75
+ return p.replace(Arkstack.rootDir(), "");
75
76
  };
76
77
  /**
77
78
  * Recursively merge defaultConfig with config from resora.config.js, giving
package/dist/app.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as resolveStubsDir, t as ArkstackConsoleApp } from "./app-DtecNuLP.js";
1
+ import { n as resolveStubsDir, t as ArkstackConsoleApp } from "./app-Co9YdqkD.js";
2
2
 
3
3
  export { ArkstackConsoleApp, resolveStubsDir };
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { t as ArkstackConsoleApp } from "./app-DtecNuLP.js";
2
+ import { t as ArkstackConsoleApp } from "./app-Co9YdqkD.js";
3
3
  import { config, env, importFile, loadPrototypes, outputDir } from "@arkstack/common";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import path, { join } from "node:path";
6
+ import { Arkstack } from "@arkstack/contract";
6
7
  import { MakeResource } from "resora";
7
8
  import { realpathSync } from "node:fs";
8
9
  import { Command, Kernel } from "@h3ravel/musket";
@@ -18,7 +19,7 @@ var BuildCommand = class extends Command {
18
19
  async handle() {
19
20
  await new Promise((resolve, reject) => {
20
21
  const child = spawn(process.platform === "win32" ? "pnpm.cmd" : "pnpm", ["exec", "tsdown"], {
21
- cwd: process.cwd(),
22
+ cwd: Arkstack.rootDir(),
22
23
  stdio: "inherit",
23
24
  env: Object.assign({}, process.env, { NODE_ENV: "production" })
24
25
  });
@@ -49,7 +50,7 @@ var DevCommand = class extends Command {
49
50
  "--log-level",
50
51
  "silent"
51
52
  ], {
52
- cwd: process.cwd(),
53
+ cwd: Arkstack.rootDir(),
53
54
  stdio: "inherit"
54
55
  });
55
56
  child.on("error", (error) => {
@@ -77,7 +78,7 @@ var MakeCommand = class extends Command {
77
78
  const name = String(this.argument("name")).replace(/\s+/g, "").replace(/\.js$/, "").trim();
78
79
  if (!name) return void this.error("Command name is required");
79
80
  const stubContent = this.stub(name);
80
- const filePath = resolve(process.cwd(), "src", `app/console/commands/${name}.js`);
81
+ const filePath = resolve(Arkstack.rootDir(), "src", `app/console/commands/${name}.js`);
81
82
  await writeFile(filePath, stubContent, { flag: "wx" });
82
83
  this.success(`Command ${name} created successfully at ${filePath}`);
83
84
  }
@@ -201,8 +202,8 @@ var logo_default = String.raw`
201
202
  * @returns
202
203
  */
203
204
  const loadCoreApp = async () => {
204
- const dist = path.relative(process.cwd(), outputDir());
205
- return (await importFile(join(process.cwd(), `${dist}/core/bootstrap.js`))).app;
205
+ const dist = path.relative(Arkstack.rootDir(), outputDir());
206
+ return (await importFile(join(Arkstack.rootDir(), `${dist}/core/bootstrap.js`))).app;
206
207
  };
207
208
  /**
208
209
  * Runs the console kernel, initializing the application and registering commands.
@@ -212,7 +213,7 @@ const loadCoreApp = async () => {
212
213
  const runConsoleKernel = async (options = {}) => {
213
214
  loadPrototypes();
214
215
  const app = await loadCoreApp();
215
- const dist = path.relative(process.cwd(), outputDir());
216
+ const dist = path.relative(Arkstack.rootDir(), outputDir());
216
217
  const stubsDir = process.env.ARKSTACK_STUBS_DIR;
217
218
  globalThis.app = () => app;
218
219
  globalThis.env = env;
@@ -231,12 +232,12 @@ const runConsoleKernel = async (options = {}) => {
231
232
  MakeCommand
232
233
  ],
233
234
  discoveryPaths: [
234
- join(process.cwd(), "src", "app", "console", "commands/*.js"),
235
- join(process.cwd(), "src", "app/console/commands/*.js"),
236
- join(process.cwd(), "src", "app/console/commands/*.mjs"),
237
- join(process.cwd(), dist, "app/console/commands/*.js"),
238
- join(process.cwd(), dist, "app/console/commands/*.mjs"),
239
- join(process.cwd(), "node_modules", "@arkstack/*", "dist", "commands", "*.js")
235
+ join(Arkstack.rootDir(), "src", "app", "console", "commands/*.js"),
236
+ join(Arkstack.rootDir(), "src", "app/console/commands/*.js"),
237
+ join(Arkstack.rootDir(), "src", "app/console/commands/*.mjs"),
238
+ join(Arkstack.rootDir(), dist, "app/console/commands/*.js"),
239
+ join(Arkstack.rootDir(), dist, "app/console/commands/*.mjs"),
240
+ join(Arkstack.rootDir(), "node_modules", "@arkstack/*", "dist", "commands", "*.js")
240
241
  ],
241
242
  exceptionHandler(exception) {
242
243
  throw exception;
package/dist/prepare.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { Arkstack } from "@arkstack/contract";
1
2
  import { spawn } from "node:child_process";
2
3
  import chalk from "chalk";
3
4
 
@@ -8,7 +9,7 @@ const child = spawn(process.platform === "win32" ? "pnpm.cmd" : "pnpm", [
8
9
  "tsdown",
9
10
  "--log-level=silent"
10
11
  ], {
11
- cwd: process.cwd(),
12
+ cwd: Arkstack.rootDir(),
12
13
  stdio: "inherit",
13
14
  env: Object.assign({}, process.env, {
14
15
  NODE_ENV,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/console-slim",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Slim console module for Arkstack, providing the command-line runtime and console integration layer.",
6
6
  "homepage": "https://arkstack.toneflix.net",
@@ -48,8 +48,8 @@
48
48
  "@h3ravel/musket": "^0.10.1",
49
49
  "chalk": "^5.6.2",
50
50
  "resora": "^1.3.6",
51
- "@arkstack/common": "^0.9.0",
52
- "@arkstack/contract": "^0.9.0"
51
+ "@arkstack/common": "^0.10.0",
52
+ "@arkstack/contract": "^0.10.0"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "tsdown",