@orion-js/core 4.0.6 → 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 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 import_chalk14 = __toESM(require("chalk"), 1);
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 import_chalk = __toESM(require("chalk"), 1);
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(path7, content) {
77
- ensureDirectory_default(path7);
78
- import_node_fs2.default.writeFileSync(path7, content);
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(options, command) {
86
- let startCommand = process.env.START_COMMAND || "tsx";
85
+ function getArgs(_options, command) {
86
+ const startCommand = "tsx";
87
87
  const args = [];
88
- if (process.env.START_COMMAND) {
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(import_chalk.default.bold("=> Cleaning directory...\n"));
115
+ console.log(import_chalk2.default.bold("=> Cleaning directory...\n"));
120
116
  }
121
- const start = () => {
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(import_chalk.default.bold(`=> Error running app. Exit code: ${code}`));
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
- start();
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 import_chalk2 = __toESM(require("chalk"), 1);
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(import_chalk2.default.bold(`=> ${diagnostic.messageText}`));
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.restart();
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 import_chalk3 = __toESM(require("chalk"), 1);
293
- var import_chokidar2 = __toESM(require("chokidar"), 1);
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
- import_chokidar2.default.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
300
- console.log(import_chalk3.default.bold("=> Environment file changed. Restarting..."));
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 import_node_path4 = __toESM(require("path"), 1);
319
- var import_chalk4 = __toESM(require("chalk"), 1);
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 = import_node_path4.default.join(process.cwd(), ".cursor", "rules");
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 = import_node_path4.default.join(targetDir, targetFileName);
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(import_chalk4.default.bold(`=> \u2728 Successfully downloaded ${import_chalk4.default.cyan(targetFileName)}`));
340
+ console.log(import_chalk5.default.bold(`=> \u2728 Successfully downloaded ${import_chalk5.default.cyan(targetFileName)}`));
362
341
  })
363
342
  );
364
- console.log(import_chalk4.default.bold("=> \u2728 All rule files have been successfully copied"));
343
+ console.log(import_chalk5.default.bold("=> \u2728 All rule files have been successfully copied"));
365
344
  } catch (error) {
366
- console.error(import_chalk4.default.red(`Error copying rule files: ${error.message}`));
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 import_node_path6 = __toESM(require("path"), 1);
373
- var import_chalk6 = __toESM(require("chalk"), 1);
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 import_node_path5 = __toESM(require("path"), 1);
382
- var import_chalk5 = __toESM(require("chalk"), 1);
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(import_node_path5.default.join(directoryPath, file));
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 = import_node_path5.default.join(directoryPath, VERSION_FILE);
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
- import_chalk5.default.yellow(
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 = import_node_path6.default.join(process.cwd(), ".orion", "mcp");
397
+ const targetDir = import_node_path5.default.join(process.cwd(), ".orion", "mcp");
419
398
  try {
420
- await import_promises3.default.mkdir(import_node_path6.default.join(process.cwd(), ".orion"), { recursive: true });
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(import_chalk6.default.bold("=> \u2728 MCP documentation already installed"));
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
- import_chalk6.default.bold(
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(import_chalk6.default.bold(`=> \u2728 Downloading MCP documentation ${MCP_VERSION}...`));
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 ${import_node_path6.default.join(targetDir, ".git")}`);
440
- await import_promises3.default.writeFile(import_node_path6.default.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
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
- import_chalk6.default.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
421
+ import_chalk7.default.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
443
422
  );
444
- console.log(import_chalk6.default.bold("=> \u2728 Installing MCP dependencies..."));
423
+ console.log(import_chalk7.default.bold("=> \u2728 Installing MCP dependencies..."));
445
424
  await execute_default(`cd ${targetDir} && npm install`);
446
- console.log(import_chalk6.default.bold("=> \u2728 Successfully installed MCP dependencies"));
447
- const relativePath = import_node_path6.default.relative(process.cwd(), targetDir);
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: [`./${import_node_path6.default.join(relativePath, "src", "index.js")}`]
432
+ args: [`./${import_node_path5.default.join(relativePath, "src", "index.js")}`]
454
433
  }
455
434
  }
456
435
  };
457
- const configPath = import_node_path6.default.join(process.cwd(), ".cursor", "mcp.json");
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(import_chalk6.default.bold("=> \u2728 Updated MCP server configuration in .cursor/mcp.json"));
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(import_node_path6.default.dirname(configPath), { recursive: true });
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(import_chalk6.default.bold("=> \u2728 Created new MCP server configuration in .cursor/mcp.json"));
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(import_chalk6.default.red("=> \u2728 Error copying MCP documentation:"), 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 import_chalk7 = __toESM(require("chalk"), 1);
458
+ var import_chalk8 = __toESM(require("chalk"), 1);
480
459
  async function dev_default(options, command) {
481
- console.log(import_chalk7.default.bold(`
482
- Orionjs App ${import_chalk7.default.green(import_chalk7.default.bold("V4"))} Dev mode
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,20 +467,21 @@ 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(import_chalk7.default.bold("=> \u2728 Orionjs AI is ready\n"));
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 import_chalk9 = __toESM(require("chalk"), 1);
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");
502
- function runProd(command) {
503
- const args = [...command.args, "./app/index.ts"];
504
- (0, import_node_child_process3.spawn)("tsx", args, {
481
+ function runProd(options, command) {
482
+ const indexPath = `${options.path}/index.js`;
483
+ const args = ["--import=tsx", ...command.args, indexPath];
484
+ (0, import_node_child_process3.spawn)("node", args, {
505
485
  env: {
506
486
  NODE_ENV: "production",
507
487
  ...process.env
@@ -514,46 +494,89 @@ function runProd(command) {
514
494
  });
515
495
  }
516
496
 
517
- // src/prod/checkTs.ts
518
- var import_chalk8 = __toESM(require("chalk"), 1);
497
+ // src/build/index.ts
498
+ var import_chalk11 = __toESM(require("chalk"), 1);
499
+
500
+ // src/build/build.ts
501
+ var import_chalk9 = __toESM(require("chalk"), 1);
502
+ var esbuild = __toESM(require("esbuild"), 1);
503
+ async function build2(options) {
504
+ const { output } = options;
505
+ console.log(`Building with esbuild to ${output}`);
506
+ await esbuild.build({
507
+ entryPoints: ["./app/index.ts"],
508
+ tsconfig: "./tsconfig.json",
509
+ format: "esm",
510
+ platform: "node",
511
+ outdir: output,
512
+ bundle: true,
513
+ target: "node22",
514
+ sourcemap: true,
515
+ allowOverwrite: true,
516
+ minify: true,
517
+ packages: "external"
518
+ });
519
+ console.log(import_chalk9.default.green.bold("Build successful"));
520
+ }
521
+
522
+ // src/build/checkTs.ts
523
+ var import_chalk10 = __toESM(require("chalk"), 1);
519
524
  var import_node_child_process4 = require("child_process");
520
- function checkTs() {
525
+ var import_node_util = require("util");
526
+ var execPromise = (0, import_node_util.promisify)(import_node_child_process4.exec);
527
+ async function checkTs() {
521
528
  try {
522
- (0, import_node_child_process4.execSync)("tsc --noEmit", {
529
+ console.log("Checking TypeScript...");
530
+ await execPromise("tsc --noEmit", {
523
531
  cwd: process.cwd(),
524
532
  env: {
525
533
  ...process.env
526
534
  },
527
535
  gid: process.getgid(),
528
- uid: process.getuid(),
529
- stdio: "inherit"
536
+ uid: process.getuid()
530
537
  });
531
- } catch {
532
- console.log(import_chalk8.default.red.bold("TypeScript compilation failed"));
538
+ console.log(import_chalk10.default.green.bold("TypeScript check passed"));
539
+ } catch (error) {
540
+ console.log(import_chalk10.default.red.bold("TypeScript compilation failed"));
541
+ console.log(error.stderr || error.stdout || error.message);
533
542
  process.exit(1);
534
543
  }
535
544
  }
536
545
 
546
+ // src/build/index.ts
547
+ async function build_default(options) {
548
+ console.log(import_chalk11.default.bold(`Building Orionjs App ${import_chalk11.default.green(import_chalk11.default.bold("V4"))}...`));
549
+ if (!options.output) {
550
+ options.output = "./build";
551
+ }
552
+ await cleanDirectory(options.output);
553
+ await Promise.all([checkTs(), build2(options)]);
554
+ console.log(import_chalk11.default.bold("Build completed"));
555
+ }
556
+
537
557
  // src/prod/index.ts
538
- async function prod_default(_, command) {
539
- console.log(import_chalk9.default.bold(`
540
- Orionjs App ${import_chalk9.default.green(import_chalk9.default.bold("V4"))} Prod mode
558
+ async function prod_default(options, command) {
559
+ console.log(import_chalk12.default.bold(`
560
+ Orionjs App ${import_chalk12.default.green(import_chalk12.default.bold("V4"))} Prod mode
541
561
  `));
542
- checkTs();
543
- runProd(command);
562
+ if (!options.path) {
563
+ await build_default({ output: "./build" });
564
+ options.path = "./build";
565
+ }
566
+ runProd(options, command);
544
567
  }
545
568
 
546
569
  // src/handleErrors.ts
547
- var import_chalk10 = __toESM(require("chalk"), 1);
570
+ var import_chalk13 = __toESM(require("chalk"), 1);
548
571
  process.on("unhandledRejection", (error) => {
549
572
  if (error.codeFrame) {
550
- console.error(import_chalk10.default.red(error.message));
573
+ console.error(import_chalk13.default.red(error.message));
551
574
  console.log(error.codeFrame);
552
575
  } else {
553
- console.error(import_chalk10.default.red(error.message), import_chalk10.default.red("Unhandled promise rejection"));
576
+ console.error(import_chalk13.default.red(error.message), import_chalk13.default.red("Unhandled promise rejection"));
554
577
  }
555
578
  }).on("uncaughtException", (error) => {
556
- console.error(import_chalk10.default.red(error.message));
579
+ console.error(import_chalk13.default.red(error.message));
557
580
  process.exit(1);
558
581
  });
559
582
 
@@ -564,10 +587,10 @@ var version_default = "3.0";
564
587
  var import_config = require("dotenv/config");
565
588
 
566
589
  // src/check/index.ts
567
- var import_chalk12 = __toESM(require("chalk"), 1);
590
+ var import_chalk15 = __toESM(require("chalk"), 1);
568
591
 
569
592
  // src/check/checkTs.ts
570
- var import_chalk11 = __toESM(require("chalk"), 1);
593
+ var import_chalk14 = __toESM(require("chalk"), 1);
571
594
  var import_node_child_process5 = require("child_process");
572
595
  function checkTs2() {
573
596
  try {
@@ -581,54 +604,18 @@ function checkTs2() {
581
604
  stdio: "inherit"
582
605
  });
583
606
  } catch {
584
- console.log(import_chalk11.default.red.bold("TypeScript compilation failed"));
607
+ console.log(import_chalk14.default.red.bold("TypeScript compilation failed"));
585
608
  process.exit(1);
586
609
  }
587
610
  }
588
611
 
589
612
  // src/check/index.ts
590
613
  async function check_default() {
591
- console.log(import_chalk12.default.bold(`Orionjs App ${import_chalk12.default.green(import_chalk12.default.bold("V4"))}
614
+ console.log(import_chalk15.default.bold(`Orionjs App ${import_chalk15.default.green(import_chalk15.default.bold("V4"))}
592
615
  `));
593
616
  console.log("Checking typescript...");
594
617
  checkTs2();
595
- console.log(import_chalk12.default.bold.green("Check passed\n"));
596
- }
597
-
598
- // src/build/index.ts
599
- var import_chalk13 = __toESM(require("chalk"), 1);
600
-
601
- // src/build/build.ts
602
- var import_esbuild_plugin_typecheck = require("@jgoz/esbuild-plugin-typecheck");
603
- var esbuild = __toESM(require("esbuild"), 1);
604
- async function build2(options) {
605
- const { output } = options;
606
- console.log(`Building with esbuild to ${output}`);
607
- await esbuild.build({
608
- entryPoints: ["./app/index.ts"],
609
- tsconfig: "./tsconfig.json",
610
- format: "esm",
611
- platform: "node",
612
- outdir: output,
613
- bundle: true,
614
- target: "node22",
615
- sourcemap: true,
616
- allowOverwrite: true,
617
- minify: true,
618
- packages: "external",
619
- plugins: [(0, import_esbuild_plugin_typecheck.typecheckPlugin)()]
620
- });
621
- }
622
-
623
- // src/build/index.ts
624
- async function build_default(options) {
625
- console.log(import_chalk13.default.bold(`Building Orionjs App ${import_chalk13.default.green(import_chalk13.default.bold("V4"))}...`));
626
- if (!options.output) {
627
- options.output = "./build";
628
- }
629
- await cleanDirectory(options.output);
630
- await build2(options);
631
- console.log(import_chalk13.default.bold("Build successful"));
618
+ console.log(import_chalk15.default.bold.green("Check passed\n"));
632
619
  }
633
620
 
634
621
  // src/index.ts
@@ -637,13 +624,16 @@ var run = (action) => async (...args) => {
637
624
  try {
638
625
  await action(...args);
639
626
  } catch (e) {
640
- console.error(import_chalk14.default.red(`Error: ${e.message}`));
627
+ console.error(import_chalk16.default.red(`Error: ${e.message}`));
641
628
  }
642
629
  };
643
- program.command("dev").description("Run the Orionjs app in development mode").option("--shell", "Opens a shell in Chrome developer tools").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
+ 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));
644
631
  program.command("check").description("Runs a typescript check").action(run(check_default));
645
632
  program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
646
- program.command("prod").allowUnknownOption().description("Run the Orionjs app in production mode").action(run(prod_default));
633
+ program.command("prod").allowUnknownOption().option(
634
+ "--path [path]",
635
+ "Path of the compiled Orionjs app. If not provided, the app will be compiled and then run"
636
+ ).description("Run the Orionjs app in production mode").action(run(prod_default));
647
637
  program.command("create").description("Creates a new Orionjs project").option("--name [name]", "Name of the project").option("--kit [kit]", "Which starter kit to use").action(run(create_default));
648
638
  program.version(version_default, "-v --version");
649
639
  program.parse(process.argv);