@orion-js/core 4.0.7 → 4.0.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.cjs +89 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +101 -122
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
|
|
25
25
|
// src/index.ts
|
|
26
|
-
var
|
|
26
|
+
var import_chalk16 = __toESM(require("chalk"), 1);
|
|
27
27
|
var import_commander = require("commander");
|
|
28
28
|
|
|
29
29
|
// src/helpers/execute.ts
|
|
@@ -56,7 +56,7 @@ async function create_default({ name, kit }) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// src/dev/runner/index.ts
|
|
59
|
-
var
|
|
59
|
+
var import_chalk2 = __toESM(require("chalk"), 1);
|
|
60
60
|
|
|
61
61
|
// src/helpers/writeFile.ts
|
|
62
62
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
@@ -73,34 +73,30 @@ var ensureDirectory = (filePath) => {
|
|
|
73
73
|
var ensureDirectory_default = ensureDirectory;
|
|
74
74
|
|
|
75
75
|
// src/helpers/writeFile.ts
|
|
76
|
-
async function writeFile_default(
|
|
77
|
-
ensureDirectory_default(
|
|
78
|
-
import_node_fs2.default.writeFileSync(
|
|
76
|
+
async function writeFile_default(path6, content) {
|
|
77
|
+
ensureDirectory_default(path6);
|
|
78
|
+
import_node_fs2.default.writeFileSync(path6, content);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// src/dev/runner/startProcess.ts
|
|
82
82
|
var import_node_child_process2 = require("child_process");
|
|
83
83
|
|
|
84
84
|
// src/dev/runner/getArgs.ts
|
|
85
|
-
function getArgs(
|
|
86
|
-
|
|
85
|
+
function getArgs(_options, command) {
|
|
86
|
+
const startCommand = "tsx";
|
|
87
87
|
const args = [];
|
|
88
|
-
|
|
89
|
-
const [first, ...otherArgs] = process.env.START_COMMAND.split(" ");
|
|
90
|
-
startCommand = first;
|
|
91
|
-
args.push(...otherArgs);
|
|
92
|
-
console.log(`Using custom command: ${[startCommand, ...args].join(" ")}`);
|
|
93
|
-
} else if (options.shell) {
|
|
94
|
-
args.push("--inspect");
|
|
95
|
-
}
|
|
88
|
+
args.push("watch", "--clear-screen=false");
|
|
96
89
|
args.push(...command.args);
|
|
97
90
|
args.push("./app/index.ts");
|
|
98
91
|
return { startCommand, args };
|
|
99
92
|
}
|
|
100
93
|
|
|
101
94
|
// src/dev/runner/startProcess.ts
|
|
95
|
+
var import_chalk = __toESM(require("chalk"), 1);
|
|
102
96
|
function startProcess(options, command) {
|
|
103
97
|
const { startCommand, args } = getArgs(options, command);
|
|
98
|
+
console.log(import_chalk.default.bold(`=> Starting app with command: ${startCommand} ${args.join(" ")}...
|
|
99
|
+
`));
|
|
104
100
|
return (0, import_node_child_process2.spawn)(startCommand, args, {
|
|
105
101
|
env: {
|
|
106
102
|
ORION_DEV: "local",
|
|
@@ -116,15 +112,14 @@ function startProcess(options, command) {
|
|
|
116
112
|
function getRunner(options, command) {
|
|
117
113
|
let appProcess = null;
|
|
118
114
|
if (options.clean) {
|
|
119
|
-
console.log(
|
|
115
|
+
console.log(import_chalk2.default.bold("=> Cleaning directory...\n"));
|
|
120
116
|
}
|
|
121
|
-
const
|
|
122
|
-
console.log(import_chalk.default.bold("=> Starting app...\n"));
|
|
117
|
+
const startApp = () => {
|
|
123
118
|
appProcess = startProcess(options, command);
|
|
124
119
|
appProcess.on("exit", (code, signal) => {
|
|
125
120
|
if (!code || code === 143 || code === 0 || signal === "SIGTERM" || signal === "SIGINT") {
|
|
126
121
|
} else {
|
|
127
|
-
console.log(
|
|
122
|
+
console.log(import_chalk2.default.bold(`=> Error running app. Exit code: ${code}`));
|
|
128
123
|
}
|
|
129
124
|
});
|
|
130
125
|
writeFile_default(".orion/process", `${appProcess.pid}`);
|
|
@@ -132,15 +127,24 @@ function getRunner(options, command) {
|
|
|
132
127
|
const stop = () => {
|
|
133
128
|
if (appProcess) {
|
|
134
129
|
appProcess.kill();
|
|
130
|
+
appProcess = null;
|
|
135
131
|
}
|
|
136
132
|
};
|
|
137
133
|
const restart = () => {
|
|
134
|
+
console.log(import_chalk2.default.bold("=> Restarting app...\n"));
|
|
138
135
|
stop();
|
|
139
|
-
|
|
136
|
+
startApp();
|
|
137
|
+
};
|
|
138
|
+
const start = () => {
|
|
139
|
+
if (appProcess) {
|
|
140
|
+
} else {
|
|
141
|
+
startApp();
|
|
142
|
+
}
|
|
140
143
|
};
|
|
141
144
|
return {
|
|
142
145
|
restart,
|
|
143
|
-
stop
|
|
146
|
+
stop,
|
|
147
|
+
start
|
|
144
148
|
};
|
|
145
149
|
}
|
|
146
150
|
|
|
@@ -233,21 +237,21 @@ function reportDiagnostic(diagnostic) {
|
|
|
233
237
|
}
|
|
234
238
|
|
|
235
239
|
// src/dev/watchAndCompile/getHost.ts
|
|
236
|
-
var
|
|
240
|
+
var import_chalk3 = __toESM(require("chalk"), 1);
|
|
237
241
|
function getHost(runner) {
|
|
238
242
|
const reportWatchStatusChanged = (diagnostic) => {
|
|
239
243
|
if (diagnostic.category !== 3) return;
|
|
240
244
|
if (diagnostic.code === 6032 || diagnostic.code === 6031) {
|
|
241
245
|
runner.stop();
|
|
242
246
|
}
|
|
243
|
-
console.log(
|
|
247
|
+
console.log(import_chalk3.default.bold(`=> ${diagnostic.messageText}`));
|
|
244
248
|
if (diagnostic.code === 6194) {
|
|
245
249
|
if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {
|
|
246
250
|
if (!diagnostic.messageText.toString().includes("Found 0 errors.")) {
|
|
247
251
|
return;
|
|
248
252
|
}
|
|
249
253
|
}
|
|
250
|
-
runner.
|
|
254
|
+
runner.start();
|
|
251
255
|
}
|
|
252
256
|
};
|
|
253
257
|
const configPath = getConfigPath();
|
|
@@ -263,41 +267,17 @@ function getHost(runner) {
|
|
|
263
267
|
return host;
|
|
264
268
|
}
|
|
265
269
|
|
|
266
|
-
// src/dev/watchAndCompile/watchDeletes.ts
|
|
267
|
-
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
268
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
|
269
|
-
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
270
|
-
async function watchDeletes() {
|
|
271
|
-
const projectPath = import_node_path3.default.resolve("./app");
|
|
272
|
-
const watcher = import_chokidar.default.watch(projectPath, {
|
|
273
|
-
ignoreInitial: true
|
|
274
|
-
});
|
|
275
|
-
watcher.on("unlink", async (filepath) => {
|
|
276
|
-
if (!filepath.endsWith(".ts")) return;
|
|
277
|
-
const relative = import_node_path3.default.relative(process.cwd(), filepath);
|
|
278
|
-
const atBuildPath = import_node_path3.default.resolve(".orion/build", relative.replace(/.ts$/, ""));
|
|
279
|
-
try {
|
|
280
|
-
import_node_fs5.default.unlinkSync(`${atBuildPath}.js`);
|
|
281
|
-
import_node_fs5.default.unlinkSync(`${atBuildPath}.d.ts`);
|
|
282
|
-
} catch (error) {
|
|
283
|
-
console.log(
|
|
284
|
-
`Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
|
|
290
270
|
// src/dev/watchAndCompile/writeEnvFile.ts
|
|
291
271
|
var import_env = require("@orion-js/env");
|
|
292
|
-
var
|
|
293
|
-
var
|
|
272
|
+
var import_chalk4 = __toESM(require("chalk"), 1);
|
|
273
|
+
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
294
274
|
var envFilePath = process.env.ORION_ENV_FILE_PATH;
|
|
295
275
|
var dtsFilePath = "./app/env.d.ts";
|
|
296
276
|
var watchEnvFile = async (runner) => {
|
|
297
277
|
if (!envFilePath) return;
|
|
298
278
|
(0, import_env.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
|
|
299
|
-
|
|
300
|
-
console.log(
|
|
279
|
+
import_chokidar.default.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
|
|
280
|
+
console.log(import_chalk4.default.bold("=> Environment file changed. Restarting..."));
|
|
301
281
|
(0, import_env.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
|
|
302
282
|
runner.restart();
|
|
303
283
|
});
|
|
@@ -308,15 +288,14 @@ async function watchAndCompile(runner) {
|
|
|
308
288
|
await cleanDirectory();
|
|
309
289
|
const host = getHost(runner);
|
|
310
290
|
import_typescript4.default.createWatchProgram(host);
|
|
311
|
-
watchDeletes();
|
|
312
291
|
watchEnvFile(runner);
|
|
313
292
|
}
|
|
314
293
|
|
|
315
294
|
// src/dev/copyCursorRule/index.ts
|
|
316
295
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
317
296
|
var import_node_https = __toESM(require("https"), 1);
|
|
318
|
-
var
|
|
319
|
-
var
|
|
297
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
298
|
+
var import_chalk5 = __toESM(require("chalk"), 1);
|
|
320
299
|
var rules = [
|
|
321
300
|
"orionjs.mdx",
|
|
322
301
|
"orionjs-component.mdx",
|
|
@@ -349,28 +328,28 @@ var downloadFile = (url) => {
|
|
|
349
328
|
async function copyCursorRule() {
|
|
350
329
|
const baseUrl = "https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc";
|
|
351
330
|
try {
|
|
352
|
-
const targetDir =
|
|
331
|
+
const targetDir = import_node_path3.default.join(process.cwd(), ".cursor", "rules");
|
|
353
332
|
await import_promises.default.mkdir(targetDir, { recursive: true });
|
|
354
333
|
await Promise.all(
|
|
355
334
|
rules.map(async (rule) => {
|
|
356
335
|
const targetFileName = rule.replace(".mdx", ".mdc");
|
|
357
|
-
const targetFile =
|
|
336
|
+
const targetFile = import_node_path3.default.join(targetDir, targetFileName);
|
|
358
337
|
const sourceUrl = `${baseUrl}/${rule}`;
|
|
359
338
|
const content = await downloadFile(sourceUrl);
|
|
360
339
|
await import_promises.default.writeFile(targetFile, content, "utf8");
|
|
361
|
-
console.log(
|
|
340
|
+
console.log(import_chalk5.default.bold(`=> \u2728 Successfully downloaded ${import_chalk5.default.cyan(targetFileName)}`));
|
|
362
341
|
})
|
|
363
342
|
);
|
|
364
|
-
console.log(
|
|
343
|
+
console.log(import_chalk5.default.bold("=> \u2728 All rule files have been successfully copied"));
|
|
365
344
|
} catch (error) {
|
|
366
|
-
console.error(
|
|
345
|
+
console.error(import_chalk5.default.red(`Error copying rule files: ${error.message}`));
|
|
367
346
|
}
|
|
368
347
|
}
|
|
369
348
|
|
|
370
349
|
// src/dev/copyMCP/index.ts
|
|
371
350
|
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
372
|
-
var
|
|
373
|
-
var
|
|
351
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
352
|
+
var import_chalk7 = __toESM(require("chalk"), 1);
|
|
374
353
|
|
|
375
354
|
// src/dev/copyMCP/consts.ts
|
|
376
355
|
var MCP_VERSION = "v4";
|
|
@@ -378,8 +357,8 @@ var VERSION_FILE = "version.txt";
|
|
|
378
357
|
|
|
379
358
|
// src/dev/copyMCP/isValidMCPRepo.ts
|
|
380
359
|
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
381
|
-
var
|
|
382
|
-
var
|
|
360
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
361
|
+
var import_chalk6 = __toESM(require("chalk"), 1);
|
|
383
362
|
async function isValidMCPRepository(directoryPath) {
|
|
384
363
|
try {
|
|
385
364
|
const stats = await import_promises2.default.stat(directoryPath);
|
|
@@ -387,17 +366,17 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
387
366
|
const expectedFiles = ["settings.js", "package.json"];
|
|
388
367
|
for (const file of expectedFiles) {
|
|
389
368
|
try {
|
|
390
|
-
await import_promises2.default.access(
|
|
369
|
+
await import_promises2.default.access(import_node_path4.default.join(directoryPath, file));
|
|
391
370
|
} catch {
|
|
392
371
|
return false;
|
|
393
372
|
}
|
|
394
373
|
}
|
|
395
374
|
try {
|
|
396
|
-
const versionPath =
|
|
375
|
+
const versionPath = import_node_path4.default.join(directoryPath, VERSION_FILE);
|
|
397
376
|
const versionContent = await import_promises2.default.readFile(versionPath, "utf-8");
|
|
398
377
|
if (versionContent.trim() !== MCP_VERSION) {
|
|
399
378
|
console.log(
|
|
400
|
-
|
|
379
|
+
import_chalk6.default.yellow(
|
|
401
380
|
`=> \u2728 MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`
|
|
402
381
|
)
|
|
403
382
|
);
|
|
@@ -415,11 +394,11 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
415
394
|
// src/dev/copyMCP/index.ts
|
|
416
395
|
async function copyMCP() {
|
|
417
396
|
const repoUrl = "https://github.com/orionjs/mcp-docs";
|
|
418
|
-
const targetDir =
|
|
397
|
+
const targetDir = import_node_path5.default.join(process.cwd(), ".orion", "mcp");
|
|
419
398
|
try {
|
|
420
|
-
await import_promises3.default.mkdir(
|
|
399
|
+
await import_promises3.default.mkdir(import_node_path5.default.join(process.cwd(), ".orion"), { recursive: true });
|
|
421
400
|
if (await isValidMCPRepository(targetDir)) {
|
|
422
|
-
console.log(
|
|
401
|
+
console.log(import_chalk7.default.bold("=> \u2728 MCP documentation already installed"));
|
|
423
402
|
return;
|
|
424
403
|
}
|
|
425
404
|
try {
|
|
@@ -427,34 +406,34 @@ async function copyMCP() {
|
|
|
427
406
|
if (stats.isDirectory()) {
|
|
428
407
|
await import_promises3.default.rm(targetDir, { recursive: true, force: true });
|
|
429
408
|
console.log(
|
|
430
|
-
|
|
409
|
+
import_chalk7.default.bold(
|
|
431
410
|
"=> \u2728 Removed existing .orion/mcp directory (invalid, incomplete, or outdated)"
|
|
432
411
|
)
|
|
433
412
|
);
|
|
434
413
|
}
|
|
435
414
|
} catch (_) {
|
|
436
415
|
}
|
|
437
|
-
console.log(
|
|
416
|
+
console.log(import_chalk7.default.bold(`=> \u2728 Downloading MCP documentation ${MCP_VERSION}...`));
|
|
438
417
|
await execute_default(`git clone ${repoUrl} ${targetDir}`);
|
|
439
|
-
await execute_default(`rm -rf ${
|
|
440
|
-
await import_promises3.default.writeFile(
|
|
418
|
+
await execute_default(`rm -rf ${import_node_path5.default.join(targetDir, ".git")}`);
|
|
419
|
+
await import_promises3.default.writeFile(import_node_path5.default.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
|
|
441
420
|
console.log(
|
|
442
|
-
|
|
421
|
+
import_chalk7.default.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
|
|
443
422
|
);
|
|
444
|
-
console.log(
|
|
423
|
+
console.log(import_chalk7.default.bold("=> \u2728 Installing MCP dependencies..."));
|
|
445
424
|
await execute_default(`cd ${targetDir} && npm install`);
|
|
446
|
-
console.log(
|
|
447
|
-
const relativePath =
|
|
425
|
+
console.log(import_chalk7.default.bold("=> \u2728 Successfully installed MCP dependencies"));
|
|
426
|
+
const relativePath = import_node_path5.default.relative(process.cwd(), targetDir);
|
|
448
427
|
console.log(relativePath);
|
|
449
428
|
const mcpServerConfig = {
|
|
450
429
|
mcpServers: {
|
|
451
430
|
"Orionjs documentation search": {
|
|
452
431
|
command: "node",
|
|
453
|
-
args: [`./${
|
|
432
|
+
args: [`./${import_node_path5.default.join(relativePath, "src", "index.js")}`]
|
|
454
433
|
}
|
|
455
434
|
}
|
|
456
435
|
};
|
|
457
|
-
const configPath =
|
|
436
|
+
const configPath = import_node_path5.default.join(process.cwd(), ".cursor", "mcp.json");
|
|
458
437
|
try {
|
|
459
438
|
const existingConfig = await import_promises3.default.readFile(configPath, "utf-8");
|
|
460
439
|
const parsedConfig = JSON.parse(existingConfig);
|
|
@@ -463,23 +442,23 @@ async function copyMCP() {
|
|
|
463
442
|
...mcpServerConfig.mcpServers
|
|
464
443
|
};
|
|
465
444
|
await import_promises3.default.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), "utf-8");
|
|
466
|
-
console.log(
|
|
445
|
+
console.log(import_chalk7.default.bold("=> \u2728 Updated MCP server configuration in .cursor/mcp.json"));
|
|
467
446
|
} catch (_) {
|
|
468
|
-
await import_promises3.default.mkdir(
|
|
447
|
+
await import_promises3.default.mkdir(import_node_path5.default.dirname(configPath), { recursive: true });
|
|
469
448
|
await import_promises3.default.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), "utf-8");
|
|
470
|
-
console.log(
|
|
449
|
+
console.log(import_chalk7.default.bold("=> \u2728 Created new MCP server configuration in .cursor/mcp.json"));
|
|
471
450
|
}
|
|
472
451
|
} catch (error) {
|
|
473
|
-
console.error(
|
|
452
|
+
console.error(import_chalk7.default.red("=> \u2728 Error copying MCP documentation:"), error);
|
|
474
453
|
throw error;
|
|
475
454
|
}
|
|
476
455
|
}
|
|
477
456
|
|
|
478
457
|
// src/dev/index.ts
|
|
479
|
-
var
|
|
458
|
+
var import_chalk8 = __toESM(require("chalk"), 1);
|
|
480
459
|
async function dev_default(options, command) {
|
|
481
|
-
console.log(
|
|
482
|
-
Orionjs App ${
|
|
460
|
+
console.log(import_chalk8.default.bold(`
|
|
461
|
+
Orionjs App ${import_chalk8.default.green(import_chalk8.default.bold("V4"))} Dev mode
|
|
483
462
|
`));
|
|
484
463
|
if (!options.omitCursorRule) {
|
|
485
464
|
await copyCursorRule().catch(console.error);
|
|
@@ -488,14 +467,14 @@ Orionjs App ${import_chalk7.default.green(import_chalk7.default.bold("V4"))} Dev
|
|
|
488
467
|
await copyMCP().catch(console.error);
|
|
489
468
|
}
|
|
490
469
|
if (!options.omitMcpServer && !options.omitCursorRule) {
|
|
491
|
-
console.log(
|
|
470
|
+
console.log(import_chalk8.default.bold("=> \u2728 Orionjs AI is ready\n"));
|
|
492
471
|
}
|
|
493
472
|
const runner = getRunner(options, command);
|
|
494
473
|
watchAndCompile(runner);
|
|
495
474
|
}
|
|
496
475
|
|
|
497
476
|
// src/prod/index.ts
|
|
498
|
-
var
|
|
477
|
+
var import_chalk12 = __toESM(require("chalk"), 1);
|
|
499
478
|
|
|
500
479
|
// src/prod/runProd.ts
|
|
501
480
|
var import_node_child_process3 = require("child_process");
|
|
@@ -516,10 +495,10 @@ function runProd(options, command) {
|
|
|
516
495
|
}
|
|
517
496
|
|
|
518
497
|
// src/build/index.ts
|
|
519
|
-
var
|
|
498
|
+
var import_chalk11 = __toESM(require("chalk"), 1);
|
|
520
499
|
|
|
521
500
|
// src/build/build.ts
|
|
522
|
-
var
|
|
501
|
+
var import_chalk9 = __toESM(require("chalk"), 1);
|
|
523
502
|
var esbuild = __toESM(require("esbuild"), 1);
|
|
524
503
|
async function build2(options) {
|
|
525
504
|
const { output } = options;
|
|
@@ -537,11 +516,11 @@ async function build2(options) {
|
|
|
537
516
|
minify: true,
|
|
538
517
|
packages: "external"
|
|
539
518
|
});
|
|
540
|
-
console.log(
|
|
519
|
+
console.log(import_chalk9.default.green.bold("Build successful"));
|
|
541
520
|
}
|
|
542
521
|
|
|
543
522
|
// src/build/checkTs.ts
|
|
544
|
-
var
|
|
523
|
+
var import_chalk10 = __toESM(require("chalk"), 1);
|
|
545
524
|
var import_node_child_process4 = require("child_process");
|
|
546
525
|
var import_node_util = require("util");
|
|
547
526
|
var execPromise = (0, import_node_util.promisify)(import_node_child_process4.exec);
|
|
@@ -556,9 +535,9 @@ async function checkTs() {
|
|
|
556
535
|
gid: process.getgid(),
|
|
557
536
|
uid: process.getuid()
|
|
558
537
|
});
|
|
559
|
-
console.log(
|
|
538
|
+
console.log(import_chalk10.default.green.bold("TypeScript check passed"));
|
|
560
539
|
} catch (error) {
|
|
561
|
-
console.log(
|
|
540
|
+
console.log(import_chalk10.default.red.bold("TypeScript compilation failed"));
|
|
562
541
|
console.log(error.stderr || error.stdout || error.message);
|
|
563
542
|
process.exit(1);
|
|
564
543
|
}
|
|
@@ -566,19 +545,19 @@ async function checkTs() {
|
|
|
566
545
|
|
|
567
546
|
// src/build/index.ts
|
|
568
547
|
async function build_default(options) {
|
|
569
|
-
console.log(
|
|
548
|
+
console.log(import_chalk11.default.bold(`Building Orionjs App ${import_chalk11.default.green(import_chalk11.default.bold("V4"))}...`));
|
|
570
549
|
if (!options.output) {
|
|
571
550
|
options.output = "./build";
|
|
572
551
|
}
|
|
573
552
|
await cleanDirectory(options.output);
|
|
574
553
|
await Promise.all([checkTs(), build2(options)]);
|
|
575
|
-
console.log(
|
|
554
|
+
console.log(import_chalk11.default.bold("Build completed"));
|
|
576
555
|
}
|
|
577
556
|
|
|
578
557
|
// src/prod/index.ts
|
|
579
558
|
async function prod_default(options, command) {
|
|
580
|
-
console.log(
|
|
581
|
-
Orionjs App ${
|
|
559
|
+
console.log(import_chalk12.default.bold(`
|
|
560
|
+
Orionjs App ${import_chalk12.default.green(import_chalk12.default.bold("V4"))} Prod mode
|
|
582
561
|
`));
|
|
583
562
|
if (!options.path) {
|
|
584
563
|
await build_default({ output: "./build" });
|
|
@@ -588,16 +567,16 @@ Orionjs App ${import_chalk11.default.green(import_chalk11.default.bold("V4"))} P
|
|
|
588
567
|
}
|
|
589
568
|
|
|
590
569
|
// src/handleErrors.ts
|
|
591
|
-
var
|
|
570
|
+
var import_chalk13 = __toESM(require("chalk"), 1);
|
|
592
571
|
process.on("unhandledRejection", (error) => {
|
|
593
572
|
if (error.codeFrame) {
|
|
594
|
-
console.error(
|
|
573
|
+
console.error(import_chalk13.default.red(error.message));
|
|
595
574
|
console.log(error.codeFrame);
|
|
596
575
|
} else {
|
|
597
|
-
console.error(
|
|
576
|
+
console.error(import_chalk13.default.red(error.message), import_chalk13.default.red("Unhandled promise rejection"));
|
|
598
577
|
}
|
|
599
578
|
}).on("uncaughtException", (error) => {
|
|
600
|
-
console.error(
|
|
579
|
+
console.error(import_chalk13.default.red(error.message));
|
|
601
580
|
process.exit(1);
|
|
602
581
|
});
|
|
603
582
|
|
|
@@ -608,10 +587,10 @@ var version_default = "3.0";
|
|
|
608
587
|
var import_config = require("dotenv/config");
|
|
609
588
|
|
|
610
589
|
// src/check/index.ts
|
|
611
|
-
var
|
|
590
|
+
var import_chalk15 = __toESM(require("chalk"), 1);
|
|
612
591
|
|
|
613
592
|
// src/check/checkTs.ts
|
|
614
|
-
var
|
|
593
|
+
var import_chalk14 = __toESM(require("chalk"), 1);
|
|
615
594
|
var import_node_child_process5 = require("child_process");
|
|
616
595
|
function checkTs2() {
|
|
617
596
|
try {
|
|
@@ -625,18 +604,18 @@ function checkTs2() {
|
|
|
625
604
|
stdio: "inherit"
|
|
626
605
|
});
|
|
627
606
|
} catch {
|
|
628
|
-
console.log(
|
|
607
|
+
console.log(import_chalk14.default.red.bold("TypeScript compilation failed"));
|
|
629
608
|
process.exit(1);
|
|
630
609
|
}
|
|
631
610
|
}
|
|
632
611
|
|
|
633
612
|
// src/check/index.ts
|
|
634
613
|
async function check_default() {
|
|
635
|
-
console.log(
|
|
614
|
+
console.log(import_chalk15.default.bold(`Orionjs App ${import_chalk15.default.green(import_chalk15.default.bold("V4"))}
|
|
636
615
|
`));
|
|
637
616
|
console.log("Checking typescript...");
|
|
638
617
|
checkTs2();
|
|
639
|
-
console.log(
|
|
618
|
+
console.log(import_chalk15.default.bold.green("Check passed\n"));
|
|
640
619
|
}
|
|
641
620
|
|
|
642
621
|
// src/index.ts
|
|
@@ -645,10 +624,10 @@ var run = (action) => async (...args) => {
|
|
|
645
624
|
try {
|
|
646
625
|
await action(...args);
|
|
647
626
|
} catch (e) {
|
|
648
|
-
console.error(
|
|
627
|
+
console.error(import_chalk16.default.red(`Error: ${e.message}`));
|
|
649
628
|
}
|
|
650
629
|
};
|
|
651
|
-
program.command("dev").description("Run the Orionjs app in development mode").option("--
|
|
630
|
+
program.command("dev").description("Run the Orionjs app in development mode").option("--omit-cursor-rule", "Omit the creation of the Orionjs Cursor rule").option("--omit-mcp-server", "Omit the creation of the Orionjs MCP server").allowUnknownOption().action(run(dev_default));
|
|
652
631
|
program.command("check").description("Runs a typescript check").action(run(check_default));
|
|
653
632
|
program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
|
|
654
633
|
program.command("prod").allowUnknownOption().option(
|