@orion-js/core 4.2.3 → 4.2.4
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 +31 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -141
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
|
|
25
25
|
// src/index.ts
|
|
26
|
-
var
|
|
26
|
+
var import_chalk13 = __toESM(require("chalk"), 1);
|
|
27
27
|
var import_commander = require("commander");
|
|
28
28
|
|
|
29
29
|
// src/helpers/execute.ts
|
|
@@ -55,6 +55,9 @@ async function create_default({ name, kit }) {
|
|
|
55
55
|
console.log("Your starter kit is ready");
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
// src/dev/index.ts
|
|
59
|
+
var import_chalk5 = __toESM(require("chalk"), 1);
|
|
60
|
+
|
|
58
61
|
// src/dev/runner/index.ts
|
|
59
62
|
var import_chalk2 = __toESM(require("chalk"), 1);
|
|
60
63
|
|
|
@@ -73,9 +76,9 @@ var ensureDirectory = (filePath) => {
|
|
|
73
76
|
var ensureDirectory_default = ensureDirectory;
|
|
74
77
|
|
|
75
78
|
// src/helpers/writeFile.ts
|
|
76
|
-
async function writeFile_default(
|
|
77
|
-
ensureDirectory_default(
|
|
78
|
-
import_node_fs2.default.writeFileSync(
|
|
79
|
+
async function writeFile_default(path3, content) {
|
|
80
|
+
ensureDirectory_default(path3);
|
|
81
|
+
import_node_fs2.default.writeFileSync(path3, content);
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
// src/dev/runner/startProcess.ts
|
|
@@ -306,130 +309,17 @@ async function watchAndCompile(runner) {
|
|
|
306
309
|
watchEnvFile(runner);
|
|
307
310
|
}
|
|
308
311
|
|
|
309
|
-
// src/dev/copyMCP/index.ts
|
|
310
|
-
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
311
|
-
var import_node_path4 = __toESM(require("path"), 1);
|
|
312
|
-
var import_chalk6 = __toESM(require("chalk"), 1);
|
|
313
|
-
|
|
314
|
-
// src/dev/copyMCP/consts.ts
|
|
315
|
-
var MCP_VERSION = "v4";
|
|
316
|
-
var VERSION_FILE = "version.txt";
|
|
317
|
-
|
|
318
|
-
// src/dev/copyMCP/isValidMCPRepo.ts
|
|
319
|
-
var import_promises = __toESM(require("fs/promises"), 1);
|
|
320
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
|
321
|
-
var import_chalk5 = __toESM(require("chalk"), 1);
|
|
322
|
-
async function isValidMCPRepository(directoryPath) {
|
|
323
|
-
try {
|
|
324
|
-
const stats = await import_promises.default.stat(directoryPath);
|
|
325
|
-
if (!stats.isDirectory()) return false;
|
|
326
|
-
const expectedFiles = ["settings.js", "package.json"];
|
|
327
|
-
for (const file of expectedFiles) {
|
|
328
|
-
try {
|
|
329
|
-
await import_promises.default.access(import_node_path3.default.join(directoryPath, file));
|
|
330
|
-
} catch {
|
|
331
|
-
return false;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
try {
|
|
335
|
-
const versionPath = import_node_path3.default.join(directoryPath, VERSION_FILE);
|
|
336
|
-
const versionContent = await import_promises.default.readFile(versionPath, "utf-8");
|
|
337
|
-
if (versionContent.trim() !== MCP_VERSION) {
|
|
338
|
-
console.log(
|
|
339
|
-
import_chalk5.default.yellow(
|
|
340
|
-
`=> \u2728 MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`
|
|
341
|
-
)
|
|
342
|
-
);
|
|
343
|
-
return false;
|
|
344
|
-
}
|
|
345
|
-
} catch {
|
|
346
|
-
return false;
|
|
347
|
-
}
|
|
348
|
-
return true;
|
|
349
|
-
} catch {
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// src/dev/copyMCP/index.ts
|
|
355
|
-
async function copyMCP() {
|
|
356
|
-
const repoUrl = "https://github.com/orionjs/mcp-docs";
|
|
357
|
-
const targetDir = import_node_path4.default.join(process.cwd(), ".orion", "mcp");
|
|
358
|
-
try {
|
|
359
|
-
await import_promises2.default.mkdir(import_node_path4.default.join(process.cwd(), ".orion"), { recursive: true });
|
|
360
|
-
if (await isValidMCPRepository(targetDir)) {
|
|
361
|
-
console.log(import_chalk6.default.bold("=> \u2728 MCP documentation already installed"));
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
try {
|
|
365
|
-
const stats = await import_promises2.default.stat(targetDir);
|
|
366
|
-
if (stats.isDirectory()) {
|
|
367
|
-
await import_promises2.default.rm(targetDir, { recursive: true, force: true });
|
|
368
|
-
console.log(
|
|
369
|
-
import_chalk6.default.bold(
|
|
370
|
-
"=> \u2728 Removed existing .orion/mcp directory (invalid, incomplete, or outdated)"
|
|
371
|
-
)
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
} catch (_) {
|
|
375
|
-
}
|
|
376
|
-
console.log(import_chalk6.default.bold(`=> \u2728 Downloading MCP documentation ${MCP_VERSION}...`));
|
|
377
|
-
await execute_default(`git clone ${repoUrl} ${targetDir}`);
|
|
378
|
-
await execute_default(`rm -rf ${import_node_path4.default.join(targetDir, ".git")}`);
|
|
379
|
-
await import_promises2.default.writeFile(import_node_path4.default.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
|
|
380
|
-
console.log(
|
|
381
|
-
import_chalk6.default.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
|
|
382
|
-
);
|
|
383
|
-
console.log(import_chalk6.default.bold("=> \u2728 Installing MCP dependencies..."));
|
|
384
|
-
await execute_default(`cd ${targetDir} && npm install`);
|
|
385
|
-
console.log(import_chalk6.default.bold("=> \u2728 Successfully installed MCP dependencies"));
|
|
386
|
-
const relativePath = import_node_path4.default.relative(process.cwd(), targetDir);
|
|
387
|
-
console.log(relativePath);
|
|
388
|
-
const mcpServerConfig = {
|
|
389
|
-
mcpServers: {
|
|
390
|
-
"Orionjs documentation search": {
|
|
391
|
-
command: "node",
|
|
392
|
-
args: [`./${import_node_path4.default.join(relativePath, "src", "index.js")}`]
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
const configPath = import_node_path4.default.join(process.cwd(), ".cursor", "mcp.json");
|
|
397
|
-
try {
|
|
398
|
-
const existingConfig = await import_promises2.default.readFile(configPath, "utf-8");
|
|
399
|
-
const parsedConfig = JSON.parse(existingConfig);
|
|
400
|
-
parsedConfig.mcpServers = {
|
|
401
|
-
...parsedConfig.mcpServers,
|
|
402
|
-
...mcpServerConfig.mcpServers
|
|
403
|
-
};
|
|
404
|
-
await import_promises2.default.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), "utf-8");
|
|
405
|
-
console.log(import_chalk6.default.bold("=> \u2728 Updated MCP server configuration in .cursor/mcp.json"));
|
|
406
|
-
} catch (_) {
|
|
407
|
-
await import_promises2.default.mkdir(import_node_path4.default.dirname(configPath), { recursive: true });
|
|
408
|
-
await import_promises2.default.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), "utf-8");
|
|
409
|
-
console.log(import_chalk6.default.bold("=> \u2728 Created new MCP server configuration in .cursor/mcp.json"));
|
|
410
|
-
}
|
|
411
|
-
} catch (error) {
|
|
412
|
-
console.error(import_chalk6.default.red("=> \u2728 Error copying MCP documentation:"), error);
|
|
413
|
-
throw error;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
312
|
// src/dev/index.ts
|
|
418
|
-
var import_chalk7 = __toESM(require("chalk"), 1);
|
|
419
313
|
async function dev_default(options, command) {
|
|
420
|
-
console.log(
|
|
421
|
-
Orionjs App ${
|
|
314
|
+
console.log(import_chalk5.default.bold(`
|
|
315
|
+
Orionjs App ${import_chalk5.default.green(import_chalk5.default.bold("V4"))} Dev mode
|
|
422
316
|
`));
|
|
423
|
-
if (!options.omitMcpServer) {
|
|
424
|
-
await copyMCP().catch(console.error);
|
|
425
|
-
console.log(import_chalk7.default.bold("=> \u2728 Orionjs AI is ready\n"));
|
|
426
|
-
}
|
|
427
317
|
const runner = getRunner(options, command);
|
|
428
318
|
watchAndCompile(runner);
|
|
429
319
|
}
|
|
430
320
|
|
|
431
321
|
// src/prod/index.ts
|
|
432
|
-
var
|
|
322
|
+
var import_chalk9 = __toESM(require("chalk"), 1);
|
|
433
323
|
|
|
434
324
|
// src/prod/runProd.ts
|
|
435
325
|
var import_node_child_process3 = require("child_process");
|
|
@@ -450,10 +340,10 @@ function runProd(options, command) {
|
|
|
450
340
|
}
|
|
451
341
|
|
|
452
342
|
// src/build/index.ts
|
|
453
|
-
var
|
|
343
|
+
var import_chalk8 = __toESM(require("chalk"), 1);
|
|
454
344
|
|
|
455
345
|
// src/build/build.ts
|
|
456
|
-
var
|
|
346
|
+
var import_chalk6 = __toESM(require("chalk"), 1);
|
|
457
347
|
var esbuild = __toESM(require("esbuild"), 1);
|
|
458
348
|
async function build2(options) {
|
|
459
349
|
const { output } = options;
|
|
@@ -471,11 +361,11 @@ async function build2(options) {
|
|
|
471
361
|
minify: true,
|
|
472
362
|
packages: "external"
|
|
473
363
|
});
|
|
474
|
-
console.log(
|
|
364
|
+
console.log(import_chalk6.default.green.bold("Build successful"));
|
|
475
365
|
}
|
|
476
366
|
|
|
477
367
|
// src/build/checkTs.ts
|
|
478
|
-
var
|
|
368
|
+
var import_chalk7 = __toESM(require("chalk"), 1);
|
|
479
369
|
var import_node_child_process4 = require("child_process");
|
|
480
370
|
var import_node_util = require("util");
|
|
481
371
|
var execPromise = (0, import_node_util.promisify)(import_node_child_process4.exec);
|
|
@@ -490,9 +380,9 @@ async function checkTs() {
|
|
|
490
380
|
gid: process.getgid(),
|
|
491
381
|
uid: process.getuid()
|
|
492
382
|
});
|
|
493
|
-
console.log(
|
|
383
|
+
console.log(import_chalk7.default.green.bold("TypeScript check passed"));
|
|
494
384
|
} catch (error) {
|
|
495
|
-
console.log(
|
|
385
|
+
console.log(import_chalk7.default.red.bold("TypeScript compilation failed"));
|
|
496
386
|
console.log(error.stderr || error.stdout || error.message);
|
|
497
387
|
process.exit(1);
|
|
498
388
|
}
|
|
@@ -500,20 +390,20 @@ async function checkTs() {
|
|
|
500
390
|
|
|
501
391
|
// src/build/index.ts
|
|
502
392
|
async function build_default(options) {
|
|
503
|
-
console.log(
|
|
393
|
+
console.log(import_chalk8.default.bold(`Building Orionjs App ${import_chalk8.default.green(import_chalk8.default.bold("V4"))}...`));
|
|
504
394
|
if (!options.output) {
|
|
505
395
|
options.output = "./build";
|
|
506
396
|
}
|
|
507
397
|
await cleanDirectory(options.output);
|
|
508
398
|
await checkTs();
|
|
509
399
|
await build2(options);
|
|
510
|
-
console.log(
|
|
400
|
+
console.log(import_chalk8.default.bold("Build completed"));
|
|
511
401
|
}
|
|
512
402
|
|
|
513
403
|
// src/prod/index.ts
|
|
514
404
|
async function prod_default(options, command) {
|
|
515
|
-
console.log(
|
|
516
|
-
Orionjs App ${
|
|
405
|
+
console.log(import_chalk9.default.bold(`
|
|
406
|
+
Orionjs App ${import_chalk9.default.green(import_chalk9.default.bold("V4"))} Prod mode
|
|
517
407
|
`));
|
|
518
408
|
if (!options.path) {
|
|
519
409
|
await build_default({ output: "./build" });
|
|
@@ -523,16 +413,16 @@ Orionjs App ${import_chalk11.default.green(import_chalk11.default.bold("V4"))} P
|
|
|
523
413
|
}
|
|
524
414
|
|
|
525
415
|
// src/handleErrors.ts
|
|
526
|
-
var
|
|
416
|
+
var import_chalk10 = __toESM(require("chalk"), 1);
|
|
527
417
|
process.on("unhandledRejection", (error) => {
|
|
528
418
|
if (error.codeFrame) {
|
|
529
|
-
console.error(
|
|
419
|
+
console.error(import_chalk10.default.red(error.message));
|
|
530
420
|
console.log(error.codeFrame);
|
|
531
421
|
} else {
|
|
532
|
-
console.error(
|
|
422
|
+
console.error(import_chalk10.default.red(error.message), import_chalk10.default.red("Unhandled promise rejection"));
|
|
533
423
|
}
|
|
534
424
|
}).on("uncaughtException", (error) => {
|
|
535
|
-
console.error(
|
|
425
|
+
console.error(import_chalk10.default.red(error.message));
|
|
536
426
|
process.exit(1);
|
|
537
427
|
});
|
|
538
428
|
|
|
@@ -543,10 +433,10 @@ var version_default = "3.0";
|
|
|
543
433
|
var import_config = require("dotenv/config");
|
|
544
434
|
|
|
545
435
|
// src/check/index.ts
|
|
546
|
-
var
|
|
436
|
+
var import_chalk12 = __toESM(require("chalk"), 1);
|
|
547
437
|
|
|
548
438
|
// src/check/checkTs.ts
|
|
549
|
-
var
|
|
439
|
+
var import_chalk11 = __toESM(require("chalk"), 1);
|
|
550
440
|
var import_node_child_process5 = require("child_process");
|
|
551
441
|
function checkTs2() {
|
|
552
442
|
try {
|
|
@@ -560,18 +450,18 @@ function checkTs2() {
|
|
|
560
450
|
stdio: "inherit"
|
|
561
451
|
});
|
|
562
452
|
} catch {
|
|
563
|
-
console.log(
|
|
453
|
+
console.log(import_chalk11.default.red.bold("TypeScript compilation failed"));
|
|
564
454
|
process.exit(1);
|
|
565
455
|
}
|
|
566
456
|
}
|
|
567
457
|
|
|
568
458
|
// src/check/index.ts
|
|
569
459
|
async function check_default() {
|
|
570
|
-
console.log(
|
|
460
|
+
console.log(import_chalk12.default.bold(`Orionjs App ${import_chalk12.default.green(import_chalk12.default.bold("V4"))}
|
|
571
461
|
`));
|
|
572
462
|
console.log("Checking typescript...");
|
|
573
463
|
checkTs2();
|
|
574
|
-
console.log(
|
|
464
|
+
console.log(import_chalk12.default.bold.green("Check passed\n"));
|
|
575
465
|
}
|
|
576
466
|
|
|
577
467
|
// src/index.ts
|
|
@@ -580,10 +470,10 @@ var run = (action) => async (...args) => {
|
|
|
580
470
|
try {
|
|
581
471
|
await action(...args);
|
|
582
472
|
} catch (e) {
|
|
583
|
-
console.error(
|
|
473
|
+
console.error(import_chalk13.default.red(`Error: ${e.message}`));
|
|
584
474
|
}
|
|
585
475
|
};
|
|
586
|
-
program.command("dev").description("Run the Orionjs app in development mode").
|
|
476
|
+
program.command("dev").description("Run the Orionjs app in development mode").allowUnknownOption().action(run(dev_default));
|
|
587
477
|
program.command("check").description("Runs a typescript check").action(run(check_default));
|
|
588
478
|
program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
|
|
589
479
|
program.command("prod").allowUnknownOption().option(
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/index.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/reports.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/copyMCP/index.ts","../src/dev/copyMCP/consts.ts","../src/dev/copyMCP/isValidMCPRepo.ts","../src/dev/index.ts","../src/prod/index.ts","../src/prod/runProd.ts","../src/build/index.ts","../src/build/build.ts","../src/build/checkTs.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport check from './check'\nimport build from './build'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--omit-mcp-server', 'Omit the creation of the Orionjs MCP server')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('build')\n .description('Build the Orionjs app for production')\n .option('--output [path]', 'Path of the output file')\n .action(run(build))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .option(\n '--path [path]',\n 'Path of the compiled Orionjs app. If not provided, the app will be compiled and then run',\n )\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n // omit the creation of the orion mcp server\n omitMcpServer?: boolean\n}\n\nexport interface Runner {\n start: () => void\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const startApp = () => {\n appProcess = startProcess(options, command)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n appProcess = null\n }\n }\n\n const restart = () => {\n console.log(chalk.bold('=> Restarting app...\\n'))\n stop()\n startApp()\n }\n\n const start = () => {\n // check if the app is already running\n if (appProcess) {\n // console.log(chalk.bold('=> App is already running. Restarting...\\n'))\n } else {\n startApp()\n }\n }\n\n return {\n restart,\n stop,\n start,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\nimport chalk from 'chalk'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n console.log(chalk.bold(`=> Starting app with command: ${startCommand} ${args.join(' ')}...\\n`))\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from '.'\n\nexport function getArgs(_options: RunnerOptions, command: any) {\n const startCommand = 'tsx'\n\n const args = []\n\n args.push('watch', '--clear-screen=false')\n\n args.push(...command.args)\n\n args.push('./app/index.ts')\n\n return {startCommand, args}\n}\n","import ts from 'typescript'\nimport {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n const host = getHost(runner)\n ts.createWatchProgram(host)\n watchEnvFile(runner)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory(directory?: string) {\n try {\n const dirPath = directory ? directory : path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import ts from 'typescript'\nimport {getConfigPath} from './getConfigPath'\nimport {reportDiagnostic} from './reports'\nimport {Runner} from '../runner'\nimport chalk from 'chalk'\n\nexport function getHost(runner: Runner) {\n let isStopped = true\n const reportWatchStatusChanged = (diagnostic: ts.Diagnostic) => {\n if (diagnostic.category !== 3) return\n if (diagnostic.code === 6031 || diagnostic.code === 6032) {\n // file change detected, starting compilation\n // console.log(chalk.bold(`=> ${diagnostic.messageText}`))\n return\n }\n\n if (diagnostic.code === 6193) {\n runner.stop()\n isStopped = true\n return\n }\n\n if (diagnostic.code === 6194) {\n /**\n * Sometimes diagnostic code is 6194 even with errors\n */\n if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {\n if (!diagnostic.messageText.toString().includes('Found 0 errors.')) {\n runner.stop()\n isStopped = true\n return\n }\n }\n\n if (isStopped) {\n isStopped = false\n runner.start()\n }\n return\n }\n\n console.log(chalk.bold(`=> ${diagnostic.messageText} [${diagnostic.code}]`))\n }\n\n const configPath = getConfigPath()\n const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram\n\n const host = ts.createWatchCompilerHost(\n configPath,\n {},\n ts.sys,\n createProgram,\n reportDiagnostic,\n reportWatchStatusChanged,\n )\n\n return host\n}\n","import ts from 'typescript'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.server.json') ||\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n baseUrl?: string\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...config.compilerOptions,\n baseUrl: './',\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n // are the same, no write\n if (JSON.stringify(config) === JSON.stringify(newConfig)) {\n return\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import ts from 'typescript'\n\nconst format = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => ts.sys.newLine,\n}\nexport function reportDiagnostic(diagnostic: ts.Diagnostic) {\n console.log(ts.formatDiagnosticsWithColorAndContext([diagnostic], format))\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport execute from '../../helpers/execute'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\nimport {isValidMCPRepository} from './isValidMCPRepo'\n\nexport async function copyMCP() {\n const repoUrl = 'https://github.com/orionjs/mcp-docs'\n const targetDir = path.join(process.cwd(), '.orion', 'mcp')\n\n try {\n // Ensure parent directory exists\n await fs.mkdir(path.join(process.cwd(), '.orion'), {recursive: true})\n\n // Check if the repository is already properly installed with current version\n if (await isValidMCPRepository(targetDir)) {\n console.log(chalk.bold('=> ✨ MCP documentation already installed'))\n return\n }\n\n // Check if the directory already exists but is not a valid repository or has outdated version\n try {\n const stats = await fs.stat(targetDir)\n if (stats.isDirectory()) {\n // Directory exists, remove it first to ensure fresh clone\n await fs.rm(targetDir, {recursive: true, force: true})\n console.log(\n chalk.bold(\n '=> ✨ Removed existing .orion/mcp directory (invalid, incomplete, or outdated)',\n ),\n )\n }\n } catch (_) {\n // Directory doesn't exist, which is fine\n }\n\n // Clone the repository\n console.log(chalk.bold(`=> ✨ Downloading MCP documentation ${MCP_VERSION}...`))\n await execute(`git clone ${repoUrl} ${targetDir}`)\n\n // Remove git directory to avoid confusion\n await execute(`rm -rf ${path.join(targetDir, '.git')}`)\n\n // Create version file\n await fs.writeFile(path.join(targetDir, VERSION_FILE), MCP_VERSION, 'utf-8')\n\n console.log(\n chalk.bold(`=> ✨ Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`),\n )\n\n // Install dependencies in the MCP directory\n console.log(chalk.bold('=> ✨ Installing MCP dependencies...'))\n await execute(`cd ${targetDir} && npm install`)\n console.log(chalk.bold('=> ✨ Successfully installed MCP dependencies'))\n\n const relativePath = path.relative(process.cwd(), targetDir)\n console.log(relativePath)\n const mcpServerConfig = {\n mcpServers: {\n 'Orionjs documentation search': {\n command: 'node',\n args: [`./${path.join(relativePath, 'src', 'index.js')}`],\n },\n },\n }\n\n const configPath = path.join(process.cwd(), '.cursor', 'mcp.json')\n\n // Check if the config file exists\n try {\n // Try to read existing config file\n const existingConfig = await fs.readFile(configPath, 'utf-8')\n const parsedConfig = JSON.parse(existingConfig)\n\n // Update the mcpServers section while preserving other settings\n parsedConfig.mcpServers = {\n ...parsedConfig.mcpServers,\n ...mcpServerConfig.mcpServers,\n }\n\n // Write the updated config back\n await fs.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Updated MCP server configuration in .cursor/mcp.json'))\n } catch (_) {\n // If file doesn't exist or can't be parsed, create a new one\n // Ensure the .cursor directory exists\n await fs.mkdir(path.dirname(configPath), {recursive: true})\n\n // Write the new config file\n await fs.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Created new MCP server configuration in .cursor/mcp.json'))\n }\n } catch (error) {\n console.error(chalk.red('=> ✨ Error copying MCP documentation:'), error)\n throw error\n }\n}\n","// Define current MCP version - update this when a new version needs to be deployed\nexport const MCP_VERSION = 'v4'\nexport const VERSION_FILE = 'version.txt'\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\n\n/**\n * Checks if the MCP repository appears to be already installed correctly\n * and has the current version\n */\nexport async function isValidMCPRepository(directoryPath: string): Promise<boolean> {\n try {\n // Check if directory exists\n const stats = await fs.stat(directoryPath)\n if (!stats.isDirectory()) return false\n\n // Check for some key files/directories that should exist in the repository\n // This helps verify it's a valid repository and not just an empty or corrupted directory\n const expectedFiles = ['settings.js', 'package.json']\n\n for (const file of expectedFiles) {\n try {\n await fs.access(path.join(directoryPath, file))\n } catch {\n // If any expected file doesn't exist, consider the repository invalid\n return false\n }\n }\n\n // Check if version file exists and has the correct version\n try {\n const versionPath = path.join(directoryPath, VERSION_FILE)\n const versionContent = await fs.readFile(versionPath, 'utf-8')\n\n // If the version in the file doesn't match the current version,\n // consider the repository outdated\n if (versionContent.trim() !== MCP_VERSION) {\n console.log(\n chalk.yellow(\n `=> ✨ MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`,\n ),\n )\n return false\n }\n } catch {\n // Version file doesn't exist or can't be read\n return false\n }\n\n // All checks passed, consider it a valid and current repository\n return true\n } catch {\n // Any error means directory doesn't exist or can't be accessed\n return false\n }\n}\n","import {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\nimport {copyMCP} from './copyMCP'\nimport chalk from 'chalk'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n if (!options.omitMcpServer) {\n await copyMCP().catch(console.error)\n console.log(chalk.bold('=> ✨ Orionjs AI is ready\\n'))\n }\n\n const runner = getRunner(options, command)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport {runProd} from './runProd'\nimport build from '../build'\n\nexport interface ProdOptions {\n path?: string\n}\n\nexport default async function (options: ProdOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n if (!options.path) {\n await build({output: './build'})\n options.path = './build'\n }\n\n runProd(options, command)\n}\n","import {spawn} from 'node:child_process'\nimport {ProdOptions} from './index'\n\nexport function runProd(options: ProdOptions, command: any) {\n const indexPath = `${options.path}/index.js`\n\n const args = ['--import=tsx', ...command.args, indexPath]\n spawn('node', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\nimport {build} from './build'\nimport cleanDirectory from '../dev/watchAndCompile/cleanDirectory'\nimport {checkTs} from './checkTs'\n\nexport default async function (options: {output?: string}) {\n console.log(chalk.bold(`Building Orionjs App ${chalk.green(chalk.bold('V4'))}...`))\n\n if (!options.output) {\n options.output = './build'\n }\n\n await cleanDirectory(options.output)\n\n await checkTs()\n await build(options)\n\n console.log(chalk.bold('Build completed'))\n}\n","import chalk from 'chalk'\nimport * as esbuild from 'esbuild'\n\nexport async function build(options: {output?: string}) {\n const {output} = options\n\n console.log(`Building with esbuild to ${output}`)\n\n await esbuild.build({\n entryPoints: ['./app/index.ts'],\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n outdir: output,\n bundle: true,\n target: 'node22',\n sourcemap: true,\n allowOverwrite: true,\n minify: true,\n packages: 'external',\n })\n\n console.log(chalk.green.bold('Build successful'))\n}\n","import chalk from 'chalk'\nimport {exec} from 'node:child_process'\nimport {promisify} from 'node:util'\n\nconst execPromise = promisify(exec)\n\nexport async function checkTs(): Promise<void> {\n try {\n console.log('Checking TypeScript...')\n await execPromise('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n })\n console.log(chalk.green.bold('TypeScript check passed'))\n } catch (error) {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n console.log(error.stderr || error.stdout || error.message)\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","export default '3.0'\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,iBAAkB;AAClB,uBAAsB;;;ACFtB,gCAAmB;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,wCAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eAAO,KAAK;AAAA,MACd,OAAO;AACL,gBAAQ,EAAC,QAAQ,OAAM,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;;;ACVA,eAAO,eAAwB,EAAC,MAAM,IAAG,GAAG;AAC1C,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,QAAM,OAAO,kDAAkD,GAAG;AAClE,UAAQ,IAAI,4BAA4B;AACxC,QAAM,gBAAQ,aAAa,IAAI,IAAI,IAAI,EAAE;AACzC,QAAM,gBAAQ,MAAM,IAAI,iBAAiB;AACzC,UAAQ,IAAI,2BAA2B;AACzC;;;ACdA,IAAAC,gBAAkB;;;ACAlB,IAAAC,kBAAe;;;ACAf,qBAAe;AACf,uBAAiB;AAEjB,IAAM,kBAAkB,cAAY;AAClC,QAAM,UAAU,iBAAAC,QAAK,QAAQ,QAAQ;AACrC,MAAI,eAAAC,QAAG,WAAW,OAAO,EAAG,QAAO;AACnC,kBAAgB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OAAO,IAAI,aAAK,CAAC;AAEpB,QACG,QAAQ,MAAM,EACd,mBAAmB,EACnB;AAAA,EACC;AAAA,EACA;AACF,EACC,YAAY,wCAAwC,EACpD,OAAO,IAAI,YAAI,CAAC;AAEnB,QACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,iBAAiB,qBAAqB,EAC7C,OAAO,eAAe,0BAA0B,EAChD,OAAO,IAAI,cAAM,CAAC;AAErB,QAAQ,QAAQ,iBAAS,cAAc;AAEvC,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["import_chalk","import_chalk","import_node_fs","path","fs","path","fs","import_node_child_process","chalk","chalk","import_typescript","import_node_fs","import_node_path","fs","path","import_typescript","import_node_fs","fs","ts","import_typescript","ts","import_chalk","chalk","ts","import_chalk","chokidar","chalk","ts","import_promises","import_node_path","import_chalk","import_node_path","import_chalk","fs","path","chalk","path","fs","chalk","import_chalk","chalk","import_chalk","import_node_child_process","import_chalk","import_chalk","build","chalk","import_chalk","import_node_child_process","chalk","chalk","build","chalk","import_chalk","chalk","import_chalk","import_chalk","import_node_child_process","checkTs","chalk","chalk","checkTs","chalk"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/index.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/reports.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/prod/index.ts","../src/prod/runProd.ts","../src/build/index.ts","../src/build/build.ts","../src/build/checkTs.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport build from './build'\nimport check from './check'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('build')\n .description('Build the Orionjs app for production')\n .option('--output [path]', 'Path of the output file')\n .action(run(build))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .option(\n '--path [path]',\n 'Path of the compiled Orionjs app. If not provided, the app will be compiled and then run',\n )\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n const runner = getRunner(options, command)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n}\n\nexport interface Runner {\n start: () => void\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const startApp = () => {\n appProcess = startProcess(options, command)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n appProcess = null\n }\n }\n\n const restart = () => {\n console.log(chalk.bold('=> Restarting app...\\n'))\n stop()\n startApp()\n }\n\n const start = () => {\n // check if the app is already running\n if (appProcess) {\n // console.log(chalk.bold('=> App is already running. Restarting...\\n'))\n } else {\n startApp()\n }\n }\n\n return {\n restart,\n stop,\n start,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\nimport chalk from 'chalk'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n console.log(chalk.bold(`=> Starting app with command: ${startCommand} ${args.join(' ')}...\\n`))\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from '.'\n\nexport function getArgs(_options: RunnerOptions, command: any) {\n const startCommand = 'tsx'\n\n const args = []\n\n args.push('watch', '--clear-screen=false')\n\n args.push(...command.args)\n\n args.push('./app/index.ts')\n\n return {startCommand, args}\n}\n","import ts from 'typescript'\nimport {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n const host = getHost(runner)\n ts.createWatchProgram(host)\n watchEnvFile(runner)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory(directory?: string) {\n try {\n const dirPath = directory ? directory : path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import ts from 'typescript'\nimport {getConfigPath} from './getConfigPath'\nimport {reportDiagnostic} from './reports'\nimport {Runner} from '../runner'\nimport chalk from 'chalk'\n\nexport function getHost(runner: Runner) {\n let isStopped = true\n const reportWatchStatusChanged = (diagnostic: ts.Diagnostic) => {\n if (diagnostic.category !== 3) return\n if (diagnostic.code === 6031 || diagnostic.code === 6032) {\n // file change detected, starting compilation\n // console.log(chalk.bold(`=> ${diagnostic.messageText}`))\n return\n }\n\n if (diagnostic.code === 6193) {\n runner.stop()\n isStopped = true\n return\n }\n\n if (diagnostic.code === 6194) {\n /**\n * Sometimes diagnostic code is 6194 even with errors\n */\n if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {\n if (!diagnostic.messageText.toString().includes('Found 0 errors.')) {\n runner.stop()\n isStopped = true\n return\n }\n }\n\n if (isStopped) {\n isStopped = false\n runner.start()\n }\n return\n }\n\n console.log(chalk.bold(`=> ${diagnostic.messageText} [${diagnostic.code}]`))\n }\n\n const configPath = getConfigPath()\n const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram\n\n const host = ts.createWatchCompilerHost(\n configPath,\n {},\n ts.sys,\n createProgram,\n reportDiagnostic,\n reportWatchStatusChanged,\n )\n\n return host\n}\n","import ts from 'typescript'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.server.json') ||\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n baseUrl?: string\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...config.compilerOptions,\n baseUrl: './',\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n // are the same, no write\n if (JSON.stringify(config) === JSON.stringify(newConfig)) {\n return\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import ts from 'typescript'\n\nconst format = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => ts.sys.newLine,\n}\nexport function reportDiagnostic(diagnostic: ts.Diagnostic) {\n console.log(ts.formatDiagnosticsWithColorAndContext([diagnostic], format))\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import chalk from 'chalk'\nimport {runProd} from './runProd'\nimport build from '../build'\n\nexport interface ProdOptions {\n path?: string\n}\n\nexport default async function (options: ProdOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n if (!options.path) {\n await build({output: './build'})\n options.path = './build'\n }\n\n runProd(options, command)\n}\n","import {spawn} from 'node:child_process'\nimport {ProdOptions} from './index'\n\nexport function runProd(options: ProdOptions, command: any) {\n const indexPath = `${options.path}/index.js`\n\n const args = ['--import=tsx', ...command.args, indexPath]\n spawn('node', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\nimport {build} from './build'\nimport cleanDirectory from '../dev/watchAndCompile/cleanDirectory'\nimport {checkTs} from './checkTs'\n\nexport default async function (options: {output?: string}) {\n console.log(chalk.bold(`Building Orionjs App ${chalk.green(chalk.bold('V4'))}...`))\n\n if (!options.output) {\n options.output = './build'\n }\n\n await cleanDirectory(options.output)\n\n await checkTs()\n await build(options)\n\n console.log(chalk.bold('Build completed'))\n}\n","import chalk from 'chalk'\nimport * as esbuild from 'esbuild'\n\nexport async function build(options: {output?: string}) {\n const {output} = options\n\n console.log(`Building with esbuild to ${output}`)\n\n await esbuild.build({\n entryPoints: ['./app/index.ts'],\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n outdir: output,\n bundle: true,\n target: 'node22',\n sourcemap: true,\n allowOverwrite: true,\n minify: true,\n packages: 'external',\n })\n\n console.log(chalk.green.bold('Build successful'))\n}\n","import chalk from 'chalk'\nimport {exec} from 'node:child_process'\nimport {promisify} from 'node:util'\n\nconst execPromise = promisify(exec)\n\nexport async function checkTs(): Promise<void> {\n try {\n console.log('Checking TypeScript...')\n await execPromise('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n })\n console.log(chalk.green.bold('TypeScript check passed'))\n } catch (error) {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n console.log(error.stderr || error.stdout || error.message)\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","export default '3.0'\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,iBAAkB;AAClB,uBAAsB;;;ACFtB,gCAAmB;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,wCAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eAAO,KAAK;AAAA,MACd,OAAO;AACL,gBAAQ,EAAC,QAAQ,OAAM,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;;;ACVA,eAAO,eAAwB,EAAC,MAAM,IAAG,GAAG;AAC1C,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,QAAM,OAAO,kDAAkD,GAAG;AAClE,UAAQ,IAAI,4BAA4B;AACxC,QAAM,gBAAQ,aAAa,IAAI,IAAI,IAAI,EAAE;AACzC,QAAM,gBAAQ,MAAM,IAAI,iBAAiB;AACzC,UAAQ,IAAI,2BAA2B;AACzC;;;ACdA,IAAAC,gBAAkB;;;ACAlB,IAAAC,gBAAkB;;;ACAlB,IAAAC,kBAAe;;;ACAf,qBAAe;AACf,uBAAiB;AAEjB,IAAM,kBAAkB,cAAY;AAClC,QAAM,UAAU,iBAAAC,QAAK,Q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AAM,KAAK,MAAM,gBAAgB,CAAC;AAChD;;;AxBEA,IAAM,UAAU,IAAI,yBAAQ;AAE5B,IAAM,MACJ,YACA,UAAU,SAAS;AACjB,MAAI;AACF,UAAM,OAAO,GAAG,IAAI;AAAA,EACtB,SAAS,GAAG;AACV,YAAQ,MAAM,eAAAE,QAAM,IAAI,UAAU,EAAE,OAAO,EAAE,CAAC;AAAA,EAChD;AACF;AAEF,QACG,QAAQ,KAAK,EACb,YAAY,yCAAyC,EACrD,mBAAmB,EACnB,OAAO,IAAI,WAAG,CAAC;AAElB,QAAQ,QAAQ,OAAO,EAAE,YAAY,yBAAyB,EAAE,OAAO,IAAI,aAAK,CAAC;AAEjF,QACG,QAAQ,OAAO,EACf,YAAY,sCAAsC,EAClD,OAAO,mBAAmB,yBAAyB,EACnD,OAAO,IAAI,aAAK,CAAC;AAEpB,QACG,QAAQ,MAAM,EACd,mBAAmB,EACnB;AAAA,EACC;AAAA,EACA;AACF,EACC,YAAY,wCAAwC,EACpD,OAAO,IAAI,YAAI,CAAC;AAEnB,QACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,iBAAiB,qBAAqB,EAC7C,OAAO,eAAe,0BAA0B,EAChD,OAAO,IAAI,cAAM,CAAC;AAErB,QAAQ,QAAQ,iBAAS,cAAc;AAEvC,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["import_chalk","import_chalk","import_chalk","import_node_fs","path","fs","path","fs","import_node_child_process","chalk","chalk","import_typescript","import_node_fs","import_node_path","fs","path","import_typescript","import_node_fs","fs","ts","import_typescript","ts","import_chalk","chalk","ts","import_chalk","chokidar","chalk","ts","chalk","import_chalk","import_node_child_process","import_chalk","import_chalk","build","chalk","import_chalk","import_node_child_process","chalk","chalk","build","chalk","import_chalk","chalk","import_chalk","import_chalk","import_node_child_process","checkTs","chalk","chalk","checkTs","chalk"]}
|
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 chalk13 from "chalk";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
|
|
7
7
|
// src/helpers/execute.ts
|
|
@@ -33,6 +33,9 @@ async function create_default({ name, kit }) {
|
|
|
33
33
|
console.log("Your starter kit is ready");
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// src/dev/index.ts
|
|
37
|
+
import chalk5 from "chalk";
|
|
38
|
+
|
|
36
39
|
// src/dev/runner/index.ts
|
|
37
40
|
import chalk2 from "chalk";
|
|
38
41
|
|
|
@@ -51,9 +54,9 @@ var ensureDirectory = (filePath) => {
|
|
|
51
54
|
var ensureDirectory_default = ensureDirectory;
|
|
52
55
|
|
|
53
56
|
// src/helpers/writeFile.ts
|
|
54
|
-
async function writeFile_default(
|
|
55
|
-
ensureDirectory_default(
|
|
56
|
-
fs2.writeFileSync(
|
|
57
|
+
async function writeFile_default(path3, content) {
|
|
58
|
+
ensureDirectory_default(path3);
|
|
59
|
+
fs2.writeFileSync(path3, content);
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
// src/dev/runner/startProcess.ts
|
|
@@ -284,130 +287,17 @@ async function watchAndCompile(runner) {
|
|
|
284
287
|
watchEnvFile(runner);
|
|
285
288
|
}
|
|
286
289
|
|
|
287
|
-
// src/dev/copyMCP/index.ts
|
|
288
|
-
import fs6 from "fs/promises";
|
|
289
|
-
import path4 from "path";
|
|
290
|
-
import chalk6 from "chalk";
|
|
291
|
-
|
|
292
|
-
// src/dev/copyMCP/consts.ts
|
|
293
|
-
var MCP_VERSION = "v4";
|
|
294
|
-
var VERSION_FILE = "version.txt";
|
|
295
|
-
|
|
296
|
-
// src/dev/copyMCP/isValidMCPRepo.ts
|
|
297
|
-
import fs5 from "fs/promises";
|
|
298
|
-
import path3 from "path";
|
|
299
|
-
import chalk5 from "chalk";
|
|
300
|
-
async function isValidMCPRepository(directoryPath) {
|
|
301
|
-
try {
|
|
302
|
-
const stats = await fs5.stat(directoryPath);
|
|
303
|
-
if (!stats.isDirectory()) return false;
|
|
304
|
-
const expectedFiles = ["settings.js", "package.json"];
|
|
305
|
-
for (const file of expectedFiles) {
|
|
306
|
-
try {
|
|
307
|
-
await fs5.access(path3.join(directoryPath, file));
|
|
308
|
-
} catch {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
try {
|
|
313
|
-
const versionPath = path3.join(directoryPath, VERSION_FILE);
|
|
314
|
-
const versionContent = await fs5.readFile(versionPath, "utf-8");
|
|
315
|
-
if (versionContent.trim() !== MCP_VERSION) {
|
|
316
|
-
console.log(
|
|
317
|
-
chalk5.yellow(
|
|
318
|
-
`=> \u2728 MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`
|
|
319
|
-
)
|
|
320
|
-
);
|
|
321
|
-
return false;
|
|
322
|
-
}
|
|
323
|
-
} catch {
|
|
324
|
-
return false;
|
|
325
|
-
}
|
|
326
|
-
return true;
|
|
327
|
-
} catch {
|
|
328
|
-
return false;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// src/dev/copyMCP/index.ts
|
|
333
|
-
async function copyMCP() {
|
|
334
|
-
const repoUrl = "https://github.com/orionjs/mcp-docs";
|
|
335
|
-
const targetDir = path4.join(process.cwd(), ".orion", "mcp");
|
|
336
|
-
try {
|
|
337
|
-
await fs6.mkdir(path4.join(process.cwd(), ".orion"), { recursive: true });
|
|
338
|
-
if (await isValidMCPRepository(targetDir)) {
|
|
339
|
-
console.log(chalk6.bold("=> \u2728 MCP documentation already installed"));
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
try {
|
|
343
|
-
const stats = await fs6.stat(targetDir);
|
|
344
|
-
if (stats.isDirectory()) {
|
|
345
|
-
await fs6.rm(targetDir, { recursive: true, force: true });
|
|
346
|
-
console.log(
|
|
347
|
-
chalk6.bold(
|
|
348
|
-
"=> \u2728 Removed existing .orion/mcp directory (invalid, incomplete, or outdated)"
|
|
349
|
-
)
|
|
350
|
-
);
|
|
351
|
-
}
|
|
352
|
-
} catch (_) {
|
|
353
|
-
}
|
|
354
|
-
console.log(chalk6.bold(`=> \u2728 Downloading MCP documentation ${MCP_VERSION}...`));
|
|
355
|
-
await execute_default(`git clone ${repoUrl} ${targetDir}`);
|
|
356
|
-
await execute_default(`rm -rf ${path4.join(targetDir, ".git")}`);
|
|
357
|
-
await fs6.writeFile(path4.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
|
|
358
|
-
console.log(
|
|
359
|
-
chalk6.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
|
|
360
|
-
);
|
|
361
|
-
console.log(chalk6.bold("=> \u2728 Installing MCP dependencies..."));
|
|
362
|
-
await execute_default(`cd ${targetDir} && npm install`);
|
|
363
|
-
console.log(chalk6.bold("=> \u2728 Successfully installed MCP dependencies"));
|
|
364
|
-
const relativePath = path4.relative(process.cwd(), targetDir);
|
|
365
|
-
console.log(relativePath);
|
|
366
|
-
const mcpServerConfig = {
|
|
367
|
-
mcpServers: {
|
|
368
|
-
"Orionjs documentation search": {
|
|
369
|
-
command: "node",
|
|
370
|
-
args: [`./${path4.join(relativePath, "src", "index.js")}`]
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
const configPath = path4.join(process.cwd(), ".cursor", "mcp.json");
|
|
375
|
-
try {
|
|
376
|
-
const existingConfig = await fs6.readFile(configPath, "utf-8");
|
|
377
|
-
const parsedConfig = JSON.parse(existingConfig);
|
|
378
|
-
parsedConfig.mcpServers = {
|
|
379
|
-
...parsedConfig.mcpServers,
|
|
380
|
-
...mcpServerConfig.mcpServers
|
|
381
|
-
};
|
|
382
|
-
await fs6.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), "utf-8");
|
|
383
|
-
console.log(chalk6.bold("=> \u2728 Updated MCP server configuration in .cursor/mcp.json"));
|
|
384
|
-
} catch (_) {
|
|
385
|
-
await fs6.mkdir(path4.dirname(configPath), { recursive: true });
|
|
386
|
-
await fs6.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), "utf-8");
|
|
387
|
-
console.log(chalk6.bold("=> \u2728 Created new MCP server configuration in .cursor/mcp.json"));
|
|
388
|
-
}
|
|
389
|
-
} catch (error) {
|
|
390
|
-
console.error(chalk6.red("=> \u2728 Error copying MCP documentation:"), error);
|
|
391
|
-
throw error;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
290
|
// src/dev/index.ts
|
|
396
|
-
import chalk7 from "chalk";
|
|
397
291
|
async function dev_default(options, command) {
|
|
398
|
-
console.log(
|
|
399
|
-
Orionjs App ${
|
|
292
|
+
console.log(chalk5.bold(`
|
|
293
|
+
Orionjs App ${chalk5.green(chalk5.bold("V4"))} Dev mode
|
|
400
294
|
`));
|
|
401
|
-
if (!options.omitMcpServer) {
|
|
402
|
-
await copyMCP().catch(console.error);
|
|
403
|
-
console.log(chalk7.bold("=> \u2728 Orionjs AI is ready\n"));
|
|
404
|
-
}
|
|
405
295
|
const runner = getRunner(options, command);
|
|
406
296
|
watchAndCompile(runner);
|
|
407
297
|
}
|
|
408
298
|
|
|
409
299
|
// src/prod/index.ts
|
|
410
|
-
import
|
|
300
|
+
import chalk9 from "chalk";
|
|
411
301
|
|
|
412
302
|
// src/prod/runProd.ts
|
|
413
303
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -428,10 +318,10 @@ function runProd(options, command) {
|
|
|
428
318
|
}
|
|
429
319
|
|
|
430
320
|
// src/build/index.ts
|
|
431
|
-
import
|
|
321
|
+
import chalk8 from "chalk";
|
|
432
322
|
|
|
433
323
|
// src/build/build.ts
|
|
434
|
-
import
|
|
324
|
+
import chalk6 from "chalk";
|
|
435
325
|
import * as esbuild from "esbuild";
|
|
436
326
|
async function build2(options) {
|
|
437
327
|
const { output } = options;
|
|
@@ -449,11 +339,11 @@ async function build2(options) {
|
|
|
449
339
|
minify: true,
|
|
450
340
|
packages: "external"
|
|
451
341
|
});
|
|
452
|
-
console.log(
|
|
342
|
+
console.log(chalk6.green.bold("Build successful"));
|
|
453
343
|
}
|
|
454
344
|
|
|
455
345
|
// src/build/checkTs.ts
|
|
456
|
-
import
|
|
346
|
+
import chalk7 from "chalk";
|
|
457
347
|
import { exec as exec2 } from "child_process";
|
|
458
348
|
import { promisify } from "util";
|
|
459
349
|
var execPromise = promisify(exec2);
|
|
@@ -468,9 +358,9 @@ async function checkTs() {
|
|
|
468
358
|
gid: process.getgid(),
|
|
469
359
|
uid: process.getuid()
|
|
470
360
|
});
|
|
471
|
-
console.log(
|
|
361
|
+
console.log(chalk7.green.bold("TypeScript check passed"));
|
|
472
362
|
} catch (error) {
|
|
473
|
-
console.log(
|
|
363
|
+
console.log(chalk7.red.bold("TypeScript compilation failed"));
|
|
474
364
|
console.log(error.stderr || error.stdout || error.message);
|
|
475
365
|
process.exit(1);
|
|
476
366
|
}
|
|
@@ -478,20 +368,20 @@ async function checkTs() {
|
|
|
478
368
|
|
|
479
369
|
// src/build/index.ts
|
|
480
370
|
async function build_default(options) {
|
|
481
|
-
console.log(
|
|
371
|
+
console.log(chalk8.bold(`Building Orionjs App ${chalk8.green(chalk8.bold("V4"))}...`));
|
|
482
372
|
if (!options.output) {
|
|
483
373
|
options.output = "./build";
|
|
484
374
|
}
|
|
485
375
|
await cleanDirectory(options.output);
|
|
486
376
|
await checkTs();
|
|
487
377
|
await build2(options);
|
|
488
|
-
console.log(
|
|
378
|
+
console.log(chalk8.bold("Build completed"));
|
|
489
379
|
}
|
|
490
380
|
|
|
491
381
|
// src/prod/index.ts
|
|
492
382
|
async function prod_default(options, command) {
|
|
493
|
-
console.log(
|
|
494
|
-
Orionjs App ${
|
|
383
|
+
console.log(chalk9.bold(`
|
|
384
|
+
Orionjs App ${chalk9.green(chalk9.bold("V4"))} Prod mode
|
|
495
385
|
`));
|
|
496
386
|
if (!options.path) {
|
|
497
387
|
await build_default({ output: "./build" });
|
|
@@ -501,16 +391,16 @@ Orionjs App ${chalk11.green(chalk11.bold("V4"))} Prod mode
|
|
|
501
391
|
}
|
|
502
392
|
|
|
503
393
|
// src/handleErrors.ts
|
|
504
|
-
import
|
|
394
|
+
import chalk10 from "chalk";
|
|
505
395
|
process.on("unhandledRejection", (error) => {
|
|
506
396
|
if (error.codeFrame) {
|
|
507
|
-
console.error(
|
|
397
|
+
console.error(chalk10.red(error.message));
|
|
508
398
|
console.log(error.codeFrame);
|
|
509
399
|
} else {
|
|
510
|
-
console.error(
|
|
400
|
+
console.error(chalk10.red(error.message), chalk10.red("Unhandled promise rejection"));
|
|
511
401
|
}
|
|
512
402
|
}).on("uncaughtException", (error) => {
|
|
513
|
-
console.error(
|
|
403
|
+
console.error(chalk10.red(error.message));
|
|
514
404
|
process.exit(1);
|
|
515
405
|
});
|
|
516
406
|
|
|
@@ -521,10 +411,10 @@ var version_default = "3.0";
|
|
|
521
411
|
import "dotenv/config";
|
|
522
412
|
|
|
523
413
|
// src/check/index.ts
|
|
524
|
-
import
|
|
414
|
+
import chalk12 from "chalk";
|
|
525
415
|
|
|
526
416
|
// src/check/checkTs.ts
|
|
527
|
-
import
|
|
417
|
+
import chalk11 from "chalk";
|
|
528
418
|
import { execSync } from "child_process";
|
|
529
419
|
function checkTs2() {
|
|
530
420
|
try {
|
|
@@ -538,18 +428,18 @@ function checkTs2() {
|
|
|
538
428
|
stdio: "inherit"
|
|
539
429
|
});
|
|
540
430
|
} catch {
|
|
541
|
-
console.log(
|
|
431
|
+
console.log(chalk11.red.bold("TypeScript compilation failed"));
|
|
542
432
|
process.exit(1);
|
|
543
433
|
}
|
|
544
434
|
}
|
|
545
435
|
|
|
546
436
|
// src/check/index.ts
|
|
547
437
|
async function check_default() {
|
|
548
|
-
console.log(
|
|
438
|
+
console.log(chalk12.bold(`Orionjs App ${chalk12.green(chalk12.bold("V4"))}
|
|
549
439
|
`));
|
|
550
440
|
console.log("Checking typescript...");
|
|
551
441
|
checkTs2();
|
|
552
|
-
console.log(
|
|
442
|
+
console.log(chalk12.bold.green("Check passed\n"));
|
|
553
443
|
}
|
|
554
444
|
|
|
555
445
|
// src/index.ts
|
|
@@ -558,10 +448,10 @@ var run = (action) => async (...args) => {
|
|
|
558
448
|
try {
|
|
559
449
|
await action(...args);
|
|
560
450
|
} catch (e) {
|
|
561
|
-
console.error(
|
|
451
|
+
console.error(chalk13.red(`Error: ${e.message}`));
|
|
562
452
|
}
|
|
563
453
|
};
|
|
564
|
-
program.command("dev").description("Run the Orionjs app in development mode").
|
|
454
|
+
program.command("dev").description("Run the Orionjs app in development mode").allowUnknownOption().action(run(dev_default));
|
|
565
455
|
program.command("check").description("Runs a typescript check").action(run(check_default));
|
|
566
456
|
program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
|
|
567
457
|
program.command("prod").allowUnknownOption().option(
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/index.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/reports.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/copyMCP/index.ts","../src/dev/copyMCP/consts.ts","../src/dev/copyMCP/isValidMCPRepo.ts","../src/dev/index.ts","../src/prod/index.ts","../src/prod/runProd.ts","../src/build/index.ts","../src/build/build.ts","../src/build/checkTs.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport check from './check'\nimport build from './build'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--omit-mcp-server', 'Omit the creation of the Orionjs MCP server')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('build')\n .description('Build the Orionjs app for production')\n .option('--output [path]', 'Path of the output file')\n .action(run(build))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .option(\n '--path [path]',\n 'Path of the compiled Orionjs app. If not provided, the app will be compiled and then run',\n )\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n // omit the creation of the orion mcp server\n omitMcpServer?: boolean\n}\n\nexport interface Runner {\n start: () => void\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const startApp = () => {\n appProcess = startProcess(options, command)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n appProcess = null\n }\n }\n\n const restart = () => {\n console.log(chalk.bold('=> Restarting app...\\n'))\n stop()\n startApp()\n }\n\n const start = () => {\n // check if the app is already running\n if (appProcess) {\n // console.log(chalk.bold('=> App is already running. Restarting...\\n'))\n } else {\n startApp()\n }\n }\n\n return {\n restart,\n stop,\n start,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\nimport chalk from 'chalk'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n console.log(chalk.bold(`=> Starting app with command: ${startCommand} ${args.join(' ')}...\\n`))\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from '.'\n\nexport function getArgs(_options: RunnerOptions, command: any) {\n const startCommand = 'tsx'\n\n const args = []\n\n args.push('watch', '--clear-screen=false')\n\n args.push(...command.args)\n\n args.push('./app/index.ts')\n\n return {startCommand, args}\n}\n","import ts from 'typescript'\nimport {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n const host = getHost(runner)\n ts.createWatchProgram(host)\n watchEnvFile(runner)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory(directory?: string) {\n try {\n const dirPath = directory ? directory : path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import ts from 'typescript'\nimport {getConfigPath} from './getConfigPath'\nimport {reportDiagnostic} from './reports'\nimport {Runner} from '../runner'\nimport chalk from 'chalk'\n\nexport function getHost(runner: Runner) {\n let isStopped = true\n const reportWatchStatusChanged = (diagnostic: ts.Diagnostic) => {\n if (diagnostic.category !== 3) return\n if (diagnostic.code === 6031 || diagnostic.code === 6032) {\n // file change detected, starting compilation\n // console.log(chalk.bold(`=> ${diagnostic.messageText}`))\n return\n }\n\n if (diagnostic.code === 6193) {\n runner.stop()\n isStopped = true\n return\n }\n\n if (diagnostic.code === 6194) {\n /**\n * Sometimes diagnostic code is 6194 even with errors\n */\n if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {\n if (!diagnostic.messageText.toString().includes('Found 0 errors.')) {\n runner.stop()\n isStopped = true\n return\n }\n }\n\n if (isStopped) {\n isStopped = false\n runner.start()\n }\n return\n }\n\n console.log(chalk.bold(`=> ${diagnostic.messageText} [${diagnostic.code}]`))\n }\n\n const configPath = getConfigPath()\n const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram\n\n const host = ts.createWatchCompilerHost(\n configPath,\n {},\n ts.sys,\n createProgram,\n reportDiagnostic,\n reportWatchStatusChanged,\n )\n\n return host\n}\n","import ts from 'typescript'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.server.json') ||\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n baseUrl?: string\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...config.compilerOptions,\n baseUrl: './',\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n // are the same, no write\n if (JSON.stringify(config) === JSON.stringify(newConfig)) {\n return\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import ts from 'typescript'\n\nconst format = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => ts.sys.newLine,\n}\nexport function reportDiagnostic(diagnostic: ts.Diagnostic) {\n console.log(ts.formatDiagnosticsWithColorAndContext([diagnostic], format))\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport execute from '../../helpers/execute'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\nimport {isValidMCPRepository} from './isValidMCPRepo'\n\nexport async function copyMCP() {\n const repoUrl = 'https://github.com/orionjs/mcp-docs'\n const targetDir = path.join(process.cwd(), '.orion', 'mcp')\n\n try {\n // Ensure parent directory exists\n await fs.mkdir(path.join(process.cwd(), '.orion'), {recursive: true})\n\n // Check if the repository is already properly installed with current version\n if (await isValidMCPRepository(targetDir)) {\n console.log(chalk.bold('=> ✨ MCP documentation already installed'))\n return\n }\n\n // Check if the directory already exists but is not a valid repository or has outdated version\n try {\n const stats = await fs.stat(targetDir)\n if (stats.isDirectory()) {\n // Directory exists, remove it first to ensure fresh clone\n await fs.rm(targetDir, {recursive: true, force: true})\n console.log(\n chalk.bold(\n '=> ✨ Removed existing .orion/mcp directory (invalid, incomplete, or outdated)',\n ),\n )\n }\n } catch (_) {\n // Directory doesn't exist, which is fine\n }\n\n // Clone the repository\n console.log(chalk.bold(`=> ✨ Downloading MCP documentation ${MCP_VERSION}...`))\n await execute(`git clone ${repoUrl} ${targetDir}`)\n\n // Remove git directory to avoid confusion\n await execute(`rm -rf ${path.join(targetDir, '.git')}`)\n\n // Create version file\n await fs.writeFile(path.join(targetDir, VERSION_FILE), MCP_VERSION, 'utf-8')\n\n console.log(\n chalk.bold(`=> ✨ Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`),\n )\n\n // Install dependencies in the MCP directory\n console.log(chalk.bold('=> ✨ Installing MCP dependencies...'))\n await execute(`cd ${targetDir} && npm install`)\n console.log(chalk.bold('=> ✨ Successfully installed MCP dependencies'))\n\n const relativePath = path.relative(process.cwd(), targetDir)\n console.log(relativePath)\n const mcpServerConfig = {\n mcpServers: {\n 'Orionjs documentation search': {\n command: 'node',\n args: [`./${path.join(relativePath, 'src', 'index.js')}`],\n },\n },\n }\n\n const configPath = path.join(process.cwd(), '.cursor', 'mcp.json')\n\n // Check if the config file exists\n try {\n // Try to read existing config file\n const existingConfig = await fs.readFile(configPath, 'utf-8')\n const parsedConfig = JSON.parse(existingConfig)\n\n // Update the mcpServers section while preserving other settings\n parsedConfig.mcpServers = {\n ...parsedConfig.mcpServers,\n ...mcpServerConfig.mcpServers,\n }\n\n // Write the updated config back\n await fs.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Updated MCP server configuration in .cursor/mcp.json'))\n } catch (_) {\n // If file doesn't exist or can't be parsed, create a new one\n // Ensure the .cursor directory exists\n await fs.mkdir(path.dirname(configPath), {recursive: true})\n\n // Write the new config file\n await fs.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), 'utf-8')\n console.log(chalk.bold('=> ✨ Created new MCP server configuration in .cursor/mcp.json'))\n }\n } catch (error) {\n console.error(chalk.red('=> ✨ Error copying MCP documentation:'), error)\n throw error\n }\n}\n","// Define current MCP version - update this when a new version needs to be deployed\nexport const MCP_VERSION = 'v4'\nexport const VERSION_FILE = 'version.txt'\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport chalk from 'chalk'\nimport {MCP_VERSION, VERSION_FILE} from './consts'\n\n/**\n * Checks if the MCP repository appears to be already installed correctly\n * and has the current version\n */\nexport async function isValidMCPRepository(directoryPath: string): Promise<boolean> {\n try {\n // Check if directory exists\n const stats = await fs.stat(directoryPath)\n if (!stats.isDirectory()) return false\n\n // Check for some key files/directories that should exist in the repository\n // This helps verify it's a valid repository and not just an empty or corrupted directory\n const expectedFiles = ['settings.js', 'package.json']\n\n for (const file of expectedFiles) {\n try {\n await fs.access(path.join(directoryPath, file))\n } catch {\n // If any expected file doesn't exist, consider the repository invalid\n return false\n }\n }\n\n // Check if version file exists and has the correct version\n try {\n const versionPath = path.join(directoryPath, VERSION_FILE)\n const versionContent = await fs.readFile(versionPath, 'utf-8')\n\n // If the version in the file doesn't match the current version,\n // consider the repository outdated\n if (versionContent.trim() !== MCP_VERSION) {\n console.log(\n chalk.yellow(\n `=> ✨ MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`,\n ),\n )\n return false\n }\n } catch {\n // Version file doesn't exist or can't be read\n return false\n }\n\n // All checks passed, consider it a valid and current repository\n return true\n } catch {\n // Any error means directory doesn't exist or can't be accessed\n return false\n }\n}\n","import {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\nimport {copyMCP} from './copyMCP'\nimport chalk from 'chalk'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n if (!options.omitMcpServer) {\n await copyMCP().catch(console.error)\n console.log(chalk.bold('=> ✨ Orionjs AI is ready\\n'))\n }\n\n const runner = getRunner(options, command)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport {runProd} from './runProd'\nimport build from '../build'\n\nexport interface ProdOptions {\n path?: string\n}\n\nexport default async function (options: ProdOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n if (!options.path) {\n await build({output: './build'})\n options.path = './build'\n }\n\n runProd(options, command)\n}\n","import {spawn} from 'node:child_process'\nimport {ProdOptions} from './index'\n\nexport function runProd(options: ProdOptions, command: any) {\n const indexPath = `${options.path}/index.js`\n\n const args = ['--import=tsx', ...command.args, indexPath]\n spawn('node', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\nimport {build} from './build'\nimport cleanDirectory from '../dev/watchAndCompile/cleanDirectory'\nimport {checkTs} from './checkTs'\n\nexport default async function (options: {output?: string}) {\n console.log(chalk.bold(`Building Orionjs App ${chalk.green(chalk.bold('V4'))}...`))\n\n if (!options.output) {\n options.output = './build'\n }\n\n await cleanDirectory(options.output)\n\n await checkTs()\n await build(options)\n\n console.log(chalk.bold('Build completed'))\n}\n","import chalk from 'chalk'\nimport * as esbuild from 'esbuild'\n\nexport async function build(options: {output?: string}) {\n const {output} = options\n\n console.log(`Building with esbuild to ${output}`)\n\n await esbuild.build({\n entryPoints: ['./app/index.ts'],\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n outdir: output,\n bundle: true,\n target: 'node22',\n sourcemap: true,\n allowOverwrite: true,\n minify: true,\n packages: 'external',\n })\n\n console.log(chalk.green.bold('Build successful'))\n}\n","import chalk from 'chalk'\nimport {exec} from 'node:child_process'\nimport {promisify} from 'node:util'\n\nconst execPromise = promisify(exec)\n\nexport async function checkTs(): Promise<void> {\n try {\n console.log('Checking TypeScript...')\n await execPromise('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n })\n console.log(chalk.green.bold('TypeScript check passed'))\n } catch (error) {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n console.log(error.stderr || error.stdout || error.message)\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","export default '3.0'\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n"],"mappings":";;;AACA,OAAOA,aAAW;AAClB,SAAQ,eAAc;;;ACFtB,SAAQ,YAAW;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,SAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eAAO,KAAK;AAAA,MACd,OAAO;AACL,gBAAQ,EAAC,QAAQ,OAAM,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;;;ACVA,eAAO,eAAwB,EAAC,MAAM,IAAG,GAAG;AAC1C,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,QAAM,OAA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EnB,QACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,iBAAiB,qBAAqB,EAC7C,OAAO,eAAe,0BAA0B,EAChD,OAAO,IAAI,cAAM,CAAC;AAErB,QAAQ,QAAQ,iBAAS,cAAc;AAEvC,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["chalk","chalk","fs","path","fs","chalk","ts","fs","path","ts","fs","ts","chalk","ts","chalk","ts","fs","path","chalk","fs","path","chalk","fs","path","chalk","path","fs","chalk","chalk","chalk","spawn","chalk","chalk","build","chalk","exec","chalk","build","chalk","chalk","chalk","chalk","checkTs","chalk","checkTs","chalk"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/index.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/reports.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/prod/index.ts","../src/prod/runProd.ts","../src/build/index.ts","../src/build/build.ts","../src/build/checkTs.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport build from './build'\nimport check from './check'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('build')\n .description('Build the Orionjs app for production')\n .option('--output [path]', 'Path of the output file')\n .action(run(build))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .option(\n '--path [path]',\n 'Path of the compiled Orionjs app. If not provided, the app will be compiled and then run',\n )\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n const runner = getRunner(options, command)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n}\n\nexport interface Runner {\n start: () => void\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const startApp = () => {\n appProcess = startProcess(options, command)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n appProcess = null\n }\n }\n\n const restart = () => {\n console.log(chalk.bold('=> Restarting app...\\n'))\n stop()\n startApp()\n }\n\n const start = () => {\n // check if the app is already running\n if (appProcess) {\n // console.log(chalk.bold('=> App is already running. Restarting...\\n'))\n } else {\n startApp()\n }\n }\n\n return {\n restart,\n stop,\n start,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\nimport chalk from 'chalk'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n console.log(chalk.bold(`=> Starting app with command: ${startCommand} ${args.join(' ')}...\\n`))\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from '.'\n\nexport function getArgs(_options: RunnerOptions, command: any) {\n const startCommand = 'tsx'\n\n const args = []\n\n args.push('watch', '--clear-screen=false')\n\n args.push(...command.args)\n\n args.push('./app/index.ts')\n\n return {startCommand, args}\n}\n","import ts from 'typescript'\nimport {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n const host = getHost(runner)\n ts.createWatchProgram(host)\n watchEnvFile(runner)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory(directory?: string) {\n try {\n const dirPath = directory ? directory : path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import ts from 'typescript'\nimport {getConfigPath} from './getConfigPath'\nimport {reportDiagnostic} from './reports'\nimport {Runner} from '../runner'\nimport chalk from 'chalk'\n\nexport function getHost(runner: Runner) {\n let isStopped = true\n const reportWatchStatusChanged = (diagnostic: ts.Diagnostic) => {\n if (diagnostic.category !== 3) return\n if (diagnostic.code === 6031 || diagnostic.code === 6032) {\n // file change detected, starting compilation\n // console.log(chalk.bold(`=> ${diagnostic.messageText}`))\n return\n }\n\n if (diagnostic.code === 6193) {\n runner.stop()\n isStopped = true\n return\n }\n\n if (diagnostic.code === 6194) {\n /**\n * Sometimes diagnostic code is 6194 even with errors\n */\n if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {\n if (!diagnostic.messageText.toString().includes('Found 0 errors.')) {\n runner.stop()\n isStopped = true\n return\n }\n }\n\n if (isStopped) {\n isStopped = false\n runner.start()\n }\n return\n }\n\n console.log(chalk.bold(`=> ${diagnostic.messageText} [${diagnostic.code}]`))\n }\n\n const configPath = getConfigPath()\n const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram\n\n const host = ts.createWatchCompilerHost(\n configPath,\n {},\n ts.sys,\n createProgram,\n reportDiagnostic,\n reportWatchStatusChanged,\n )\n\n return host\n}\n","import ts from 'typescript'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.server.json') ||\n ts.findConfigFile(appBasePath, ts.sys.fileExists, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n baseUrl?: string\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...config.compilerOptions,\n baseUrl: './',\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n // are the same, no write\n if (JSON.stringify(config) === JSON.stringify(newConfig)) {\n return\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import ts from 'typescript'\n\nconst format = {\n getCanonicalFileName: fileName => fileName,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => ts.sys.newLine,\n}\nexport function reportDiagnostic(diagnostic: ts.Diagnostic) {\n console.log(ts.formatDiagnosticsWithColorAndContext([diagnostic], format))\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import chalk from 'chalk'\nimport {runProd} from './runProd'\nimport build from '../build'\n\nexport interface ProdOptions {\n path?: string\n}\n\nexport default async function (options: ProdOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n if (!options.path) {\n await build({output: './build'})\n options.path = './build'\n }\n\n runProd(options, command)\n}\n","import {spawn} from 'node:child_process'\nimport {ProdOptions} from './index'\n\nexport function runProd(options: ProdOptions, command: any) {\n const indexPath = `${options.path}/index.js`\n\n const args = ['--import=tsx', ...command.args, indexPath]\n spawn('node', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\nimport {build} from './build'\nimport cleanDirectory from '../dev/watchAndCompile/cleanDirectory'\nimport {checkTs} from './checkTs'\n\nexport default async function (options: {output?: string}) {\n console.log(chalk.bold(`Building Orionjs App ${chalk.green(chalk.bold('V4'))}...`))\n\n if (!options.output) {\n options.output = './build'\n }\n\n await cleanDirectory(options.output)\n\n await checkTs()\n await build(options)\n\n console.log(chalk.bold('Build completed'))\n}\n","import chalk from 'chalk'\nimport * as esbuild from 'esbuild'\n\nexport async function build(options: {output?: string}) {\n const {output} = options\n\n console.log(`Building with esbuild to ${output}`)\n\n await esbuild.build({\n entryPoints: ['./app/index.ts'],\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n outdir: output,\n bundle: true,\n target: 'node22',\n sourcemap: true,\n allowOverwrite: true,\n minify: true,\n packages: 'external',\n })\n\n console.log(chalk.green.bold('Build successful'))\n}\n","import chalk from 'chalk'\nimport {exec} from 'node:child_process'\nimport {promisify} from 'node:util'\n\nconst execPromise = promisify(exec)\n\nexport async function checkTs(): Promise<void> {\n try {\n console.log('Checking TypeScript...')\n await execPromise('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n })\n console.log(chalk.green.bold('TypeScript check passed'))\n } catch (error) {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n console.log(error.stderr || error.stdout || error.message)\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","export default '3.0'\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.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AAEnB,QACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,iBAAiB,qBAAqB,EAC7C,OAAO,eAAe,0BAA0B,EAChD,OAAO,IAAI,cAAM,CAAC;AAErB,QAAQ,QAAQ,iBAAS,cAAc;AAEvC,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["chalk","chalk","chalk","fs","path","fs","chalk","ts","fs","path","ts","fs","ts","chalk","ts","chalk","ts","chalk","chalk","spawn","chalk","chalk","build","chalk","exec","chalk","build","chalk","chalk","chalk","chalk","checkTs","chalk","checkTs","chalk"]}
|