@arkstack/console 0.8.0 → 0.9.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.
- package/dist/BuildInterfaces-DLR8Ozhb.js +97 -0
- package/dist/index.d.ts +44 -1
- package/dist/index.js +2 -1
- package/dist/prepare.js +7 -0
- package/package.json +4 -4
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { config } from "@arkstack/common";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { writeFileSync } from "node:fs";
|
|
4
|
+
|
|
5
|
+
//#region src/prepare/TSConfig.ts
|
|
6
|
+
const TSConfig = {
|
|
7
|
+
compilerOptions: {
|
|
8
|
+
module: "es2022",
|
|
9
|
+
target: "es2022",
|
|
10
|
+
lib: ["es2022", "DOM"],
|
|
11
|
+
moduleResolution: "bundler",
|
|
12
|
+
esModuleInterop: true,
|
|
13
|
+
forceConsistentCasingInFileNames: true,
|
|
14
|
+
strict: true,
|
|
15
|
+
skipLibCheck: true,
|
|
16
|
+
skipDefaultLibCheck: true,
|
|
17
|
+
strictFunctionTypes: true,
|
|
18
|
+
strictPropertyInitialization: true,
|
|
19
|
+
strictBindCallApply: true,
|
|
20
|
+
noImplicitAny: true,
|
|
21
|
+
removeComments: true,
|
|
22
|
+
experimentalDecorators: true,
|
|
23
|
+
emitDecoratorMetadata: true,
|
|
24
|
+
paths: {
|
|
25
|
+
"@": ["../src"],
|
|
26
|
+
"src/*": ["../src/*"],
|
|
27
|
+
"@app/*": ["../src/app/*"],
|
|
28
|
+
"@core/*": ["../src/core/*"],
|
|
29
|
+
"@controllers/*": ["../src/app/http/controllers/*"],
|
|
30
|
+
"@models/*": ["../src/app/models/*"]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
include: [
|
|
34
|
+
"./*.d.ts",
|
|
35
|
+
"../src",
|
|
36
|
+
"../tests"
|
|
37
|
+
]
|
|
38
|
+
};
|
|
39
|
+
const BaseTCConfig = { extends: "./.arkstack/tsconfig.json" };
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/prepare/BuildInterfaces.ts
|
|
43
|
+
var BuildInterfaces = class {
|
|
44
|
+
static configs() {
|
|
45
|
+
const items = config();
|
|
46
|
+
const declaration = [
|
|
47
|
+
"export {}",
|
|
48
|
+
"",
|
|
49
|
+
"declare module '@arkstack/common' {",
|
|
50
|
+
this.buildInterface("ConfigRegistry", items),
|
|
51
|
+
"}"
|
|
52
|
+
].join("\n");
|
|
53
|
+
writeFileSync(path.join(process.cwd(), ".arkstack/ark.d.ts"), declaration, "utf8");
|
|
54
|
+
}
|
|
55
|
+
static tsconfig() {
|
|
56
|
+
const configs = {
|
|
57
|
+
".arkstack/tsconfig.json": JSON.stringify(TSConfig, void 0, 2),
|
|
58
|
+
"tsconfig.json": JSON.stringify(BaseTCConfig, void 0, 2)
|
|
59
|
+
};
|
|
60
|
+
for (const [file, config] of Object.entries(configs)) writeFileSync(path.join(process.cwd(), file), config, "utf8");
|
|
61
|
+
}
|
|
62
|
+
static isDynamicMap(obj) {
|
|
63
|
+
const keys = Object.keys(obj);
|
|
64
|
+
if (keys.length === 0) return false;
|
|
65
|
+
return keys.every((key) => path.isAbsolute(key) || /[^a-zA-Z0-9_$]/.test(key) || /^\d/.test(key));
|
|
66
|
+
}
|
|
67
|
+
static inferType(value, indent) {
|
|
68
|
+
if (value === null) return "null";
|
|
69
|
+
if (typeof value === "undefined") return "any";
|
|
70
|
+
if (typeof value === "function") return "Function";
|
|
71
|
+
if (Array.isArray(value)) {
|
|
72
|
+
if (value.length === 0) return "unknown[]";
|
|
73
|
+
const itemTypes = [...new Set(value.map((v) => this.inferType(v, indent)))];
|
|
74
|
+
return itemTypes.length === 1 ? `${itemTypes[0]}[]` : `(${itemTypes.join(" | ")})[]`;
|
|
75
|
+
}
|
|
76
|
+
if (typeof value === "object") {
|
|
77
|
+
const obj = value;
|
|
78
|
+
if (this.isDynamicMap(obj)) {
|
|
79
|
+
const valueTypes = [...new Set(Object.values(obj).map((v) => this.inferType(v, indent)))];
|
|
80
|
+
return `Record<string, ${valueTypes.length === 1 ? valueTypes[0] : valueTypes.join(" | ")}>`;
|
|
81
|
+
}
|
|
82
|
+
return this.buildInterface(void 0, obj, indent);
|
|
83
|
+
}
|
|
84
|
+
return typeof value;
|
|
85
|
+
}
|
|
86
|
+
static buildInterface(name, obj, indent = 0) {
|
|
87
|
+
const pad = " ".repeat(indent);
|
|
88
|
+
const innerPad = " ".repeat(indent + 1);
|
|
89
|
+
const body = Object.entries(obj).map(([key, value]) => {
|
|
90
|
+
return `${innerPad}${key}: ${this.inferType(value, indent + 1)}`;
|
|
91
|
+
}).join("\n");
|
|
92
|
+
return name ? `${pad}interface ${name} {\n${body}\n${pad}}` : `{\n${body}\n${pad}}`;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
export { BaseTCConfig as n, TSConfig as r, BuildInterfaces as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,50 @@
|
|
|
1
|
+
//#region src/prepare/BuildInterfaces.d.ts
|
|
2
|
+
declare class BuildInterfaces {
|
|
3
|
+
static configs(): void;
|
|
4
|
+
static tsconfig(): void;
|
|
5
|
+
private static isDynamicMap;
|
|
6
|
+
private static inferType;
|
|
7
|
+
private static buildInterface;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/prepare/TSConfig.d.ts
|
|
11
|
+
declare const TSConfig: {
|
|
12
|
+
compilerOptions: {
|
|
13
|
+
module: string;
|
|
14
|
+
target: string;
|
|
15
|
+
lib: string[];
|
|
16
|
+
moduleResolution: string;
|
|
17
|
+
esModuleInterop: boolean;
|
|
18
|
+
forceConsistentCasingInFileNames: boolean;
|
|
19
|
+
strict: boolean;
|
|
20
|
+
skipLibCheck: boolean;
|
|
21
|
+
skipDefaultLibCheck: boolean;
|
|
22
|
+
strictFunctionTypes: boolean;
|
|
23
|
+
strictPropertyInitialization: boolean;
|
|
24
|
+
strictBindCallApply: boolean;
|
|
25
|
+
noImplicitAny: boolean;
|
|
26
|
+
removeComments: boolean;
|
|
27
|
+
experimentalDecorators: boolean;
|
|
28
|
+
emitDecoratorMetadata: boolean;
|
|
29
|
+
paths: {
|
|
30
|
+
'@': string[];
|
|
31
|
+
'src/*': string[];
|
|
32
|
+
'@app/*': string[];
|
|
33
|
+
'@core/*': string[];
|
|
34
|
+
'@controllers/*': string[];
|
|
35
|
+
'@models/*': string[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
include: string[];
|
|
39
|
+
};
|
|
40
|
+
declare const BaseTCConfig: {
|
|
41
|
+
extends: string;
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
1
44
|
//#region src/index.d.ts
|
|
2
45
|
interface RunConsoleOptions {
|
|
3
46
|
logo?: string;
|
|
4
47
|
}
|
|
5
48
|
declare const runConsoleKernel: (options?: RunConsoleOptions) => Promise<void>;
|
|
6
49
|
//#endregion
|
|
7
|
-
export { RunConsoleOptions, runConsoleKernel };
|
|
50
|
+
export { BaseTCConfig, BuildInterfaces, RunConsoleOptions, TSConfig, runConsoleKernel };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as ArkstackConsoleApp } from "./app-CNmh_S9c.js";
|
|
3
|
+
import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-DLR8Ozhb.js";
|
|
3
4
|
import { config, env, importFile, initializeGlobalContext, loadPrototypes, outputDir } from "@arkstack/common";
|
|
4
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
6
|
import path, { join } from "node:path";
|
|
@@ -321,4 +322,4 @@ const isEntrypointExecution = () => {
|
|
|
321
322
|
if (isEntrypointExecution()) await runConsoleKernel();
|
|
322
323
|
|
|
323
324
|
//#endregion
|
|
324
|
-
export { runConsoleKernel };
|
|
325
|
+
export { BaseTCConfig, BuildInterfaces, TSConfig, runConsoleKernel };
|
package/dist/prepare.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { t as BuildInterfaces } from "./BuildInterfaces-DLR8Ozhb.js";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
1
5
|
import { spawn } from "node:child_process";
|
|
2
6
|
import chalk from "chalk";
|
|
3
7
|
|
|
4
8
|
//#region dist/prepare.js
|
|
9
|
+
if (!existsSync(path.join(process.cwd(), ".arkstack/build"))) mkdirSync(path.join(process.cwd(), ".arkstack/build"));
|
|
5
10
|
const NODE_ENV = process.env.NODE_ENV || "development";
|
|
6
11
|
const child = spawn(process.platform === "win32" ? "pnpm.cmd" : "pnpm", [
|
|
7
12
|
"exec",
|
|
@@ -25,6 +30,8 @@ child.on("exit", (code) => {
|
|
|
25
30
|
}
|
|
26
31
|
throw new Error(`tsdown exited with code ${code}`);
|
|
27
32
|
});
|
|
33
|
+
if (!process.env.NODE_CI) BuildInterfaces.configs();
|
|
34
|
+
BuildInterfaces.tsconfig();
|
|
28
35
|
|
|
29
36
|
//#endregion
|
|
30
37
|
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/console",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
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",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"clear-router": "^2.7.
|
|
45
|
+
"clear-router": "^2.7.7",
|
|
46
46
|
"arkormx": "^ 2.4.1"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@h3ravel/support": "^0.15.11",
|
|
51
51
|
"chalk": "^5.6.2",
|
|
52
52
|
"resora": "^1.3.6",
|
|
53
|
-
"@arkstack/
|
|
54
|
-
"@arkstack/
|
|
53
|
+
"@arkstack/common": "^0.9.1",
|
|
54
|
+
"@arkstack/contract": "^0.9.1"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "tsdown",
|