@dforge-core/dforge-cli 0.1.1 → 0.1.2
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/cli.js +129 -22
- package/dist/lib.js +10 -12
- package/dist/lib.mjs +10 -12
- package/package.json +7 -7
package/dist/cli.js
CHANGED
|
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
mod
|
|
34
34
|
));
|
|
35
35
|
|
|
36
|
-
// node_modules
|
|
36
|
+
// node_modules/sisteransi/src/index.js
|
|
37
37
|
var require_src = __commonJS({
|
|
38
|
-
"node_modules
|
|
38
|
+
"node_modules/sisteransi/src/index.js"(exports2, module2) {
|
|
39
39
|
"use strict";
|
|
40
40
|
var ESC = "\x1B";
|
|
41
41
|
var CSI = `${ESC}[`;
|
|
@@ -89,9 +89,9 @@ var require_src = __commonJS({
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
// node_modules
|
|
92
|
+
// node_modules/picocolors/picocolors.js
|
|
93
93
|
var require_picocolors = __commonJS({
|
|
94
|
-
"node_modules
|
|
94
|
+
"node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
95
95
|
"use strict";
|
|
96
96
|
var p2 = process || {};
|
|
97
97
|
var argv2 = p2.argv || [];
|
|
@@ -162,7 +162,7 @@ var require_picocolors = __commonJS({
|
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
// node_modules
|
|
165
|
+
// node_modules/@clack/core/dist/index.mjs
|
|
166
166
|
function DD({ onlyFirst: e2 = false } = {}) {
|
|
167
167
|
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
168
168
|
return new RegExp(t, e2 ? void 0 : "g");
|
|
@@ -274,7 +274,7 @@ function fD({ input: e2 = import_node_process.stdin, output: u2 = import_node_pr
|
|
|
274
274
|
}
|
|
275
275
|
var import_sisteransi, import_node_process, g, import_node_readline, import_node_stream, import_picocolors, uD, W, tD, eD, FD, sD, w, N, I, R, r, iD, CD, ED, d, oD, y, V, nD, G, _, z, K, aD, k, hD, lD, xD, B, AD, S, gD, vD, h, x, dD, A, kD, $D, H, SD, OD, PD, J, LD, RD;
|
|
276
276
|
var init_dist = __esm({
|
|
277
|
-
"node_modules
|
|
277
|
+
"node_modules/@clack/core/dist/index.mjs"() {
|
|
278
278
|
"use strict";
|
|
279
279
|
import_sisteransi = __toESM(require_src(), 1);
|
|
280
280
|
import_node_process = require("process");
|
|
@@ -594,13 +594,13 @@ var init_dist = __esm({
|
|
|
594
594
|
}
|
|
595
595
|
});
|
|
596
596
|
|
|
597
|
-
// node_modules
|
|
597
|
+
// node_modules/@clack/prompts/dist/index.mjs
|
|
598
598
|
function ce() {
|
|
599
599
|
return import_node_process2.default.platform !== "win32" ? import_node_process2.default.env.TERM !== "linux" : !!import_node_process2.default.env.CI || !!import_node_process2.default.env.WT_SESSION || !!import_node_process2.default.env.TERMINUS_SUBLIME || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
600
600
|
}
|
|
601
601
|
var import_node_util, import_node_process2, import_picocolors2, import_sisteransi2, V2, u, le, L2, W2, C, ue, o, d2, k2, P2, A2, T, F, $e, _2, me, de, pe, q, D, U, K2, b2, G2, he, ye, ve, fe, xe, Ie, Se, J2, Y2, Ce;
|
|
602
602
|
var init_dist2 = __esm({
|
|
603
|
-
"node_modules
|
|
603
|
+
"node_modules/@clack/prompts/dist/index.mjs"() {
|
|
604
604
|
"use strict";
|
|
605
605
|
import_node_util = require("util");
|
|
606
606
|
init_dist();
|
|
@@ -935,18 +935,16 @@ function buildDataViews(entities) {
|
|
|
935
935
|
}
|
|
936
936
|
function buildFolders(opts) {
|
|
937
937
|
return {
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
entities
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
)
|
|
949
|
-
}
|
|
938
|
+
label: opts.displayName,
|
|
939
|
+
description: opts.description || opts.displayName,
|
|
940
|
+
icon: "bi-folder",
|
|
941
|
+
color: "#2196F3",
|
|
942
|
+
entities: Object.fromEntries(
|
|
943
|
+
opts.entities.map((e2) => [
|
|
944
|
+
e2.name,
|
|
945
|
+
{ viewName: "default", quickAdd: true }
|
|
946
|
+
])
|
|
947
|
+
)
|
|
950
948
|
};
|
|
951
949
|
}
|
|
952
950
|
function buildMenus(opts) {
|
|
@@ -1329,6 +1327,110 @@ var init_init = __esm({
|
|
|
1329
1327
|
}
|
|
1330
1328
|
});
|
|
1331
1329
|
|
|
1330
|
+
// src/pack.ts
|
|
1331
|
+
var pack_exports = {};
|
|
1332
|
+
__export(pack_exports, {
|
|
1333
|
+
runPack: () => runPack
|
|
1334
|
+
});
|
|
1335
|
+
async function runPack(argv2) {
|
|
1336
|
+
const positional = [];
|
|
1337
|
+
let outPath;
|
|
1338
|
+
for (let i = 0; i < argv2.length; i++) {
|
|
1339
|
+
const a = argv2[i];
|
|
1340
|
+
if (a === "-o" || a === "--output") {
|
|
1341
|
+
outPath = argv2[++i];
|
|
1342
|
+
} else if (a === "-h" || a === "--help") {
|
|
1343
|
+
printHelp2();
|
|
1344
|
+
return 0;
|
|
1345
|
+
} else {
|
|
1346
|
+
positional.push(a);
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
if (positional.length === 0) {
|
|
1350
|
+
console.error("Usage: dforge-cli module pack <module-dir> [-o <output>]");
|
|
1351
|
+
return 2;
|
|
1352
|
+
}
|
|
1353
|
+
const moduleDir = path3.resolve(positional[0]);
|
|
1354
|
+
const manifestPath = path3.join(moduleDir, "manifest.json");
|
|
1355
|
+
if (!fs3.existsSync(manifestPath)) {
|
|
1356
|
+
console.error(`No manifest.json at ${manifestPath}`);
|
|
1357
|
+
return 1;
|
|
1358
|
+
}
|
|
1359
|
+
let manifest;
|
|
1360
|
+
try {
|
|
1361
|
+
manifest = JSON.parse(fs3.readFileSync(manifestPath, "utf8"));
|
|
1362
|
+
} catch (e2) {
|
|
1363
|
+
console.error(`manifest.json: ${e2.message}`);
|
|
1364
|
+
return 1;
|
|
1365
|
+
}
|
|
1366
|
+
if (!manifest.code || !manifest.version) {
|
|
1367
|
+
console.error("manifest.json missing required `code` or `version`");
|
|
1368
|
+
return 1;
|
|
1369
|
+
}
|
|
1370
|
+
const defaultName = `${manifest.code}-${manifest.version}.dforge`;
|
|
1371
|
+
let finalOut;
|
|
1372
|
+
if (!outPath) {
|
|
1373
|
+
finalOut = path3.resolve(process.cwd(), defaultName);
|
|
1374
|
+
} else {
|
|
1375
|
+
const abs = path3.resolve(outPath);
|
|
1376
|
+
if (abs.endsWith(".dforge")) {
|
|
1377
|
+
finalOut = abs;
|
|
1378
|
+
} else {
|
|
1379
|
+
fs3.mkdirSync(abs, { recursive: true });
|
|
1380
|
+
finalOut = path3.join(abs, defaultName);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
fs3.mkdirSync(path3.dirname(finalOut), { recursive: true });
|
|
1384
|
+
if (fs3.existsSync(finalOut)) fs3.rmSync(finalOut);
|
|
1385
|
+
const zip = (0, import_node_child_process3.spawnSync)(
|
|
1386
|
+
"zip",
|
|
1387
|
+
["-r", "-q", finalOut, "."],
|
|
1388
|
+
{
|
|
1389
|
+
cwd: moduleDir,
|
|
1390
|
+
stdio: ["ignore", "inherit", "inherit"]
|
|
1391
|
+
}
|
|
1392
|
+
);
|
|
1393
|
+
if (zip.error) {
|
|
1394
|
+
console.error(
|
|
1395
|
+
`pack: failed to run \`zip\`: ${zip.error.message}. Install zip (brew install zip / apt install zip / git-for-windows ships it).`
|
|
1396
|
+
);
|
|
1397
|
+
return 1;
|
|
1398
|
+
}
|
|
1399
|
+
if (zip.status !== 0) {
|
|
1400
|
+
console.error(`pack: zip exited ${zip.status}`);
|
|
1401
|
+
return zip.status ?? 1;
|
|
1402
|
+
}
|
|
1403
|
+
const size = fs3.statSync(finalOut).size;
|
|
1404
|
+
const kib = (size / 1024).toFixed(1);
|
|
1405
|
+
console.log(`\u2713 ${finalOut} (${kib} KB)`);
|
|
1406
|
+
void import_promises.pipeline;
|
|
1407
|
+
void import_node_zlib.createGzip;
|
|
1408
|
+
return 0;
|
|
1409
|
+
}
|
|
1410
|
+
function printHelp2() {
|
|
1411
|
+
console.log("Usage: dforge-cli module pack <module-dir> [-o <output>]");
|
|
1412
|
+
console.log("");
|
|
1413
|
+
console.log(
|
|
1414
|
+
"Packages a module directory into a .dforge archive (zip with .dforge extension)."
|
|
1415
|
+
);
|
|
1416
|
+
console.log("");
|
|
1417
|
+
console.log("Examples:");
|
|
1418
|
+
console.log(" dforge-cli module pack ./my-module # \u2192 ./<code>-<version>.dforge");
|
|
1419
|
+
console.log(" dforge-cli module pack ./my-module -o ./dist/ # \u2192 ./dist/<code>-<version>.dforge");
|
|
1420
|
+
console.log(" dforge-cli module pack ./my-module -o pkg.dforge # \u2192 ./pkg.dforge");
|
|
1421
|
+
}
|
|
1422
|
+
var fs3, path3, import_node_zlib, import_promises, import_node_child_process3;
|
|
1423
|
+
var init_pack = __esm({
|
|
1424
|
+
"src/pack.ts"() {
|
|
1425
|
+
"use strict";
|
|
1426
|
+
fs3 = __toESM(require("fs"));
|
|
1427
|
+
path3 = __toESM(require("path"));
|
|
1428
|
+
import_node_zlib = require("zlib");
|
|
1429
|
+
import_promises = require("stream/promises");
|
|
1430
|
+
import_node_child_process3 = require("child_process");
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
|
|
1332
1434
|
// src/native.ts
|
|
1333
1435
|
var import_node_child_process = require("child_process");
|
|
1334
1436
|
var path = __toESM(require("path"));
|
|
@@ -1411,14 +1513,19 @@ function spawnNative(argv2) {
|
|
|
1411
1513
|
|
|
1412
1514
|
// src/cli.ts
|
|
1413
1515
|
var argv = process.argv.slice(2);
|
|
1414
|
-
|
|
1415
|
-
|
|
1516
|
+
function jsCommand(loader, rest) {
|
|
1517
|
+
loader().then((run) => run(rest)).then(
|
|
1416
1518
|
(code) => process.exit(code ?? 0),
|
|
1417
1519
|
(err) => {
|
|
1418
1520
|
console.error(err.message ?? err);
|
|
1419
1521
|
process.exit(1);
|
|
1420
1522
|
}
|
|
1421
1523
|
);
|
|
1524
|
+
}
|
|
1525
|
+
if (argv[0] === "init") {
|
|
1526
|
+
jsCommand(() => Promise.resolve().then(() => (init_init(), init_exports)).then((m2) => m2.runInit), argv.slice(1));
|
|
1527
|
+
} else if (argv[0] === "module" && argv[1] === "pack") {
|
|
1528
|
+
jsCommand(() => Promise.resolve().then(() => (init_pack(), pack_exports)).then((m2) => m2.runPack), argv.slice(2));
|
|
1422
1529
|
} else {
|
|
1423
1530
|
spawnNative(argv);
|
|
1424
1531
|
}
|
package/dist/lib.js
CHANGED
|
@@ -90,18 +90,16 @@ function buildDataViews(entities) {
|
|
|
90
90
|
}
|
|
91
91
|
function buildFolders(opts) {
|
|
92
92
|
return {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
entities
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
)
|
|
104
|
-
}
|
|
93
|
+
label: opts.displayName,
|
|
94
|
+
description: opts.description || opts.displayName,
|
|
95
|
+
icon: "bi-folder",
|
|
96
|
+
color: "#2196F3",
|
|
97
|
+
entities: Object.fromEntries(
|
|
98
|
+
opts.entities.map((e) => [
|
|
99
|
+
e.name,
|
|
100
|
+
{ viewName: "default", quickAdd: true }
|
|
101
|
+
])
|
|
102
|
+
)
|
|
105
103
|
};
|
|
106
104
|
}
|
|
107
105
|
function buildMenus(opts) {
|
package/dist/lib.mjs
CHANGED
|
@@ -52,18 +52,16 @@ function buildDataViews(entities) {
|
|
|
52
52
|
}
|
|
53
53
|
function buildFolders(opts) {
|
|
54
54
|
return {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
entities
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
66
|
-
}
|
|
55
|
+
label: opts.displayName,
|
|
56
|
+
description: opts.description || opts.displayName,
|
|
57
|
+
icon: "bi-folder",
|
|
58
|
+
color: "#2196F3",
|
|
59
|
+
entities: Object.fromEntries(
|
|
60
|
+
opts.entities.map((e) => [
|
|
61
|
+
e.name,
|
|
62
|
+
{ viewName: "default", quickAdd: true }
|
|
63
|
+
])
|
|
64
|
+
)
|
|
67
65
|
};
|
|
68
66
|
}
|
|
69
67
|
function buildMenus(opts) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dforge-core/dforge-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "dForge CLI - validate, pack, publish, and install dForge modules. Distributes a single-file native binary per platform via optionalDependencies (esbuild-style).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/iash44/dForge-core",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"typescript": "^6.0.3"
|
|
42
42
|
},
|
|
43
43
|
"optionalDependencies": {
|
|
44
|
-
"@dforge-core/dforge-cli-darwin-arm64": "0.1.1",
|
|
45
|
-
"@dforge-core/dforge-cli-darwin-x64": "0.1.1",
|
|
46
|
-
"@dforge-core/dforge-cli-linux-arm64": "0.1.1",
|
|
47
|
-
"@dforge-core/dforge-cli-linux-x64": "0.1.1",
|
|
48
|
-
"@dforge-core/dforge-cli-win32-arm64": "0.1.1",
|
|
49
|
-
"@dforge-core/dforge-cli-win32-x64": "0.1.1"
|
|
44
|
+
"@dforge-core/dforge-cli-darwin-arm64": "0.1.0-rc.1",
|
|
45
|
+
"@dforge-core/dforge-cli-darwin-x64": "0.1.0-rc.1",
|
|
46
|
+
"@dforge-core/dforge-cli-linux-arm64": "0.1.0-rc.1",
|
|
47
|
+
"@dforge-core/dforge-cli-linux-x64": "0.1.0-rc.1",
|
|
48
|
+
"@dforge-core/dforge-cli-win32-arm64": "0.1.0-rc.1",
|
|
49
|
+
"@dforge-core/dforge-cli-win32-x64": "0.1.0-rc.1"
|
|
50
50
|
}
|
|
51
51
|
}
|