@arkstack/console 0.17.6 → 0.17.8
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/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as ArkstackConsoleApp } from "./app-Ek2hTWvh.js";
|
|
3
3
|
import { n as loadPackageSetups, t as groupPublishables } from "./helpers-CjopNM66.js";
|
|
4
|
-
import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-
|
|
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";
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
|
package/dist/prepare.js
CHANGED
|
@@ -1,11 +1,77 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as BuildInterfaces } from "./BuildInterfaces-
|
|
3
|
-
import { existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { t as BuildInterfaces } from "./BuildInterfaces-BeMseJhx.js";
|
|
3
|
+
import { existsSync, mkdirSync, readdirSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { Arkstack } from "@arkstack/contract";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import chalk from "chalk";
|
|
8
8
|
|
|
9
|
+
//#region dist/prepare/ArkormArtifacts.js
|
|
10
|
+
const runtimeImport = async (specifier) => {
|
|
11
|
+
return await new Function("specifier", "return import(specifier)")(specifier);
|
|
12
|
+
};
|
|
13
|
+
const isMigrationClass = (value) => {
|
|
14
|
+
if (typeof value !== "function") return false;
|
|
15
|
+
const prototype = value.prototype;
|
|
16
|
+
return typeof prototype?.up === "function" && typeof prototype?.down === "function";
|
|
17
|
+
};
|
|
18
|
+
const loadArkorm = async () => {
|
|
19
|
+
try {
|
|
20
|
+
return await runtimeImport("arkormx");
|
|
21
|
+
} catch {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const bootArkormDefaults = async () => {
|
|
26
|
+
try {
|
|
27
|
+
(await runtimeImport("@arkstack/database")).bootArkorm();
|
|
28
|
+
} catch {}
|
|
29
|
+
};
|
|
30
|
+
var ArkormArtifacts = class ArkormArtifacts {
|
|
31
|
+
static async sync() {
|
|
32
|
+
const arkorm = await loadArkorm();
|
|
33
|
+
if (!arkorm) return;
|
|
34
|
+
await bootArkormDefaults();
|
|
35
|
+
try {
|
|
36
|
+
await arkorm.loadArkormConfig();
|
|
37
|
+
} catch {}
|
|
38
|
+
const app = new arkorm.CliApp();
|
|
39
|
+
ArkormArtifacts.syncModelRegistry(arkorm, app);
|
|
40
|
+
await ArkormArtifacts.syncColumnMappings(arkorm, app);
|
|
41
|
+
}
|
|
42
|
+
static syncModelRegistry(_arkorm, app) {
|
|
43
|
+
try {
|
|
44
|
+
app.syncModelRegistry();
|
|
45
|
+
} catch (error) {
|
|
46
|
+
ArkormArtifacts.warn("model registry", error);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
static async syncColumnMappings(arkorm, app) {
|
|
50
|
+
try {
|
|
51
|
+
const migrations = await ArkormArtifacts.loadMigrations(arkorm, app);
|
|
52
|
+
const statePath = arkorm.resolveMigrationStateFilePath(Arkstack.rootDir());
|
|
53
|
+
const adapter = app.getConfig("adapter");
|
|
54
|
+
const state = await arkorm.readAppliedMigrationsStateFromStore(adapter, statePath);
|
|
55
|
+
const features = arkorm.resolvePersistedMetadataFeatures(app.getConfig("features"));
|
|
56
|
+
await arkorm.syncPersistedColumnMappingsFromState(Arkstack.rootDir(), state, migrations, features);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
ArkormArtifacts.warn("column mappings", error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
static async loadMigrations(arkorm, app) {
|
|
62
|
+
const files = [app.getConfig("paths")?.migrations ?? path.join(Arkstack.rootDir(), "dist/database/migrations"), ...arkorm.getRegisteredPaths("migrations")].map((directory) => app.resolveRuntimeDirectoryPath(directory)).filter((directory, index, all) => existsSync(directory) && all.indexOf(directory) === index).flatMap((directory) => readdirSync(directory).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => app.resolveRuntimeScriptPath(path.join(directory, file))));
|
|
63
|
+
return [...(await Promise.all(files.map(async (file) => {
|
|
64
|
+
const module = await arkorm.RuntimeModuleLoader.load(file);
|
|
65
|
+
return Object.values(module).filter(isMigrationClass).map((migration) => [migration, file]);
|
|
66
|
+
}))).flat(), ...arkorm.getRegisteredMigrations().map((migration) => [migration, `registered:${migration.name}`])];
|
|
67
|
+
}
|
|
68
|
+
static warn(artifact, error) {
|
|
69
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
70
|
+
console.warn(`[arkstack:prepare] Unable to sync ArkORM ${artifact}: ${message}`);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
9
75
|
//#region dist/prepare.js
|
|
10
76
|
if (!existsSync(path.join(Arkstack.rootDir(), ".arkstack/build"))) mkdirSync(path.join(Arkstack.rootDir(), ".arkstack/build"), { recursive: true });
|
|
11
77
|
if (!process.env.NODE_CI) {
|
|
@@ -13,6 +79,7 @@ if (!process.env.NODE_CI) {
|
|
|
13
79
|
BuildInterfaces.env();
|
|
14
80
|
}
|
|
15
81
|
BuildInterfaces.tsconfig();
|
|
82
|
+
await ArkormArtifacts.sync();
|
|
16
83
|
const LOG_LEVEL = parseInt(process.env.VERBOSITY ?? "0") > 0 ? [] : ["--log-level=silent"];
|
|
17
84
|
const NODE_ENV = process.env.NODE_ENV || "development";
|
|
18
85
|
const child = spawn(process.platform === "win32" ? "pnpm.cmd" : "pnpm", [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/console",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.8",
|
|
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",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"arkormx": "^2.12.0",
|
|
44
|
-
"clear-router": "^2.9.2"
|
|
44
|
+
"clear-router": "^2.9.2",
|
|
45
|
+
"@arkstack/database": "^0.17.8"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
48
|
"@h3ravel/musket": "^2.2.2",
|
|
@@ -49,10 +50,13 @@
|
|
|
49
50
|
"chalk": "^5.6.2",
|
|
50
51
|
"resora": "^1.3.32",
|
|
51
52
|
"ts-morph": "^28.0.0",
|
|
52
|
-
"@arkstack/common": "^0.17.
|
|
53
|
-
"@arkstack/contract": "^0.17.
|
|
53
|
+
"@arkstack/common": "^0.17.8",
|
|
54
|
+
"@arkstack/contract": "^0.17.8"
|
|
54
55
|
},
|
|
55
56
|
"peerDependenciesMeta": {
|
|
57
|
+
"@arkstack/database": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
56
60
|
"arkormx": {
|
|
57
61
|
"optional": true
|
|
58
62
|
}
|