@orion-js/core 4.0.7 → 4.0.9
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 +102 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +114 -123
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import
|
|
4
|
+
import chalk16 from "chalk";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
|
|
7
7
|
// src/helpers/execute.ts
|
|
@@ -34,7 +34,7 @@ async function create_default({ name, kit }) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// src/dev/runner/index.ts
|
|
37
|
-
import
|
|
37
|
+
import chalk2 from "chalk";
|
|
38
38
|
|
|
39
39
|
// src/helpers/writeFile.ts
|
|
40
40
|
import fs2 from "fs";
|
|
@@ -51,34 +51,30 @@ var ensureDirectory = (filePath) => {
|
|
|
51
51
|
var ensureDirectory_default = ensureDirectory;
|
|
52
52
|
|
|
53
53
|
// src/helpers/writeFile.ts
|
|
54
|
-
async function writeFile_default(
|
|
55
|
-
ensureDirectory_default(
|
|
56
|
-
fs2.writeFileSync(
|
|
54
|
+
async function writeFile_default(path6, content) {
|
|
55
|
+
ensureDirectory_default(path6);
|
|
56
|
+
fs2.writeFileSync(path6, content);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
// src/dev/runner/startProcess.ts
|
|
60
60
|
import { spawn } from "child_process";
|
|
61
61
|
|
|
62
62
|
// src/dev/runner/getArgs.ts
|
|
63
|
-
function getArgs(
|
|
64
|
-
|
|
63
|
+
function getArgs(_options, command) {
|
|
64
|
+
const startCommand = "tsx";
|
|
65
65
|
const args = [];
|
|
66
|
-
|
|
67
|
-
const [first, ...otherArgs] = process.env.START_COMMAND.split(" ");
|
|
68
|
-
startCommand = first;
|
|
69
|
-
args.push(...otherArgs);
|
|
70
|
-
console.log(`Using custom command: ${[startCommand, ...args].join(" ")}`);
|
|
71
|
-
} else if (options.shell) {
|
|
72
|
-
args.push("--inspect");
|
|
73
|
-
}
|
|
66
|
+
args.push("watch", "--clear-screen=false");
|
|
74
67
|
args.push(...command.args);
|
|
75
68
|
args.push("./app/index.ts");
|
|
76
69
|
return { startCommand, args };
|
|
77
70
|
}
|
|
78
71
|
|
|
79
72
|
// src/dev/runner/startProcess.ts
|
|
73
|
+
import chalk from "chalk";
|
|
80
74
|
function startProcess(options, command) {
|
|
81
75
|
const { startCommand, args } = getArgs(options, command);
|
|
76
|
+
console.log(chalk.bold(`=> Starting app with command: ${startCommand} ${args.join(" ")}...
|
|
77
|
+
`));
|
|
82
78
|
return spawn(startCommand, args, {
|
|
83
79
|
env: {
|
|
84
80
|
ORION_DEV: "local",
|
|
@@ -94,15 +90,14 @@ function startProcess(options, command) {
|
|
|
94
90
|
function getRunner(options, command) {
|
|
95
91
|
let appProcess = null;
|
|
96
92
|
if (options.clean) {
|
|
97
|
-
console.log(
|
|
93
|
+
console.log(chalk2.bold("=> Cleaning directory...\n"));
|
|
98
94
|
}
|
|
99
|
-
const
|
|
100
|
-
console.log(chalk.bold("=> Starting app...\n"));
|
|
95
|
+
const startApp = () => {
|
|
101
96
|
appProcess = startProcess(options, command);
|
|
102
97
|
appProcess.on("exit", (code, signal) => {
|
|
103
98
|
if (!code || code === 143 || code === 0 || signal === "SIGTERM" || signal === "SIGINT") {
|
|
104
99
|
} else {
|
|
105
|
-
console.log(
|
|
100
|
+
console.log(chalk2.bold(`=> Error running app. Exit code: ${code}`));
|
|
106
101
|
}
|
|
107
102
|
});
|
|
108
103
|
writeFile_default(".orion/process", `${appProcess.pid}`);
|
|
@@ -110,15 +105,24 @@ function getRunner(options, command) {
|
|
|
110
105
|
const stop = () => {
|
|
111
106
|
if (appProcess) {
|
|
112
107
|
appProcess.kill();
|
|
108
|
+
appProcess = null;
|
|
113
109
|
}
|
|
114
110
|
};
|
|
115
111
|
const restart = () => {
|
|
112
|
+
console.log(chalk2.bold("=> Restarting app...\n"));
|
|
116
113
|
stop();
|
|
117
|
-
|
|
114
|
+
startApp();
|
|
115
|
+
};
|
|
116
|
+
const start = () => {
|
|
117
|
+
if (appProcess) {
|
|
118
|
+
} else {
|
|
119
|
+
startApp();
|
|
120
|
+
}
|
|
118
121
|
};
|
|
119
122
|
return {
|
|
120
123
|
restart,
|
|
121
|
-
stop
|
|
124
|
+
stop,
|
|
125
|
+
start
|
|
122
126
|
};
|
|
123
127
|
}
|
|
124
128
|
|
|
@@ -211,22 +215,34 @@ function reportDiagnostic(diagnostic) {
|
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
// src/dev/watchAndCompile/getHost.ts
|
|
214
|
-
import
|
|
218
|
+
import chalk3 from "chalk";
|
|
215
219
|
function getHost(runner) {
|
|
220
|
+
let isStopped = true;
|
|
216
221
|
const reportWatchStatusChanged = (diagnostic) => {
|
|
217
222
|
if (diagnostic.category !== 3) return;
|
|
218
|
-
if (diagnostic.code ===
|
|
223
|
+
if (diagnostic.code === 6031 || diagnostic.code === 6032) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (diagnostic.code === 6193) {
|
|
219
227
|
runner.stop();
|
|
228
|
+
isStopped = true;
|
|
229
|
+
return;
|
|
220
230
|
}
|
|
221
|
-
console.log(chalk2.bold(`=> ${diagnostic.messageText}`));
|
|
222
231
|
if (diagnostic.code === 6194) {
|
|
223
232
|
if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {
|
|
224
233
|
if (!diagnostic.messageText.toString().includes("Found 0 errors.")) {
|
|
234
|
+
runner.stop();
|
|
235
|
+
isStopped = true;
|
|
225
236
|
return;
|
|
226
237
|
}
|
|
227
238
|
}
|
|
228
|
-
|
|
239
|
+
if (isStopped) {
|
|
240
|
+
isStopped = false;
|
|
241
|
+
runner.start();
|
|
242
|
+
}
|
|
243
|
+
return;
|
|
229
244
|
}
|
|
245
|
+
console.log(chalk3.bold(`=> ${diagnostic.messageText} [${diagnostic.code}]`));
|
|
230
246
|
};
|
|
231
247
|
const configPath = getConfigPath();
|
|
232
248
|
const createProgram = ts3.createEmitAndSemanticDiagnosticsBuilderProgram;
|
|
@@ -241,41 +257,17 @@ function getHost(runner) {
|
|
|
241
257
|
return host;
|
|
242
258
|
}
|
|
243
259
|
|
|
244
|
-
// src/dev/watchAndCompile/watchDeletes.ts
|
|
245
|
-
import fs5 from "fs";
|
|
246
|
-
import path3 from "path";
|
|
247
|
-
import chokidar from "chokidar";
|
|
248
|
-
async function watchDeletes() {
|
|
249
|
-
const projectPath = path3.resolve("./app");
|
|
250
|
-
const watcher = chokidar.watch(projectPath, {
|
|
251
|
-
ignoreInitial: true
|
|
252
|
-
});
|
|
253
|
-
watcher.on("unlink", async (filepath) => {
|
|
254
|
-
if (!filepath.endsWith(".ts")) return;
|
|
255
|
-
const relative = path3.relative(process.cwd(), filepath);
|
|
256
|
-
const atBuildPath = path3.resolve(".orion/build", relative.replace(/.ts$/, ""));
|
|
257
|
-
try {
|
|
258
|
-
fs5.unlinkSync(`${atBuildPath}.js`);
|
|
259
|
-
fs5.unlinkSync(`${atBuildPath}.d.ts`);
|
|
260
|
-
} catch (error) {
|
|
261
|
-
console.log(
|
|
262
|
-
`Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
|
|
268
260
|
// src/dev/watchAndCompile/writeEnvFile.ts
|
|
269
261
|
import { writeDtsFileFromConfigFile } from "@orion-js/env";
|
|
270
|
-
import
|
|
271
|
-
import
|
|
262
|
+
import chalk4 from "chalk";
|
|
263
|
+
import chokidar from "chokidar";
|
|
272
264
|
var envFilePath = process.env.ORION_ENV_FILE_PATH;
|
|
273
265
|
var dtsFilePath = "./app/env.d.ts";
|
|
274
266
|
var watchEnvFile = async (runner) => {
|
|
275
267
|
if (!envFilePath) return;
|
|
276
268
|
writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
|
|
277
|
-
|
|
278
|
-
console.log(
|
|
269
|
+
chokidar.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
|
|
270
|
+
console.log(chalk4.bold("=> Environment file changed. Restarting..."));
|
|
279
271
|
writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
|
|
280
272
|
runner.restart();
|
|
281
273
|
});
|
|
@@ -286,15 +278,14 @@ async function watchAndCompile(runner) {
|
|
|
286
278
|
await cleanDirectory();
|
|
287
279
|
const host = getHost(runner);
|
|
288
280
|
ts4.createWatchProgram(host);
|
|
289
|
-
watchDeletes();
|
|
290
281
|
watchEnvFile(runner);
|
|
291
282
|
}
|
|
292
283
|
|
|
293
284
|
// src/dev/copyCursorRule/index.ts
|
|
294
|
-
import
|
|
285
|
+
import fs5 from "fs/promises";
|
|
295
286
|
import https from "https";
|
|
296
|
-
import
|
|
297
|
-
import
|
|
287
|
+
import path3 from "path";
|
|
288
|
+
import chalk5 from "chalk";
|
|
298
289
|
var rules = [
|
|
299
290
|
"orionjs.mdx",
|
|
300
291
|
"orionjs-component.mdx",
|
|
@@ -327,55 +318,55 @@ var downloadFile = (url) => {
|
|
|
327
318
|
async function copyCursorRule() {
|
|
328
319
|
const baseUrl = "https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc";
|
|
329
320
|
try {
|
|
330
|
-
const targetDir =
|
|
331
|
-
await
|
|
321
|
+
const targetDir = path3.join(process.cwd(), ".cursor", "rules");
|
|
322
|
+
await fs5.mkdir(targetDir, { recursive: true });
|
|
332
323
|
await Promise.all(
|
|
333
324
|
rules.map(async (rule) => {
|
|
334
325
|
const targetFileName = rule.replace(".mdx", ".mdc");
|
|
335
|
-
const targetFile =
|
|
326
|
+
const targetFile = path3.join(targetDir, targetFileName);
|
|
336
327
|
const sourceUrl = `${baseUrl}/${rule}`;
|
|
337
328
|
const content = await downloadFile(sourceUrl);
|
|
338
|
-
await
|
|
339
|
-
console.log(
|
|
329
|
+
await fs5.writeFile(targetFile, content, "utf8");
|
|
330
|
+
console.log(chalk5.bold(`=> \u2728 Successfully downloaded ${chalk5.cyan(targetFileName)}`));
|
|
340
331
|
})
|
|
341
332
|
);
|
|
342
|
-
console.log(
|
|
333
|
+
console.log(chalk5.bold("=> \u2728 All rule files have been successfully copied"));
|
|
343
334
|
} catch (error) {
|
|
344
|
-
console.error(
|
|
335
|
+
console.error(chalk5.red(`Error copying rule files: ${error.message}`));
|
|
345
336
|
}
|
|
346
337
|
}
|
|
347
338
|
|
|
348
339
|
// src/dev/copyMCP/index.ts
|
|
349
|
-
import
|
|
350
|
-
import
|
|
351
|
-
import
|
|
340
|
+
import fs7 from "fs/promises";
|
|
341
|
+
import path5 from "path";
|
|
342
|
+
import chalk7 from "chalk";
|
|
352
343
|
|
|
353
344
|
// src/dev/copyMCP/consts.ts
|
|
354
345
|
var MCP_VERSION = "v4";
|
|
355
346
|
var VERSION_FILE = "version.txt";
|
|
356
347
|
|
|
357
348
|
// src/dev/copyMCP/isValidMCPRepo.ts
|
|
358
|
-
import
|
|
359
|
-
import
|
|
360
|
-
import
|
|
349
|
+
import fs6 from "fs/promises";
|
|
350
|
+
import path4 from "path";
|
|
351
|
+
import chalk6 from "chalk";
|
|
361
352
|
async function isValidMCPRepository(directoryPath) {
|
|
362
353
|
try {
|
|
363
|
-
const stats = await
|
|
354
|
+
const stats = await fs6.stat(directoryPath);
|
|
364
355
|
if (!stats.isDirectory()) return false;
|
|
365
356
|
const expectedFiles = ["settings.js", "package.json"];
|
|
366
357
|
for (const file of expectedFiles) {
|
|
367
358
|
try {
|
|
368
|
-
await
|
|
359
|
+
await fs6.access(path4.join(directoryPath, file));
|
|
369
360
|
} catch {
|
|
370
361
|
return false;
|
|
371
362
|
}
|
|
372
363
|
}
|
|
373
364
|
try {
|
|
374
|
-
const versionPath =
|
|
375
|
-
const versionContent = await
|
|
365
|
+
const versionPath = path4.join(directoryPath, VERSION_FILE);
|
|
366
|
+
const versionContent = await fs6.readFile(versionPath, "utf-8");
|
|
376
367
|
if (versionContent.trim() !== MCP_VERSION) {
|
|
377
368
|
console.log(
|
|
378
|
-
|
|
369
|
+
chalk6.yellow(
|
|
379
370
|
`=> \u2728 MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`
|
|
380
371
|
)
|
|
381
372
|
);
|
|
@@ -393,71 +384,71 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
393
384
|
// src/dev/copyMCP/index.ts
|
|
394
385
|
async function copyMCP() {
|
|
395
386
|
const repoUrl = "https://github.com/orionjs/mcp-docs";
|
|
396
|
-
const targetDir =
|
|
387
|
+
const targetDir = path5.join(process.cwd(), ".orion", "mcp");
|
|
397
388
|
try {
|
|
398
|
-
await
|
|
389
|
+
await fs7.mkdir(path5.join(process.cwd(), ".orion"), { recursive: true });
|
|
399
390
|
if (await isValidMCPRepository(targetDir)) {
|
|
400
|
-
console.log(
|
|
391
|
+
console.log(chalk7.bold("=> \u2728 MCP documentation already installed"));
|
|
401
392
|
return;
|
|
402
393
|
}
|
|
403
394
|
try {
|
|
404
|
-
const stats = await
|
|
395
|
+
const stats = await fs7.stat(targetDir);
|
|
405
396
|
if (stats.isDirectory()) {
|
|
406
|
-
await
|
|
397
|
+
await fs7.rm(targetDir, { recursive: true, force: true });
|
|
407
398
|
console.log(
|
|
408
|
-
|
|
399
|
+
chalk7.bold(
|
|
409
400
|
"=> \u2728 Removed existing .orion/mcp directory (invalid, incomplete, or outdated)"
|
|
410
401
|
)
|
|
411
402
|
);
|
|
412
403
|
}
|
|
413
404
|
} catch (_) {
|
|
414
405
|
}
|
|
415
|
-
console.log(
|
|
406
|
+
console.log(chalk7.bold(`=> \u2728 Downloading MCP documentation ${MCP_VERSION}...`));
|
|
416
407
|
await execute_default(`git clone ${repoUrl} ${targetDir}`);
|
|
417
|
-
await execute_default(`rm -rf ${
|
|
418
|
-
await
|
|
408
|
+
await execute_default(`rm -rf ${path5.join(targetDir, ".git")}`);
|
|
409
|
+
await fs7.writeFile(path5.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
|
|
419
410
|
console.log(
|
|
420
|
-
|
|
411
|
+
chalk7.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
|
|
421
412
|
);
|
|
422
|
-
console.log(
|
|
413
|
+
console.log(chalk7.bold("=> \u2728 Installing MCP dependencies..."));
|
|
423
414
|
await execute_default(`cd ${targetDir} && npm install`);
|
|
424
|
-
console.log(
|
|
425
|
-
const relativePath =
|
|
415
|
+
console.log(chalk7.bold("=> \u2728 Successfully installed MCP dependencies"));
|
|
416
|
+
const relativePath = path5.relative(process.cwd(), targetDir);
|
|
426
417
|
console.log(relativePath);
|
|
427
418
|
const mcpServerConfig = {
|
|
428
419
|
mcpServers: {
|
|
429
420
|
"Orionjs documentation search": {
|
|
430
421
|
command: "node",
|
|
431
|
-
args: [`./${
|
|
422
|
+
args: [`./${path5.join(relativePath, "src", "index.js")}`]
|
|
432
423
|
}
|
|
433
424
|
}
|
|
434
425
|
};
|
|
435
|
-
const configPath =
|
|
426
|
+
const configPath = path5.join(process.cwd(), ".cursor", "mcp.json");
|
|
436
427
|
try {
|
|
437
|
-
const existingConfig = await
|
|
428
|
+
const existingConfig = await fs7.readFile(configPath, "utf-8");
|
|
438
429
|
const parsedConfig = JSON.parse(existingConfig);
|
|
439
430
|
parsedConfig.mcpServers = {
|
|
440
431
|
...parsedConfig.mcpServers,
|
|
441
432
|
...mcpServerConfig.mcpServers
|
|
442
433
|
};
|
|
443
|
-
await
|
|
444
|
-
console.log(
|
|
434
|
+
await fs7.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), "utf-8");
|
|
435
|
+
console.log(chalk7.bold("=> \u2728 Updated MCP server configuration in .cursor/mcp.json"));
|
|
445
436
|
} catch (_) {
|
|
446
|
-
await
|
|
447
|
-
await
|
|
448
|
-
console.log(
|
|
437
|
+
await fs7.mkdir(path5.dirname(configPath), { recursive: true });
|
|
438
|
+
await fs7.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), "utf-8");
|
|
439
|
+
console.log(chalk7.bold("=> \u2728 Created new MCP server configuration in .cursor/mcp.json"));
|
|
449
440
|
}
|
|
450
441
|
} catch (error) {
|
|
451
|
-
console.error(
|
|
442
|
+
console.error(chalk7.red("=> \u2728 Error copying MCP documentation:"), error);
|
|
452
443
|
throw error;
|
|
453
444
|
}
|
|
454
445
|
}
|
|
455
446
|
|
|
456
447
|
// src/dev/index.ts
|
|
457
|
-
import
|
|
448
|
+
import chalk8 from "chalk";
|
|
458
449
|
async function dev_default(options, command) {
|
|
459
|
-
console.log(
|
|
460
|
-
Orionjs App ${
|
|
450
|
+
console.log(chalk8.bold(`
|
|
451
|
+
Orionjs App ${chalk8.green(chalk8.bold("V4"))} Dev mode
|
|
461
452
|
`));
|
|
462
453
|
if (!options.omitCursorRule) {
|
|
463
454
|
await copyCursorRule().catch(console.error);
|
|
@@ -466,14 +457,14 @@ Orionjs App ${chalk7.green(chalk7.bold("V4"))} Dev mode
|
|
|
466
457
|
await copyMCP().catch(console.error);
|
|
467
458
|
}
|
|
468
459
|
if (!options.omitMcpServer && !options.omitCursorRule) {
|
|
469
|
-
console.log(
|
|
460
|
+
console.log(chalk8.bold("=> \u2728 Orionjs AI is ready\n"));
|
|
470
461
|
}
|
|
471
462
|
const runner = getRunner(options, command);
|
|
472
463
|
watchAndCompile(runner);
|
|
473
464
|
}
|
|
474
465
|
|
|
475
466
|
// src/prod/index.ts
|
|
476
|
-
import
|
|
467
|
+
import chalk12 from "chalk";
|
|
477
468
|
|
|
478
469
|
// src/prod/runProd.ts
|
|
479
470
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -494,10 +485,10 @@ function runProd(options, command) {
|
|
|
494
485
|
}
|
|
495
486
|
|
|
496
487
|
// src/build/index.ts
|
|
497
|
-
import
|
|
488
|
+
import chalk11 from "chalk";
|
|
498
489
|
|
|
499
490
|
// src/build/build.ts
|
|
500
|
-
import
|
|
491
|
+
import chalk9 from "chalk";
|
|
501
492
|
import * as esbuild from "esbuild";
|
|
502
493
|
async function build2(options) {
|
|
503
494
|
const { output } = options;
|
|
@@ -515,11 +506,11 @@ async function build2(options) {
|
|
|
515
506
|
minify: true,
|
|
516
507
|
packages: "external"
|
|
517
508
|
});
|
|
518
|
-
console.log(
|
|
509
|
+
console.log(chalk9.green.bold("Build successful"));
|
|
519
510
|
}
|
|
520
511
|
|
|
521
512
|
// src/build/checkTs.ts
|
|
522
|
-
import
|
|
513
|
+
import chalk10 from "chalk";
|
|
523
514
|
import { exec as exec2 } from "child_process";
|
|
524
515
|
import { promisify } from "util";
|
|
525
516
|
var execPromise = promisify(exec2);
|
|
@@ -534,9 +525,9 @@ async function checkTs() {
|
|
|
534
525
|
gid: process.getgid(),
|
|
535
526
|
uid: process.getuid()
|
|
536
527
|
});
|
|
537
|
-
console.log(
|
|
528
|
+
console.log(chalk10.green.bold("TypeScript check passed"));
|
|
538
529
|
} catch (error) {
|
|
539
|
-
console.log(
|
|
530
|
+
console.log(chalk10.red.bold("TypeScript compilation failed"));
|
|
540
531
|
console.log(error.stderr || error.stdout || error.message);
|
|
541
532
|
process.exit(1);
|
|
542
533
|
}
|
|
@@ -544,19 +535,19 @@ async function checkTs() {
|
|
|
544
535
|
|
|
545
536
|
// src/build/index.ts
|
|
546
537
|
async function build_default(options) {
|
|
547
|
-
console.log(
|
|
538
|
+
console.log(chalk11.bold(`Building Orionjs App ${chalk11.green(chalk11.bold("V4"))}...`));
|
|
548
539
|
if (!options.output) {
|
|
549
540
|
options.output = "./build";
|
|
550
541
|
}
|
|
551
542
|
await cleanDirectory(options.output);
|
|
552
543
|
await Promise.all([checkTs(), build2(options)]);
|
|
553
|
-
console.log(
|
|
544
|
+
console.log(chalk11.bold("Build completed"));
|
|
554
545
|
}
|
|
555
546
|
|
|
556
547
|
// src/prod/index.ts
|
|
557
548
|
async function prod_default(options, command) {
|
|
558
|
-
console.log(
|
|
559
|
-
Orionjs App ${
|
|
549
|
+
console.log(chalk12.bold(`
|
|
550
|
+
Orionjs App ${chalk12.green(chalk12.bold("V4"))} Prod mode
|
|
560
551
|
`));
|
|
561
552
|
if (!options.path) {
|
|
562
553
|
await build_default({ output: "./build" });
|
|
@@ -566,16 +557,16 @@ Orionjs App ${chalk11.green(chalk11.bold("V4"))} Prod mode
|
|
|
566
557
|
}
|
|
567
558
|
|
|
568
559
|
// src/handleErrors.ts
|
|
569
|
-
import
|
|
560
|
+
import chalk13 from "chalk";
|
|
570
561
|
process.on("unhandledRejection", (error) => {
|
|
571
562
|
if (error.codeFrame) {
|
|
572
|
-
console.error(
|
|
563
|
+
console.error(chalk13.red(error.message));
|
|
573
564
|
console.log(error.codeFrame);
|
|
574
565
|
} else {
|
|
575
|
-
console.error(
|
|
566
|
+
console.error(chalk13.red(error.message), chalk13.red("Unhandled promise rejection"));
|
|
576
567
|
}
|
|
577
568
|
}).on("uncaughtException", (error) => {
|
|
578
|
-
console.error(
|
|
569
|
+
console.error(chalk13.red(error.message));
|
|
579
570
|
process.exit(1);
|
|
580
571
|
});
|
|
581
572
|
|
|
@@ -586,10 +577,10 @@ var version_default = "3.0";
|
|
|
586
577
|
import "dotenv/config";
|
|
587
578
|
|
|
588
579
|
// src/check/index.ts
|
|
589
|
-
import
|
|
580
|
+
import chalk15 from "chalk";
|
|
590
581
|
|
|
591
582
|
// src/check/checkTs.ts
|
|
592
|
-
import
|
|
583
|
+
import chalk14 from "chalk";
|
|
593
584
|
import { execSync } from "child_process";
|
|
594
585
|
function checkTs2() {
|
|
595
586
|
try {
|
|
@@ -603,18 +594,18 @@ function checkTs2() {
|
|
|
603
594
|
stdio: "inherit"
|
|
604
595
|
});
|
|
605
596
|
} catch {
|
|
606
|
-
console.log(
|
|
597
|
+
console.log(chalk14.red.bold("TypeScript compilation failed"));
|
|
607
598
|
process.exit(1);
|
|
608
599
|
}
|
|
609
600
|
}
|
|
610
601
|
|
|
611
602
|
// src/check/index.ts
|
|
612
603
|
async function check_default() {
|
|
613
|
-
console.log(
|
|
604
|
+
console.log(chalk15.bold(`Orionjs App ${chalk15.green(chalk15.bold("V4"))}
|
|
614
605
|
`));
|
|
615
606
|
console.log("Checking typescript...");
|
|
616
607
|
checkTs2();
|
|
617
|
-
console.log(
|
|
608
|
+
console.log(chalk15.bold.green("Check passed\n"));
|
|
618
609
|
}
|
|
619
610
|
|
|
620
611
|
// src/index.ts
|
|
@@ -623,10 +614,10 @@ var run = (action) => async (...args) => {
|
|
|
623
614
|
try {
|
|
624
615
|
await action(...args);
|
|
625
616
|
} catch (e) {
|
|
626
|
-
console.error(
|
|
617
|
+
console.error(chalk16.red(`Error: ${e.message}`));
|
|
627
618
|
}
|
|
628
619
|
};
|
|
629
|
-
program.command("dev").description("Run the Orionjs app in development mode").option("--
|
|
620
|
+
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));
|
|
630
621
|
program.command("check").description("Runs a typescript check").action(run(check_default));
|
|
631
622
|
program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
|
|
632
623
|
program.command("prod").allowUnknownOption().option(
|