@arkstack/console 0.17.16 → 0.17.18
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/{app-Ek2hTWvh.js → app-CJ5PtXEI.js} +13 -14
- package/dist/app.d.ts +3 -5
- package/dist/app.js +2 -2
- package/dist/{helpers-CjopNM66.js → helpers-BfDN6Q79.js} +13 -2
- package/dist/helpers.d.ts +5 -3
- package/dist/helpers.js +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +44 -24
- package/dist/prepare.d.ts +1 -1
- package/dist/prepare.js +2 -1
- package/package.json +10 -9
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { r as resolveStubsDir } from "./helpers-BfDN6Q79.js";
|
|
1
2
|
import { existsSync } from "node:fs";
|
|
2
|
-
import 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
|
|
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 {
|
|
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
|
|
25
|
+
export { ArkstackConsoleApp };
|
package/dist/app.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as ArkstackConsoleApp } from "./app-CJ5PtXEI.js";
|
|
2
2
|
|
|
3
|
-
export { ArkstackConsoleApp
|
|
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-
|
|
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
|
-
|
|
43
|
-
|
|
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-
|
|
3
|
-
import { n as loadPackageSetups, t as groupPublishables } from "./helpers-
|
|
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";
|
|
@@ -11,8 +11,9 @@ import { Arkstack } from "@arkstack/contract";
|
|
|
11
11
|
import { MakeResource, applyRuntimeConfig, getDefaultConfig } from "resora";
|
|
12
12
|
import { Command, Kernel } from "@h3ravel/musket";
|
|
13
13
|
import { spawn } from "node:child_process";
|
|
14
|
+
import ngrok from "@ngrok/ngrok";
|
|
14
15
|
import { randomBytes } from "node:crypto";
|
|
15
|
-
import { resolve } from "path";
|
|
16
|
+
import { resolve as resolve$1 } from "path";
|
|
16
17
|
import { writeFile } from "fs/promises";
|
|
17
18
|
import chalk from "chalk";
|
|
18
19
|
import { str } from "@h3ravel/support";
|
|
@@ -25,7 +26,8 @@ var BuildCommand = class extends Command {
|
|
|
25
26
|
description = "Build the application for production";
|
|
26
27
|
async handle() {
|
|
27
28
|
await new Promise((resolve, reject) => {
|
|
28
|
-
const
|
|
29
|
+
const command = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
|
|
30
|
+
const child = spawn(command, ["exec", "tsdown"], {
|
|
29
31
|
cwd: Arkstack.rootDir(),
|
|
30
32
|
stdio: "inherit",
|
|
31
33
|
env: Object.assign(process.env, {
|
|
@@ -60,6 +62,19 @@ var DevCommand = class DevCommand extends Command {
|
|
|
60
62
|
const vars = DevCommand.devServerEnv(this.options());
|
|
61
63
|
const rootDir = Arkstack.rootDir();
|
|
62
64
|
const bin = DevCommand.resolveTsdownBin(rootDir);
|
|
65
|
+
let tunnel;
|
|
66
|
+
if (this.option?.("tunnel")) {
|
|
67
|
+
tunnel = await ngrok.forward({
|
|
68
|
+
addr: Number(env("APP_PORT", env("PORT", 3e3))),
|
|
69
|
+
authtoken: env("NGROK_AUTHTOKEN"),
|
|
70
|
+
domain: env("NGROK_DOMAIN")
|
|
71
|
+
});
|
|
72
|
+
const url = tunnel.url();
|
|
73
|
+
if (url) {
|
|
74
|
+
vars.TUNNEL_URL = url;
|
|
75
|
+
console.log(`Traffic has been tunnelled to ${url}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
63
78
|
const [command, args] = bin ? [process.execPath, [
|
|
64
79
|
bin,
|
|
65
80
|
"--log-level",
|
|
@@ -70,23 +85,27 @@ var DevCommand = class DevCommand extends Command {
|
|
|
70
85
|
"--log-level",
|
|
71
86
|
"silent"
|
|
72
87
|
]];
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
try {
|
|
89
|
+
await new Promise((resolve, reject) => {
|
|
90
|
+
const child = spawn(command, args, {
|
|
91
|
+
cwd: rootDir,
|
|
92
|
+
stdio: "inherit",
|
|
93
|
+
env: Object.assign({}, process.env, vars)
|
|
94
|
+
});
|
|
95
|
+
child.on("error", (error) => {
|
|
96
|
+
reject(error);
|
|
97
|
+
});
|
|
98
|
+
child.on("exit", (code) => {
|
|
99
|
+
if (code === 0 || code === null) {
|
|
100
|
+
resolve();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
reject(/* @__PURE__ */ new Error(`tsdown exited with code ${code}`));
|
|
104
|
+
});
|
|
88
105
|
});
|
|
89
|
-
}
|
|
106
|
+
} finally {
|
|
107
|
+
await tunnel?.close();
|
|
108
|
+
}
|
|
90
109
|
}
|
|
91
110
|
/**
|
|
92
111
|
* Resolve the absolute path to tsdown's executable so it can be run directly
|
|
@@ -111,7 +130,8 @@ var DevCommand = class DevCommand extends Command {
|
|
|
111
130
|
*
|
|
112
131
|
* The dev server binds `127.0.0.1` by default so it is local-only; `--host`
|
|
113
132
|
* switches it to `0.0.0.0` to expose it on the local network. `--secure` flags
|
|
114
|
-
* the driver to serve HTTPS
|
|
133
|
+
* the driver to serve HTTPS. The command itself owns the Ngrok tunnel so
|
|
134
|
+
* watcher-driven application restarts cannot replace its public URL.
|
|
115
135
|
*
|
|
116
136
|
* @param options
|
|
117
137
|
* @returns
|
|
@@ -119,9 +139,9 @@ var DevCommand = class DevCommand extends Command {
|
|
|
119
139
|
static devServerEnv(options) {
|
|
120
140
|
const vars = {
|
|
121
141
|
NODE_ENV: "development",
|
|
122
|
-
APP_HOST: options.host ? "0.0.0.0" : "127.0.0.1"
|
|
142
|
+
APP_HOST: options.host ? "0.0.0.0" : "127.0.0.1",
|
|
143
|
+
ARKSTACK_ENV_RELOAD: "true"
|
|
123
144
|
};
|
|
124
|
-
if (options.tunnel) vars.TUNNEL = "true";
|
|
125
145
|
if (options.secure) vars.APP_SECURE = "true";
|
|
126
146
|
return vars;
|
|
127
147
|
}
|
|
@@ -206,7 +226,7 @@ var MakeCommand = class extends Command {
|
|
|
206
226
|
const name = String(this.argument("name")).replace(/\s+/g, "").replace(/\.js$/, "").trim();
|
|
207
227
|
if (!name) return void this.error("Command name is required");
|
|
208
228
|
const stubContent = this.stub(name);
|
|
209
|
-
const filePath = resolve(Arkstack.rootDir(), "src", `app/console/commands/${name}.js`);
|
|
229
|
+
const filePath = resolve$1(Arkstack.rootDir(), "src", `app/console/commands/${name}.js`);
|
|
210
230
|
await writeFile(filePath, stubContent, { flag: "wx" });
|
|
211
231
|
this.success(`Command ${name} created successfully at ${filePath}`);
|
|
212
232
|
}
|
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
|
|
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.
|
|
3
|
+
"version": "0.17.18",
|
|
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,19 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"arkormx": "^2.12.
|
|
44
|
-
"clear-router": "^2.9.
|
|
45
|
-
"@arkstack/database": "^0.17.
|
|
43
|
+
"arkormx": "^2.12.8",
|
|
44
|
+
"clear-router": "^2.9.3",
|
|
45
|
+
"@arkstack/database": "^0.17.18"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"@h3ravel/
|
|
48
|
+
"@ngrok/ngrok": "^1.7.0",
|
|
49
|
+
"@h3ravel/musket": "^2.2.13",
|
|
50
|
+
"@h3ravel/support": "^2.2.7",
|
|
50
51
|
"chalk": "^5.6.2",
|
|
51
|
-
"resora": "^1.3.
|
|
52
|
+
"resora": "^1.3.34",
|
|
52
53
|
"ts-morph": "^28.0.0",
|
|
53
|
-
"@arkstack/common": "^0.17.
|
|
54
|
-
"@arkstack/contract": "^0.17.
|
|
54
|
+
"@arkstack/common": "^0.17.18",
|
|
55
|
+
"@arkstack/contract": "^0.17.18"
|
|
55
56
|
},
|
|
56
57
|
"peerDependenciesMeta": {
|
|
57
58
|
"@arkstack/database": {
|