@arkstack/console 0.12.35 → 0.12.37
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,6 +1,6 @@
|
|
|
1
|
+
import { readdirSync, writeFileSync } from "node:fs";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import { Arkstack } from "@arkstack/contract";
|
|
3
|
-
import { readdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { Node, Project } from "ts-morph";
|
|
5
5
|
|
|
6
6
|
//#region src/prepare/TSConfig.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
1
2
|
import path, { isAbsolute, join } from "node:path";
|
|
2
3
|
import { Arkstack } from "@arkstack/contract";
|
|
3
4
|
import { CliApp } from "resora";
|
|
4
|
-
import { existsSync } from "node:fs";
|
|
5
5
|
|
|
6
6
|
//#region dist/config.js
|
|
7
7
|
const defaultConfig = (app) => {
|
package/dist/app.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as ArkstackConsoleApp } from "./app-
|
|
3
|
-
import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-
|
|
4
|
-
import { abort, abortIf, assertFound, config, env, importFile, initializeGlobalContext, loadPrototypes, outputDir } from "@arkstack/common";
|
|
2
|
+
import { t as ArkstackConsoleApp } from "./app-DnaQWE9q.js";
|
|
3
|
+
import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-CsZ3Uerb.js";
|
|
4
|
+
import { abort, abortIf, assertFound, config, discoverCommands, env, importFile, initializeGlobalContext, loadPrototypes, outputDir, rebuildOutput } from "@arkstack/common";
|
|
5
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
5
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
7
|
import path, { join } from "node:path";
|
|
7
8
|
import { Arkstack } from "@arkstack/contract";
|
|
8
9
|
import { MakeResource } from "resora";
|
|
9
|
-
import { realpathSync } from "node:fs";
|
|
10
10
|
import { Command, Kernel } from "@h3ravel/musket";
|
|
11
11
|
import { spawn } from "node:child_process";
|
|
12
12
|
import { resolve } from "path";
|
|
@@ -260,14 +260,37 @@ var logo_default = String.raw`
|
|
|
260
260
|
|
|
261
261
|
//#endregion
|
|
262
262
|
//#region dist/index.js
|
|
263
|
-
/**
|
|
264
|
-
*
|
|
263
|
+
/**
|
|
264
|
+
* A missing-module error from importing a stale/incomplete build artifact.
|
|
265
265
|
*
|
|
266
|
+
* @param error
|
|
266
267
|
* @returns
|
|
267
268
|
*/
|
|
269
|
+
const isMissingModuleError = (error) => {
|
|
270
|
+
const code = error?.code;
|
|
271
|
+
return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND";
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Loads the core application instance by importing the built bootstrap file.
|
|
275
|
+
*
|
|
276
|
+
* The kernel boots this for every command — including `build` — before the build
|
|
277
|
+
* can run, so a stale or incomplete build artifact (source changed since the last
|
|
278
|
+
* build: a module moved, renamed, or added) would otherwise wedge startup with
|
|
279
|
+
* `Cannot find module '<outDir>/...'` and the build could never self-heal. When
|
|
280
|
+
* that happens and source is present, regenerate the output once and retry.
|
|
281
|
+
*
|
|
282
|
+
* @returns
|
|
283
|
+
*/
|
|
268
284
|
const loadCoreApp = async () => {
|
|
269
285
|
const dist = path.relative(Arkstack.rootDir(), outputDir());
|
|
270
|
-
|
|
286
|
+
const bootstrapPath = join(Arkstack.rootDir(), `${dist}/core/bootstrap.js`);
|
|
287
|
+
try {
|
|
288
|
+
return (await importFile(bootstrapPath)).app;
|
|
289
|
+
} catch (error) {
|
|
290
|
+
if (!isMissingModuleError(error) || !existsSync(join(Arkstack.rootDir(), "src"))) throw error;
|
|
291
|
+
await rebuildOutput();
|
|
292
|
+
return (await importFile(bootstrapPath)).app;
|
|
293
|
+
}
|
|
271
294
|
};
|
|
272
295
|
/**
|
|
273
296
|
* Runs the console kernel, initializing the application and registering commands.
|
|
@@ -277,7 +300,6 @@ const loadCoreApp = async () => {
|
|
|
277
300
|
const runConsoleKernel = async (options = {}) => {
|
|
278
301
|
loadPrototypes();
|
|
279
302
|
const app = await loadCoreApp();
|
|
280
|
-
const dist = path.relative(Arkstack.rootDir(), outputDir());
|
|
281
303
|
const stubsDir = process.env.ARKSTACK_STUBS_DIR;
|
|
282
304
|
globalThis.app = () => app;
|
|
283
305
|
globalThis.env = env;
|
|
@@ -288,6 +310,7 @@ const runConsoleKernel = async (options = {}) => {
|
|
|
288
310
|
globalThis.assertFound = assertFound;
|
|
289
311
|
globalThis.arkctx = { runtime: "CLI" };
|
|
290
312
|
await initializeGlobalContext();
|
|
313
|
+
const userCommands = await discoverCommands();
|
|
291
314
|
await Kernel.init(await new ArkstackConsoleApp(app, { stubsDir }).loadConfig(), {
|
|
292
315
|
logo: options.logo ?? logo_default,
|
|
293
316
|
name: "Cmd",
|
|
@@ -298,16 +321,10 @@ const runConsoleKernel = async (options = {}) => {
|
|
|
298
321
|
MakeFullResource,
|
|
299
322
|
DevCommand,
|
|
300
323
|
BuildCommand,
|
|
301
|
-
MakeCommand
|
|
302
|
-
|
|
303
|
-
discoveryPaths: [
|
|
304
|
-
join(Arkstack.rootDir(), "src", "app", "console", "commands/*.js"),
|
|
305
|
-
join(Arkstack.rootDir(), "src", "app/console/commands/*.js"),
|
|
306
|
-
join(Arkstack.rootDir(), "src", "app/console/commands/*.mjs"),
|
|
307
|
-
join(Arkstack.rootDir(), dist, "app/console/commands/*.js"),
|
|
308
|
-
join(Arkstack.rootDir(), dist, "app/console/commands/*.mjs"),
|
|
309
|
-
join(Arkstack.rootDir(), "node_modules", "@arkstack/*", "dist", "commands", "*.js")
|
|
324
|
+
MakeCommand,
|
|
325
|
+
...userCommands
|
|
310
326
|
],
|
|
327
|
+
discoveryPaths: [join(Arkstack.rootDir(), "node_modules", "@arkstack/*", "dist", "commands", "*.js")],
|
|
311
328
|
exceptionHandler(exception) {
|
|
312
329
|
throw exception;
|
|
313
330
|
}
|
package/dist/prepare.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as BuildInterfaces } from "./BuildInterfaces-
|
|
2
|
+
import { t as BuildInterfaces } from "./BuildInterfaces-CsZ3Uerb.js";
|
|
3
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { Arkstack } from "@arkstack/contract";
|
|
5
|
-
import { existsSync, mkdirSync } from "node:fs";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import chalk from "chalk";
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/console",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.37",
|
|
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",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"chalk": "^5.6.2",
|
|
52
52
|
"resora": "^1.3.25",
|
|
53
53
|
"ts-morph": "^28.0.0",
|
|
54
|
-
"@arkstack/common": "^0.12.
|
|
55
|
-
"@arkstack/contract": "^0.12.
|
|
54
|
+
"@arkstack/common": "^0.12.37",
|
|
55
|
+
"@arkstack/contract": "^0.12.37"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsdown",
|