@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.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,21 +215,21 @@ 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) {
|
|
216
220
|
const reportWatchStatusChanged = (diagnostic) => {
|
|
217
221
|
if (diagnostic.category !== 3) return;
|
|
218
222
|
if (diagnostic.code === 6032 || diagnostic.code === 6031) {
|
|
219
223
|
runner.stop();
|
|
220
224
|
}
|
|
221
|
-
console.log(
|
|
225
|
+
console.log(chalk3.bold(`=> ${diagnostic.messageText}`));
|
|
222
226
|
if (diagnostic.code === 6194) {
|
|
223
227
|
if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {
|
|
224
228
|
if (!diagnostic.messageText.toString().includes("Found 0 errors.")) {
|
|
225
229
|
return;
|
|
226
230
|
}
|
|
227
231
|
}
|
|
228
|
-
runner.
|
|
232
|
+
runner.start();
|
|
229
233
|
}
|
|
230
234
|
};
|
|
231
235
|
const configPath = getConfigPath();
|
|
@@ -241,41 +245,17 @@ function getHost(runner) {
|
|
|
241
245
|
return host;
|
|
242
246
|
}
|
|
243
247
|
|
|
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
248
|
// src/dev/watchAndCompile/writeEnvFile.ts
|
|
269
249
|
import { writeDtsFileFromConfigFile } from "@orion-js/env";
|
|
270
|
-
import
|
|
271
|
-
import
|
|
250
|
+
import chalk4 from "chalk";
|
|
251
|
+
import chokidar from "chokidar";
|
|
272
252
|
var envFilePath = process.env.ORION_ENV_FILE_PATH;
|
|
273
253
|
var dtsFilePath = "./app/env.d.ts";
|
|
274
254
|
var watchEnvFile = async (runner) => {
|
|
275
255
|
if (!envFilePath) return;
|
|
276
256
|
writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
|
|
277
|
-
|
|
278
|
-
console.log(
|
|
257
|
+
chokidar.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
|
|
258
|
+
console.log(chalk4.bold("=> Environment file changed. Restarting..."));
|
|
279
259
|
writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
|
|
280
260
|
runner.restart();
|
|
281
261
|
});
|
|
@@ -286,15 +266,14 @@ async function watchAndCompile(runner) {
|
|
|
286
266
|
await cleanDirectory();
|
|
287
267
|
const host = getHost(runner);
|
|
288
268
|
ts4.createWatchProgram(host);
|
|
289
|
-
watchDeletes();
|
|
290
269
|
watchEnvFile(runner);
|
|
291
270
|
}
|
|
292
271
|
|
|
293
272
|
// src/dev/copyCursorRule/index.ts
|
|
294
|
-
import
|
|
273
|
+
import fs5 from "fs/promises";
|
|
295
274
|
import https from "https";
|
|
296
|
-
import
|
|
297
|
-
import
|
|
275
|
+
import path3 from "path";
|
|
276
|
+
import chalk5 from "chalk";
|
|
298
277
|
var rules = [
|
|
299
278
|
"orionjs.mdx",
|
|
300
279
|
"orionjs-component.mdx",
|
|
@@ -327,55 +306,55 @@ var downloadFile = (url) => {
|
|
|
327
306
|
async function copyCursorRule() {
|
|
328
307
|
const baseUrl = "https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc";
|
|
329
308
|
try {
|
|
330
|
-
const targetDir =
|
|
331
|
-
await
|
|
309
|
+
const targetDir = path3.join(process.cwd(), ".cursor", "rules");
|
|
310
|
+
await fs5.mkdir(targetDir, { recursive: true });
|
|
332
311
|
await Promise.all(
|
|
333
312
|
rules.map(async (rule) => {
|
|
334
313
|
const targetFileName = rule.replace(".mdx", ".mdc");
|
|
335
|
-
const targetFile =
|
|
314
|
+
const targetFile = path3.join(targetDir, targetFileName);
|
|
336
315
|
const sourceUrl = `${baseUrl}/${rule}`;
|
|
337
316
|
const content = await downloadFile(sourceUrl);
|
|
338
|
-
await
|
|
339
|
-
console.log(
|
|
317
|
+
await fs5.writeFile(targetFile, content, "utf8");
|
|
318
|
+
console.log(chalk5.bold(`=> \u2728 Successfully downloaded ${chalk5.cyan(targetFileName)}`));
|
|
340
319
|
})
|
|
341
320
|
);
|
|
342
|
-
console.log(
|
|
321
|
+
console.log(chalk5.bold("=> \u2728 All rule files have been successfully copied"));
|
|
343
322
|
} catch (error) {
|
|
344
|
-
console.error(
|
|
323
|
+
console.error(chalk5.red(`Error copying rule files: ${error.message}`));
|
|
345
324
|
}
|
|
346
325
|
}
|
|
347
326
|
|
|
348
327
|
// src/dev/copyMCP/index.ts
|
|
349
|
-
import
|
|
350
|
-
import
|
|
351
|
-
import
|
|
328
|
+
import fs7 from "fs/promises";
|
|
329
|
+
import path5 from "path";
|
|
330
|
+
import chalk7 from "chalk";
|
|
352
331
|
|
|
353
332
|
// src/dev/copyMCP/consts.ts
|
|
354
333
|
var MCP_VERSION = "v4";
|
|
355
334
|
var VERSION_FILE = "version.txt";
|
|
356
335
|
|
|
357
336
|
// src/dev/copyMCP/isValidMCPRepo.ts
|
|
358
|
-
import
|
|
359
|
-
import
|
|
360
|
-
import
|
|
337
|
+
import fs6 from "fs/promises";
|
|
338
|
+
import path4 from "path";
|
|
339
|
+
import chalk6 from "chalk";
|
|
361
340
|
async function isValidMCPRepository(directoryPath) {
|
|
362
341
|
try {
|
|
363
|
-
const stats = await
|
|
342
|
+
const stats = await fs6.stat(directoryPath);
|
|
364
343
|
if (!stats.isDirectory()) return false;
|
|
365
344
|
const expectedFiles = ["settings.js", "package.json"];
|
|
366
345
|
for (const file of expectedFiles) {
|
|
367
346
|
try {
|
|
368
|
-
await
|
|
347
|
+
await fs6.access(path4.join(directoryPath, file));
|
|
369
348
|
} catch {
|
|
370
349
|
return false;
|
|
371
350
|
}
|
|
372
351
|
}
|
|
373
352
|
try {
|
|
374
|
-
const versionPath =
|
|
375
|
-
const versionContent = await
|
|
353
|
+
const versionPath = path4.join(directoryPath, VERSION_FILE);
|
|
354
|
+
const versionContent = await fs6.readFile(versionPath, "utf-8");
|
|
376
355
|
if (versionContent.trim() !== MCP_VERSION) {
|
|
377
356
|
console.log(
|
|
378
|
-
|
|
357
|
+
chalk6.yellow(
|
|
379
358
|
`=> \u2728 MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`
|
|
380
359
|
)
|
|
381
360
|
);
|
|
@@ -393,71 +372,71 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
393
372
|
// src/dev/copyMCP/index.ts
|
|
394
373
|
async function copyMCP() {
|
|
395
374
|
const repoUrl = "https://github.com/orionjs/mcp-docs";
|
|
396
|
-
const targetDir =
|
|
375
|
+
const targetDir = path5.join(process.cwd(), ".orion", "mcp");
|
|
397
376
|
try {
|
|
398
|
-
await
|
|
377
|
+
await fs7.mkdir(path5.join(process.cwd(), ".orion"), { recursive: true });
|
|
399
378
|
if (await isValidMCPRepository(targetDir)) {
|
|
400
|
-
console.log(
|
|
379
|
+
console.log(chalk7.bold("=> \u2728 MCP documentation already installed"));
|
|
401
380
|
return;
|
|
402
381
|
}
|
|
403
382
|
try {
|
|
404
|
-
const stats = await
|
|
383
|
+
const stats = await fs7.stat(targetDir);
|
|
405
384
|
if (stats.isDirectory()) {
|
|
406
|
-
await
|
|
385
|
+
await fs7.rm(targetDir, { recursive: true, force: true });
|
|
407
386
|
console.log(
|
|
408
|
-
|
|
387
|
+
chalk7.bold(
|
|
409
388
|
"=> \u2728 Removed existing .orion/mcp directory (invalid, incomplete, or outdated)"
|
|
410
389
|
)
|
|
411
390
|
);
|
|
412
391
|
}
|
|
413
392
|
} catch (_) {
|
|
414
393
|
}
|
|
415
|
-
console.log(
|
|
394
|
+
console.log(chalk7.bold(`=> \u2728 Downloading MCP documentation ${MCP_VERSION}...`));
|
|
416
395
|
await execute_default(`git clone ${repoUrl} ${targetDir}`);
|
|
417
|
-
await execute_default(`rm -rf ${
|
|
418
|
-
await
|
|
396
|
+
await execute_default(`rm -rf ${path5.join(targetDir, ".git")}`);
|
|
397
|
+
await fs7.writeFile(path5.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
|
|
419
398
|
console.log(
|
|
420
|
-
|
|
399
|
+
chalk7.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
|
|
421
400
|
);
|
|
422
|
-
console.log(
|
|
401
|
+
console.log(chalk7.bold("=> \u2728 Installing MCP dependencies..."));
|
|
423
402
|
await execute_default(`cd ${targetDir} && npm install`);
|
|
424
|
-
console.log(
|
|
425
|
-
const relativePath =
|
|
403
|
+
console.log(chalk7.bold("=> \u2728 Successfully installed MCP dependencies"));
|
|
404
|
+
const relativePath = path5.relative(process.cwd(), targetDir);
|
|
426
405
|
console.log(relativePath);
|
|
427
406
|
const mcpServerConfig = {
|
|
428
407
|
mcpServers: {
|
|
429
408
|
"Orionjs documentation search": {
|
|
430
409
|
command: "node",
|
|
431
|
-
args: [`./${
|
|
410
|
+
args: [`./${path5.join(relativePath, "src", "index.js")}`]
|
|
432
411
|
}
|
|
433
412
|
}
|
|
434
413
|
};
|
|
435
|
-
const configPath =
|
|
414
|
+
const configPath = path5.join(process.cwd(), ".cursor", "mcp.json");
|
|
436
415
|
try {
|
|
437
|
-
const existingConfig = await
|
|
416
|
+
const existingConfig = await fs7.readFile(configPath, "utf-8");
|
|
438
417
|
const parsedConfig = JSON.parse(existingConfig);
|
|
439
418
|
parsedConfig.mcpServers = {
|
|
440
419
|
...parsedConfig.mcpServers,
|
|
441
420
|
...mcpServerConfig.mcpServers
|
|
442
421
|
};
|
|
443
|
-
await
|
|
444
|
-
console.log(
|
|
422
|
+
await fs7.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), "utf-8");
|
|
423
|
+
console.log(chalk7.bold("=> \u2728 Updated MCP server configuration in .cursor/mcp.json"));
|
|
445
424
|
} catch (_) {
|
|
446
|
-
await
|
|
447
|
-
await
|
|
448
|
-
console.log(
|
|
425
|
+
await fs7.mkdir(path5.dirname(configPath), { recursive: true });
|
|
426
|
+
await fs7.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), "utf-8");
|
|
427
|
+
console.log(chalk7.bold("=> \u2728 Created new MCP server configuration in .cursor/mcp.json"));
|
|
449
428
|
}
|
|
450
429
|
} catch (error) {
|
|
451
|
-
console.error(
|
|
430
|
+
console.error(chalk7.red("=> \u2728 Error copying MCP documentation:"), error);
|
|
452
431
|
throw error;
|
|
453
432
|
}
|
|
454
433
|
}
|
|
455
434
|
|
|
456
435
|
// src/dev/index.ts
|
|
457
|
-
import
|
|
436
|
+
import chalk8 from "chalk";
|
|
458
437
|
async function dev_default(options, command) {
|
|
459
|
-
console.log(
|
|
460
|
-
Orionjs App ${
|
|
438
|
+
console.log(chalk8.bold(`
|
|
439
|
+
Orionjs App ${chalk8.green(chalk8.bold("V4"))} Dev mode
|
|
461
440
|
`));
|
|
462
441
|
if (!options.omitCursorRule) {
|
|
463
442
|
await copyCursorRule().catch(console.error);
|
|
@@ -466,14 +445,14 @@ Orionjs App ${chalk7.green(chalk7.bold("V4"))} Dev mode
|
|
|
466
445
|
await copyMCP().catch(console.error);
|
|
467
446
|
}
|
|
468
447
|
if (!options.omitMcpServer && !options.omitCursorRule) {
|
|
469
|
-
console.log(
|
|
448
|
+
console.log(chalk8.bold("=> \u2728 Orionjs AI is ready\n"));
|
|
470
449
|
}
|
|
471
450
|
const runner = getRunner(options, command);
|
|
472
451
|
watchAndCompile(runner);
|
|
473
452
|
}
|
|
474
453
|
|
|
475
454
|
// src/prod/index.ts
|
|
476
|
-
import
|
|
455
|
+
import chalk12 from "chalk";
|
|
477
456
|
|
|
478
457
|
// src/prod/runProd.ts
|
|
479
458
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -494,10 +473,10 @@ function runProd(options, command) {
|
|
|
494
473
|
}
|
|
495
474
|
|
|
496
475
|
// src/build/index.ts
|
|
497
|
-
import
|
|
476
|
+
import chalk11 from "chalk";
|
|
498
477
|
|
|
499
478
|
// src/build/build.ts
|
|
500
|
-
import
|
|
479
|
+
import chalk9 from "chalk";
|
|
501
480
|
import * as esbuild from "esbuild";
|
|
502
481
|
async function build2(options) {
|
|
503
482
|
const { output } = options;
|
|
@@ -515,11 +494,11 @@ async function build2(options) {
|
|
|
515
494
|
minify: true,
|
|
516
495
|
packages: "external"
|
|
517
496
|
});
|
|
518
|
-
console.log(
|
|
497
|
+
console.log(chalk9.green.bold("Build successful"));
|
|
519
498
|
}
|
|
520
499
|
|
|
521
500
|
// src/build/checkTs.ts
|
|
522
|
-
import
|
|
501
|
+
import chalk10 from "chalk";
|
|
523
502
|
import { exec as exec2 } from "child_process";
|
|
524
503
|
import { promisify } from "util";
|
|
525
504
|
var execPromise = promisify(exec2);
|
|
@@ -534,9 +513,9 @@ async function checkTs() {
|
|
|
534
513
|
gid: process.getgid(),
|
|
535
514
|
uid: process.getuid()
|
|
536
515
|
});
|
|
537
|
-
console.log(
|
|
516
|
+
console.log(chalk10.green.bold("TypeScript check passed"));
|
|
538
517
|
} catch (error) {
|
|
539
|
-
console.log(
|
|
518
|
+
console.log(chalk10.red.bold("TypeScript compilation failed"));
|
|
540
519
|
console.log(error.stderr || error.stdout || error.message);
|
|
541
520
|
process.exit(1);
|
|
542
521
|
}
|
|
@@ -544,19 +523,19 @@ async function checkTs() {
|
|
|
544
523
|
|
|
545
524
|
// src/build/index.ts
|
|
546
525
|
async function build_default(options) {
|
|
547
|
-
console.log(
|
|
526
|
+
console.log(chalk11.bold(`Building Orionjs App ${chalk11.green(chalk11.bold("V4"))}...`));
|
|
548
527
|
if (!options.output) {
|
|
549
528
|
options.output = "./build";
|
|
550
529
|
}
|
|
551
530
|
await cleanDirectory(options.output);
|
|
552
531
|
await Promise.all([checkTs(), build2(options)]);
|
|
553
|
-
console.log(
|
|
532
|
+
console.log(chalk11.bold("Build completed"));
|
|
554
533
|
}
|
|
555
534
|
|
|
556
535
|
// src/prod/index.ts
|
|
557
536
|
async function prod_default(options, command) {
|
|
558
|
-
console.log(
|
|
559
|
-
Orionjs App ${
|
|
537
|
+
console.log(chalk12.bold(`
|
|
538
|
+
Orionjs App ${chalk12.green(chalk12.bold("V4"))} Prod mode
|
|
560
539
|
`));
|
|
561
540
|
if (!options.path) {
|
|
562
541
|
await build_default({ output: "./build" });
|
|
@@ -566,16 +545,16 @@ Orionjs App ${chalk11.green(chalk11.bold("V4"))} Prod mode
|
|
|
566
545
|
}
|
|
567
546
|
|
|
568
547
|
// src/handleErrors.ts
|
|
569
|
-
import
|
|
548
|
+
import chalk13 from "chalk";
|
|
570
549
|
process.on("unhandledRejection", (error) => {
|
|
571
550
|
if (error.codeFrame) {
|
|
572
|
-
console.error(
|
|
551
|
+
console.error(chalk13.red(error.message));
|
|
573
552
|
console.log(error.codeFrame);
|
|
574
553
|
} else {
|
|
575
|
-
console.error(
|
|
554
|
+
console.error(chalk13.red(error.message), chalk13.red("Unhandled promise rejection"));
|
|
576
555
|
}
|
|
577
556
|
}).on("uncaughtException", (error) => {
|
|
578
|
-
console.error(
|
|
557
|
+
console.error(chalk13.red(error.message));
|
|
579
558
|
process.exit(1);
|
|
580
559
|
});
|
|
581
560
|
|
|
@@ -586,10 +565,10 @@ var version_default = "3.0";
|
|
|
586
565
|
import "dotenv/config";
|
|
587
566
|
|
|
588
567
|
// src/check/index.ts
|
|
589
|
-
import
|
|
568
|
+
import chalk15 from "chalk";
|
|
590
569
|
|
|
591
570
|
// src/check/checkTs.ts
|
|
592
|
-
import
|
|
571
|
+
import chalk14 from "chalk";
|
|
593
572
|
import { execSync } from "child_process";
|
|
594
573
|
function checkTs2() {
|
|
595
574
|
try {
|
|
@@ -603,18 +582,18 @@ function checkTs2() {
|
|
|
603
582
|
stdio: "inherit"
|
|
604
583
|
});
|
|
605
584
|
} catch {
|
|
606
|
-
console.log(
|
|
585
|
+
console.log(chalk14.red.bold("TypeScript compilation failed"));
|
|
607
586
|
process.exit(1);
|
|
608
587
|
}
|
|
609
588
|
}
|
|
610
589
|
|
|
611
590
|
// src/check/index.ts
|
|
612
591
|
async function check_default() {
|
|
613
|
-
console.log(
|
|
592
|
+
console.log(chalk15.bold(`Orionjs App ${chalk15.green(chalk15.bold("V4"))}
|
|
614
593
|
`));
|
|
615
594
|
console.log("Checking typescript...");
|
|
616
595
|
checkTs2();
|
|
617
|
-
console.log(
|
|
596
|
+
console.log(chalk15.bold.green("Check passed\n"));
|
|
618
597
|
}
|
|
619
598
|
|
|
620
599
|
// src/index.ts
|
|
@@ -623,10 +602,10 @@ var run = (action) => async (...args) => {
|
|
|
623
602
|
try {
|
|
624
603
|
await action(...args);
|
|
625
604
|
} catch (e) {
|
|
626
|
-
console.error(
|
|
605
|
+
console.error(chalk16.red(`Error: ${e.message}`));
|
|
627
606
|
}
|
|
628
607
|
};
|
|
629
|
-
program.command("dev").description("Run the Orionjs app in development mode").option("--
|
|
608
|
+
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
609
|
program.command("check").description("Runs a typescript check").action(run(check_default));
|
|
631
610
|
program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
|
|
632
611
|
program.command("prod").allowUnknownOption().option(
|