@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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import chalk14 from "chalk";
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 chalk from "chalk";
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(path7, content) {
55
- ensureDirectory_default(path7);
56
- fs2.writeFileSync(path7, content);
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(options, command) {
64
- let startCommand = process.env.START_COMMAND || "tsx";
63
+ function getArgs(_options, command) {
64
+ const startCommand = "tsx";
65
65
  const args = [];
66
- if (process.env.START_COMMAND) {
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(chalk.bold("=> Cleaning directory...\n"));
93
+ console.log(chalk2.bold("=> Cleaning directory...\n"));
98
94
  }
99
- const start = () => {
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(chalk.bold(`=> Error running app. Exit code: ${code}`));
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
- start();
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 chalk2 from "chalk";
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(chalk2.bold(`=> ${diagnostic.messageText}`));
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.restart();
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 chalk3 from "chalk";
271
- import chokidar2 from "chokidar";
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
- chokidar2.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
278
- console.log(chalk3.bold("=> Environment file changed. Restarting..."));
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 fs6 from "fs/promises";
273
+ import fs5 from "fs/promises";
295
274
  import https from "https";
296
- import path4 from "path";
297
- import chalk4 from "chalk";
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 = path4.join(process.cwd(), ".cursor", "rules");
331
- await fs6.mkdir(targetDir, { recursive: true });
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 = path4.join(targetDir, targetFileName);
314
+ const targetFile = path3.join(targetDir, targetFileName);
336
315
  const sourceUrl = `${baseUrl}/${rule}`;
337
316
  const content = await downloadFile(sourceUrl);
338
- await fs6.writeFile(targetFile, content, "utf8");
339
- console.log(chalk4.bold(`=> \u2728 Successfully downloaded ${chalk4.cyan(targetFileName)}`));
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(chalk4.bold("=> \u2728 All rule files have been successfully copied"));
321
+ console.log(chalk5.bold("=> \u2728 All rule files have been successfully copied"));
343
322
  } catch (error) {
344
- console.error(chalk4.red(`Error copying rule files: ${error.message}`));
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 fs8 from "fs/promises";
350
- import path6 from "path";
351
- import chalk6 from "chalk";
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 fs7 from "fs/promises";
359
- import path5 from "path";
360
- import chalk5 from "chalk";
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 fs7.stat(directoryPath);
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 fs7.access(path5.join(directoryPath, file));
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 = path5.join(directoryPath, VERSION_FILE);
375
- const versionContent = await fs7.readFile(versionPath, "utf-8");
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
- chalk5.yellow(
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 = path6.join(process.cwd(), ".orion", "mcp");
375
+ const targetDir = path5.join(process.cwd(), ".orion", "mcp");
397
376
  try {
398
- await fs8.mkdir(path6.join(process.cwd(), ".orion"), { recursive: true });
377
+ await fs7.mkdir(path5.join(process.cwd(), ".orion"), { recursive: true });
399
378
  if (await isValidMCPRepository(targetDir)) {
400
- console.log(chalk6.bold("=> \u2728 MCP documentation already installed"));
379
+ console.log(chalk7.bold("=> \u2728 MCP documentation already installed"));
401
380
  return;
402
381
  }
403
382
  try {
404
- const stats = await fs8.stat(targetDir);
383
+ const stats = await fs7.stat(targetDir);
405
384
  if (stats.isDirectory()) {
406
- await fs8.rm(targetDir, { recursive: true, force: true });
385
+ await fs7.rm(targetDir, { recursive: true, force: true });
407
386
  console.log(
408
- chalk6.bold(
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(chalk6.bold(`=> \u2728 Downloading MCP documentation ${MCP_VERSION}...`));
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 ${path6.join(targetDir, ".git")}`);
418
- await fs8.writeFile(path6.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
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
- chalk6.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
399
+ chalk7.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
421
400
  );
422
- console.log(chalk6.bold("=> \u2728 Installing MCP dependencies..."));
401
+ console.log(chalk7.bold("=> \u2728 Installing MCP dependencies..."));
423
402
  await execute_default(`cd ${targetDir} && npm install`);
424
- console.log(chalk6.bold("=> \u2728 Successfully installed MCP dependencies"));
425
- const relativePath = path6.relative(process.cwd(), targetDir);
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: [`./${path6.join(relativePath, "src", "index.js")}`]
410
+ args: [`./${path5.join(relativePath, "src", "index.js")}`]
432
411
  }
433
412
  }
434
413
  };
435
- const configPath = path6.join(process.cwd(), ".cursor", "mcp.json");
414
+ const configPath = path5.join(process.cwd(), ".cursor", "mcp.json");
436
415
  try {
437
- const existingConfig = await fs8.readFile(configPath, "utf-8");
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 fs8.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), "utf-8");
444
- console.log(chalk6.bold("=> \u2728 Updated MCP server configuration in .cursor/mcp.json"));
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 fs8.mkdir(path6.dirname(configPath), { recursive: true });
447
- await fs8.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), "utf-8");
448
- console.log(chalk6.bold("=> \u2728 Created new MCP server configuration in .cursor/mcp.json"));
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(chalk6.red("=> \u2728 Error copying MCP documentation:"), 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 chalk7 from "chalk";
436
+ import chalk8 from "chalk";
458
437
  async function dev_default(options, command) {
459
- console.log(chalk7.bold(`
460
- Orionjs App ${chalk7.green(chalk7.bold("V4"))} Dev mode
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,20 +445,21 @@ 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(chalk7.bold("=> \u2728 Orionjs AI is ready\n"));
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 chalk9 from "chalk";
455
+ import chalk12 from "chalk";
477
456
 
478
457
  // src/prod/runProd.ts
479
458
  import { spawn as spawn2 } from "child_process";
480
- function runProd(command) {
481
- const args = [...command.args, "./app/index.ts"];
482
- spawn2("tsx", args, {
459
+ function runProd(options, command) {
460
+ const indexPath = `${options.path}/index.js`;
461
+ const args = ["--import=tsx", ...command.args, indexPath];
462
+ spawn2("node", args, {
483
463
  env: {
484
464
  NODE_ENV: "production",
485
465
  ...process.env
@@ -492,46 +472,89 @@ function runProd(command) {
492
472
  });
493
473
  }
494
474
 
495
- // src/prod/checkTs.ts
496
- import chalk8 from "chalk";
497
- import { execSync } from "child_process";
498
- function checkTs() {
475
+ // src/build/index.ts
476
+ import chalk11 from "chalk";
477
+
478
+ // src/build/build.ts
479
+ import chalk9 from "chalk";
480
+ import * as esbuild from "esbuild";
481
+ async function build2(options) {
482
+ const { output } = options;
483
+ console.log(`Building with esbuild to ${output}`);
484
+ await esbuild.build({
485
+ entryPoints: ["./app/index.ts"],
486
+ tsconfig: "./tsconfig.json",
487
+ format: "esm",
488
+ platform: "node",
489
+ outdir: output,
490
+ bundle: true,
491
+ target: "node22",
492
+ sourcemap: true,
493
+ allowOverwrite: true,
494
+ minify: true,
495
+ packages: "external"
496
+ });
497
+ console.log(chalk9.green.bold("Build successful"));
498
+ }
499
+
500
+ // src/build/checkTs.ts
501
+ import chalk10 from "chalk";
502
+ import { exec as exec2 } from "child_process";
503
+ import { promisify } from "util";
504
+ var execPromise = promisify(exec2);
505
+ async function checkTs() {
499
506
  try {
500
- execSync("tsc --noEmit", {
507
+ console.log("Checking TypeScript...");
508
+ await execPromise("tsc --noEmit", {
501
509
  cwd: process.cwd(),
502
510
  env: {
503
511
  ...process.env
504
512
  },
505
513
  gid: process.getgid(),
506
- uid: process.getuid(),
507
- stdio: "inherit"
514
+ uid: process.getuid()
508
515
  });
509
- } catch {
510
- console.log(chalk8.red.bold("TypeScript compilation failed"));
516
+ console.log(chalk10.green.bold("TypeScript check passed"));
517
+ } catch (error) {
518
+ console.log(chalk10.red.bold("TypeScript compilation failed"));
519
+ console.log(error.stderr || error.stdout || error.message);
511
520
  process.exit(1);
512
521
  }
513
522
  }
514
523
 
524
+ // src/build/index.ts
525
+ async function build_default(options) {
526
+ console.log(chalk11.bold(`Building Orionjs App ${chalk11.green(chalk11.bold("V4"))}...`));
527
+ if (!options.output) {
528
+ options.output = "./build";
529
+ }
530
+ await cleanDirectory(options.output);
531
+ await Promise.all([checkTs(), build2(options)]);
532
+ console.log(chalk11.bold("Build completed"));
533
+ }
534
+
515
535
  // src/prod/index.ts
516
- async function prod_default(_, command) {
517
- console.log(chalk9.bold(`
518
- Orionjs App ${chalk9.green(chalk9.bold("V4"))} Prod mode
536
+ async function prod_default(options, command) {
537
+ console.log(chalk12.bold(`
538
+ Orionjs App ${chalk12.green(chalk12.bold("V4"))} Prod mode
519
539
  `));
520
- checkTs();
521
- runProd(command);
540
+ if (!options.path) {
541
+ await build_default({ output: "./build" });
542
+ options.path = "./build";
543
+ }
544
+ runProd(options, command);
522
545
  }
523
546
 
524
547
  // src/handleErrors.ts
525
- import chalk10 from "chalk";
548
+ import chalk13 from "chalk";
526
549
  process.on("unhandledRejection", (error) => {
527
550
  if (error.codeFrame) {
528
- console.error(chalk10.red(error.message));
551
+ console.error(chalk13.red(error.message));
529
552
  console.log(error.codeFrame);
530
553
  } else {
531
- console.error(chalk10.red(error.message), chalk10.red("Unhandled promise rejection"));
554
+ console.error(chalk13.red(error.message), chalk13.red("Unhandled promise rejection"));
532
555
  }
533
556
  }).on("uncaughtException", (error) => {
534
- console.error(chalk10.red(error.message));
557
+ console.error(chalk13.red(error.message));
535
558
  process.exit(1);
536
559
  });
537
560
 
@@ -542,14 +565,14 @@ var version_default = "3.0";
542
565
  import "dotenv/config";
543
566
 
544
567
  // src/check/index.ts
545
- import chalk12 from "chalk";
568
+ import chalk15 from "chalk";
546
569
 
547
570
  // src/check/checkTs.ts
548
- import chalk11 from "chalk";
549
- import { execSync as execSync2 } from "child_process";
571
+ import chalk14 from "chalk";
572
+ import { execSync } from "child_process";
550
573
  function checkTs2() {
551
574
  try {
552
- execSync2("tsc --noEmit", {
575
+ execSync("tsc --noEmit", {
553
576
  cwd: process.cwd(),
554
577
  env: {
555
578
  ...process.env
@@ -559,54 +582,18 @@ function checkTs2() {
559
582
  stdio: "inherit"
560
583
  });
561
584
  } catch {
562
- console.log(chalk11.red.bold("TypeScript compilation failed"));
585
+ console.log(chalk14.red.bold("TypeScript compilation failed"));
563
586
  process.exit(1);
564
587
  }
565
588
  }
566
589
 
567
590
  // src/check/index.ts
568
591
  async function check_default() {
569
- console.log(chalk12.bold(`Orionjs App ${chalk12.green(chalk12.bold("V4"))}
592
+ console.log(chalk15.bold(`Orionjs App ${chalk15.green(chalk15.bold("V4"))}
570
593
  `));
571
594
  console.log("Checking typescript...");
572
595
  checkTs2();
573
- console.log(chalk12.bold.green("Check passed\n"));
574
- }
575
-
576
- // src/build/index.ts
577
- import chalk13 from "chalk";
578
-
579
- // src/build/build.ts
580
- import { typecheckPlugin } from "@jgoz/esbuild-plugin-typecheck";
581
- import * as esbuild from "esbuild";
582
- async function build2(options) {
583
- const { output } = options;
584
- console.log(`Building with esbuild to ${output}`);
585
- await esbuild.build({
586
- entryPoints: ["./app/index.ts"],
587
- tsconfig: "./tsconfig.json",
588
- format: "esm",
589
- platform: "node",
590
- outdir: output,
591
- bundle: true,
592
- target: "node22",
593
- sourcemap: true,
594
- allowOverwrite: true,
595
- minify: true,
596
- packages: "external",
597
- plugins: [typecheckPlugin()]
598
- });
599
- }
600
-
601
- // src/build/index.ts
602
- async function build_default(options) {
603
- console.log(chalk13.bold(`Building Orionjs App ${chalk13.green(chalk13.bold("V4"))}...`));
604
- if (!options.output) {
605
- options.output = "./build";
606
- }
607
- await cleanDirectory(options.output);
608
- await build2(options);
609
- console.log(chalk13.bold("Build successful"));
596
+ console.log(chalk15.bold.green("Check passed\n"));
610
597
  }
611
598
 
612
599
  // src/index.ts
@@ -615,13 +602,16 @@ var run = (action) => async (...args) => {
615
602
  try {
616
603
  await action(...args);
617
604
  } catch (e) {
618
- console.error(chalk14.red(`Error: ${e.message}`));
605
+ console.error(chalk16.red(`Error: ${e.message}`));
619
606
  }
620
607
  };
621
- 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));
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));
622
609
  program.command("check").description("Runs a typescript check").action(run(check_default));
623
610
  program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
624
- program.command("prod").allowUnknownOption().description("Run the Orionjs app in production mode").action(run(prod_default));
611
+ program.command("prod").allowUnknownOption().option(
612
+ "--path [path]",
613
+ "Path of the compiled Orionjs app. If not provided, the app will be compiled and then run"
614
+ ).description("Run the Orionjs app in production mode").action(run(prod_default));
625
615
  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));
626
616
  program.version(version_default, "-v --version");
627
617
  program.parse(process.argv);