@orion-js/core 4.0.7 → 4.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +102 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +114 -123
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.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_chalk16 = __toESM(require("chalk"), 1);
|
|
27
27
|
var import_commander = require("commander");
|
|
28
28
|
|
|
29
29
|
// src/helpers/execute.ts
|
|
@@ -56,7 +56,7 @@ async function create_default({ name, kit }) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// src/dev/runner/index.ts
|
|
59
|
-
var
|
|
59
|
+
var import_chalk2 = __toESM(require("chalk"), 1);
|
|
60
60
|
|
|
61
61
|
// src/helpers/writeFile.ts
|
|
62
62
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
@@ -73,34 +73,30 @@ var ensureDirectory = (filePath) => {
|
|
|
73
73
|
var ensureDirectory_default = ensureDirectory;
|
|
74
74
|
|
|
75
75
|
// src/helpers/writeFile.ts
|
|
76
|
-
async function writeFile_default(
|
|
77
|
-
ensureDirectory_default(
|
|
78
|
-
import_node_fs2.default.writeFileSync(
|
|
76
|
+
async function writeFile_default(path6, content) {
|
|
77
|
+
ensureDirectory_default(path6);
|
|
78
|
+
import_node_fs2.default.writeFileSync(path6, content);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// src/dev/runner/startProcess.ts
|
|
82
82
|
var import_node_child_process2 = require("child_process");
|
|
83
83
|
|
|
84
84
|
// src/dev/runner/getArgs.ts
|
|
85
|
-
function getArgs(
|
|
86
|
-
|
|
85
|
+
function getArgs(_options, command) {
|
|
86
|
+
const startCommand = "tsx";
|
|
87
87
|
const args = [];
|
|
88
|
-
|
|
89
|
-
const [first, ...otherArgs] = process.env.START_COMMAND.split(" ");
|
|
90
|
-
startCommand = first;
|
|
91
|
-
args.push(...otherArgs);
|
|
92
|
-
console.log(`Using custom command: ${[startCommand, ...args].join(" ")}`);
|
|
93
|
-
} else if (options.shell) {
|
|
94
|
-
args.push("--inspect");
|
|
95
|
-
}
|
|
88
|
+
args.push("watch", "--clear-screen=false");
|
|
96
89
|
args.push(...command.args);
|
|
97
90
|
args.push("./app/index.ts");
|
|
98
91
|
return { startCommand, args };
|
|
99
92
|
}
|
|
100
93
|
|
|
101
94
|
// src/dev/runner/startProcess.ts
|
|
95
|
+
var import_chalk = __toESM(require("chalk"), 1);
|
|
102
96
|
function startProcess(options, command) {
|
|
103
97
|
const { startCommand, args } = getArgs(options, command);
|
|
98
|
+
console.log(import_chalk.default.bold(`=> Starting app with command: ${startCommand} ${args.join(" ")}...
|
|
99
|
+
`));
|
|
104
100
|
return (0, import_node_child_process2.spawn)(startCommand, args, {
|
|
105
101
|
env: {
|
|
106
102
|
ORION_DEV: "local",
|
|
@@ -116,15 +112,14 @@ function startProcess(options, command) {
|
|
|
116
112
|
function getRunner(options, command) {
|
|
117
113
|
let appProcess = null;
|
|
118
114
|
if (options.clean) {
|
|
119
|
-
console.log(
|
|
115
|
+
console.log(import_chalk2.default.bold("=> Cleaning directory...\n"));
|
|
120
116
|
}
|
|
121
|
-
const
|
|
122
|
-
console.log(import_chalk.default.bold("=> Starting app...\n"));
|
|
117
|
+
const startApp = () => {
|
|
123
118
|
appProcess = startProcess(options, command);
|
|
124
119
|
appProcess.on("exit", (code, signal) => {
|
|
125
120
|
if (!code || code === 143 || code === 0 || signal === "SIGTERM" || signal === "SIGINT") {
|
|
126
121
|
} else {
|
|
127
|
-
console.log(
|
|
122
|
+
console.log(import_chalk2.default.bold(`=> Error running app. Exit code: ${code}`));
|
|
128
123
|
}
|
|
129
124
|
});
|
|
130
125
|
writeFile_default(".orion/process", `${appProcess.pid}`);
|
|
@@ -132,15 +127,24 @@ function getRunner(options, command) {
|
|
|
132
127
|
const stop = () => {
|
|
133
128
|
if (appProcess) {
|
|
134
129
|
appProcess.kill();
|
|
130
|
+
appProcess = null;
|
|
135
131
|
}
|
|
136
132
|
};
|
|
137
133
|
const restart = () => {
|
|
134
|
+
console.log(import_chalk2.default.bold("=> Restarting app...\n"));
|
|
138
135
|
stop();
|
|
139
|
-
|
|
136
|
+
startApp();
|
|
137
|
+
};
|
|
138
|
+
const start = () => {
|
|
139
|
+
if (appProcess) {
|
|
140
|
+
} else {
|
|
141
|
+
startApp();
|
|
142
|
+
}
|
|
140
143
|
};
|
|
141
144
|
return {
|
|
142
145
|
restart,
|
|
143
|
-
stop
|
|
146
|
+
stop,
|
|
147
|
+
start
|
|
144
148
|
};
|
|
145
149
|
}
|
|
146
150
|
|
|
@@ -233,22 +237,34 @@ function reportDiagnostic(diagnostic) {
|
|
|
233
237
|
}
|
|
234
238
|
|
|
235
239
|
// src/dev/watchAndCompile/getHost.ts
|
|
236
|
-
var
|
|
240
|
+
var import_chalk3 = __toESM(require("chalk"), 1);
|
|
237
241
|
function getHost(runner) {
|
|
242
|
+
let isStopped = true;
|
|
238
243
|
const reportWatchStatusChanged = (diagnostic) => {
|
|
239
244
|
if (diagnostic.category !== 3) return;
|
|
240
|
-
if (diagnostic.code ===
|
|
245
|
+
if (diagnostic.code === 6031 || diagnostic.code === 6032) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (diagnostic.code === 6193) {
|
|
241
249
|
runner.stop();
|
|
250
|
+
isStopped = true;
|
|
251
|
+
return;
|
|
242
252
|
}
|
|
243
|
-
console.log(import_chalk2.default.bold(`=> ${diagnostic.messageText}`));
|
|
244
253
|
if (diagnostic.code === 6194) {
|
|
245
254
|
if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {
|
|
246
255
|
if (!diagnostic.messageText.toString().includes("Found 0 errors.")) {
|
|
256
|
+
runner.stop();
|
|
257
|
+
isStopped = true;
|
|
247
258
|
return;
|
|
248
259
|
}
|
|
249
260
|
}
|
|
250
|
-
|
|
261
|
+
if (isStopped) {
|
|
262
|
+
isStopped = false;
|
|
263
|
+
runner.start();
|
|
264
|
+
}
|
|
265
|
+
return;
|
|
251
266
|
}
|
|
267
|
+
console.log(import_chalk3.default.bold(`=> ${diagnostic.messageText} [${diagnostic.code}]`));
|
|
252
268
|
};
|
|
253
269
|
const configPath = getConfigPath();
|
|
254
270
|
const createProgram = import_typescript3.default.createEmitAndSemanticDiagnosticsBuilderProgram;
|
|
@@ -263,41 +279,17 @@ function getHost(runner) {
|
|
|
263
279
|
return host;
|
|
264
280
|
}
|
|
265
281
|
|
|
266
|
-
// src/dev/watchAndCompile/watchDeletes.ts
|
|
267
|
-
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
268
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
|
269
|
-
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
270
|
-
async function watchDeletes() {
|
|
271
|
-
const projectPath = import_node_path3.default.resolve("./app");
|
|
272
|
-
const watcher = import_chokidar.default.watch(projectPath, {
|
|
273
|
-
ignoreInitial: true
|
|
274
|
-
});
|
|
275
|
-
watcher.on("unlink", async (filepath) => {
|
|
276
|
-
if (!filepath.endsWith(".ts")) return;
|
|
277
|
-
const relative = import_node_path3.default.relative(process.cwd(), filepath);
|
|
278
|
-
const atBuildPath = import_node_path3.default.resolve(".orion/build", relative.replace(/.ts$/, ""));
|
|
279
|
-
try {
|
|
280
|
-
import_node_fs5.default.unlinkSync(`${atBuildPath}.js`);
|
|
281
|
-
import_node_fs5.default.unlinkSync(`${atBuildPath}.d.ts`);
|
|
282
|
-
} catch (error) {
|
|
283
|
-
console.log(
|
|
284
|
-
`Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
|
|
290
282
|
// src/dev/watchAndCompile/writeEnvFile.ts
|
|
291
283
|
var import_env = require("@orion-js/env");
|
|
292
|
-
var
|
|
293
|
-
var
|
|
284
|
+
var import_chalk4 = __toESM(require("chalk"), 1);
|
|
285
|
+
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
294
286
|
var envFilePath = process.env.ORION_ENV_FILE_PATH;
|
|
295
287
|
var dtsFilePath = "./app/env.d.ts";
|
|
296
288
|
var watchEnvFile = async (runner) => {
|
|
297
289
|
if (!envFilePath) return;
|
|
298
290
|
(0, import_env.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
|
|
299
|
-
|
|
300
|
-
console.log(
|
|
291
|
+
import_chokidar.default.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
|
|
292
|
+
console.log(import_chalk4.default.bold("=> Environment file changed. Restarting..."));
|
|
301
293
|
(0, import_env.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
|
|
302
294
|
runner.restart();
|
|
303
295
|
});
|
|
@@ -308,15 +300,14 @@ async function watchAndCompile(runner) {
|
|
|
308
300
|
await cleanDirectory();
|
|
309
301
|
const host = getHost(runner);
|
|
310
302
|
import_typescript4.default.createWatchProgram(host);
|
|
311
|
-
watchDeletes();
|
|
312
303
|
watchEnvFile(runner);
|
|
313
304
|
}
|
|
314
305
|
|
|
315
306
|
// src/dev/copyCursorRule/index.ts
|
|
316
307
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
317
308
|
var import_node_https = __toESM(require("https"), 1);
|
|
318
|
-
var
|
|
319
|
-
var
|
|
309
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
310
|
+
var import_chalk5 = __toESM(require("chalk"), 1);
|
|
320
311
|
var rules = [
|
|
321
312
|
"orionjs.mdx",
|
|
322
313
|
"orionjs-component.mdx",
|
|
@@ -349,28 +340,28 @@ var downloadFile = (url) => {
|
|
|
349
340
|
async function copyCursorRule() {
|
|
350
341
|
const baseUrl = "https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc";
|
|
351
342
|
try {
|
|
352
|
-
const targetDir =
|
|
343
|
+
const targetDir = import_node_path3.default.join(process.cwd(), ".cursor", "rules");
|
|
353
344
|
await import_promises.default.mkdir(targetDir, { recursive: true });
|
|
354
345
|
await Promise.all(
|
|
355
346
|
rules.map(async (rule) => {
|
|
356
347
|
const targetFileName = rule.replace(".mdx", ".mdc");
|
|
357
|
-
const targetFile =
|
|
348
|
+
const targetFile = import_node_path3.default.join(targetDir, targetFileName);
|
|
358
349
|
const sourceUrl = `${baseUrl}/${rule}`;
|
|
359
350
|
const content = await downloadFile(sourceUrl);
|
|
360
351
|
await import_promises.default.writeFile(targetFile, content, "utf8");
|
|
361
|
-
console.log(
|
|
352
|
+
console.log(import_chalk5.default.bold(`=> \u2728 Successfully downloaded ${import_chalk5.default.cyan(targetFileName)}`));
|
|
362
353
|
})
|
|
363
354
|
);
|
|
364
|
-
console.log(
|
|
355
|
+
console.log(import_chalk5.default.bold("=> \u2728 All rule files have been successfully copied"));
|
|
365
356
|
} catch (error) {
|
|
366
|
-
console.error(
|
|
357
|
+
console.error(import_chalk5.default.red(`Error copying rule files: ${error.message}`));
|
|
367
358
|
}
|
|
368
359
|
}
|
|
369
360
|
|
|
370
361
|
// src/dev/copyMCP/index.ts
|
|
371
362
|
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
372
|
-
var
|
|
373
|
-
var
|
|
363
|
+
var import_node_path5 = __toESM(require("path"), 1);
|
|
364
|
+
var import_chalk7 = __toESM(require("chalk"), 1);
|
|
374
365
|
|
|
375
366
|
// src/dev/copyMCP/consts.ts
|
|
376
367
|
var MCP_VERSION = "v4";
|
|
@@ -378,8 +369,8 @@ var VERSION_FILE = "version.txt";
|
|
|
378
369
|
|
|
379
370
|
// src/dev/copyMCP/isValidMCPRepo.ts
|
|
380
371
|
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
381
|
-
var
|
|
382
|
-
var
|
|
372
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
373
|
+
var import_chalk6 = __toESM(require("chalk"), 1);
|
|
383
374
|
async function isValidMCPRepository(directoryPath) {
|
|
384
375
|
try {
|
|
385
376
|
const stats = await import_promises2.default.stat(directoryPath);
|
|
@@ -387,17 +378,17 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
387
378
|
const expectedFiles = ["settings.js", "package.json"];
|
|
388
379
|
for (const file of expectedFiles) {
|
|
389
380
|
try {
|
|
390
|
-
await import_promises2.default.access(
|
|
381
|
+
await import_promises2.default.access(import_node_path4.default.join(directoryPath, file));
|
|
391
382
|
} catch {
|
|
392
383
|
return false;
|
|
393
384
|
}
|
|
394
385
|
}
|
|
395
386
|
try {
|
|
396
|
-
const versionPath =
|
|
387
|
+
const versionPath = import_node_path4.default.join(directoryPath, VERSION_FILE);
|
|
397
388
|
const versionContent = await import_promises2.default.readFile(versionPath, "utf-8");
|
|
398
389
|
if (versionContent.trim() !== MCP_VERSION) {
|
|
399
390
|
console.log(
|
|
400
|
-
|
|
391
|
+
import_chalk6.default.yellow(
|
|
401
392
|
`=> \u2728 MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`
|
|
402
393
|
)
|
|
403
394
|
);
|
|
@@ -415,11 +406,11 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
415
406
|
// src/dev/copyMCP/index.ts
|
|
416
407
|
async function copyMCP() {
|
|
417
408
|
const repoUrl = "https://github.com/orionjs/mcp-docs";
|
|
418
|
-
const targetDir =
|
|
409
|
+
const targetDir = import_node_path5.default.join(process.cwd(), ".orion", "mcp");
|
|
419
410
|
try {
|
|
420
|
-
await import_promises3.default.mkdir(
|
|
411
|
+
await import_promises3.default.mkdir(import_node_path5.default.join(process.cwd(), ".orion"), { recursive: true });
|
|
421
412
|
if (await isValidMCPRepository(targetDir)) {
|
|
422
|
-
console.log(
|
|
413
|
+
console.log(import_chalk7.default.bold("=> \u2728 MCP documentation already installed"));
|
|
423
414
|
return;
|
|
424
415
|
}
|
|
425
416
|
try {
|
|
@@ -427,34 +418,34 @@ async function copyMCP() {
|
|
|
427
418
|
if (stats.isDirectory()) {
|
|
428
419
|
await import_promises3.default.rm(targetDir, { recursive: true, force: true });
|
|
429
420
|
console.log(
|
|
430
|
-
|
|
421
|
+
import_chalk7.default.bold(
|
|
431
422
|
"=> \u2728 Removed existing .orion/mcp directory (invalid, incomplete, or outdated)"
|
|
432
423
|
)
|
|
433
424
|
);
|
|
434
425
|
}
|
|
435
426
|
} catch (_) {
|
|
436
427
|
}
|
|
437
|
-
console.log(
|
|
428
|
+
console.log(import_chalk7.default.bold(`=> \u2728 Downloading MCP documentation ${MCP_VERSION}...`));
|
|
438
429
|
await execute_default(`git clone ${repoUrl} ${targetDir}`);
|
|
439
|
-
await execute_default(`rm -rf ${
|
|
440
|
-
await import_promises3.default.writeFile(
|
|
430
|
+
await execute_default(`rm -rf ${import_node_path5.default.join(targetDir, ".git")}`);
|
|
431
|
+
await import_promises3.default.writeFile(import_node_path5.default.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
|
|
441
432
|
console.log(
|
|
442
|
-
|
|
433
|
+
import_chalk7.default.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
|
|
443
434
|
);
|
|
444
|
-
console.log(
|
|
435
|
+
console.log(import_chalk7.default.bold("=> \u2728 Installing MCP dependencies..."));
|
|
445
436
|
await execute_default(`cd ${targetDir} && npm install`);
|
|
446
|
-
console.log(
|
|
447
|
-
const relativePath =
|
|
437
|
+
console.log(import_chalk7.default.bold("=> \u2728 Successfully installed MCP dependencies"));
|
|
438
|
+
const relativePath = import_node_path5.default.relative(process.cwd(), targetDir);
|
|
448
439
|
console.log(relativePath);
|
|
449
440
|
const mcpServerConfig = {
|
|
450
441
|
mcpServers: {
|
|
451
442
|
"Orionjs documentation search": {
|
|
452
443
|
command: "node",
|
|
453
|
-
args: [`./${
|
|
444
|
+
args: [`./${import_node_path5.default.join(relativePath, "src", "index.js")}`]
|
|
454
445
|
}
|
|
455
446
|
}
|
|
456
447
|
};
|
|
457
|
-
const configPath =
|
|
448
|
+
const configPath = import_node_path5.default.join(process.cwd(), ".cursor", "mcp.json");
|
|
458
449
|
try {
|
|
459
450
|
const existingConfig = await import_promises3.default.readFile(configPath, "utf-8");
|
|
460
451
|
const parsedConfig = JSON.parse(existingConfig);
|
|
@@ -463,23 +454,23 @@ async function copyMCP() {
|
|
|
463
454
|
...mcpServerConfig.mcpServers
|
|
464
455
|
};
|
|
465
456
|
await import_promises3.default.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), "utf-8");
|
|
466
|
-
console.log(
|
|
457
|
+
console.log(import_chalk7.default.bold("=> \u2728 Updated MCP server configuration in .cursor/mcp.json"));
|
|
467
458
|
} catch (_) {
|
|
468
|
-
await import_promises3.default.mkdir(
|
|
459
|
+
await import_promises3.default.mkdir(import_node_path5.default.dirname(configPath), { recursive: true });
|
|
469
460
|
await import_promises3.default.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), "utf-8");
|
|
470
|
-
console.log(
|
|
461
|
+
console.log(import_chalk7.default.bold("=> \u2728 Created new MCP server configuration in .cursor/mcp.json"));
|
|
471
462
|
}
|
|
472
463
|
} catch (error) {
|
|
473
|
-
console.error(
|
|
464
|
+
console.error(import_chalk7.default.red("=> \u2728 Error copying MCP documentation:"), error);
|
|
474
465
|
throw error;
|
|
475
466
|
}
|
|
476
467
|
}
|
|
477
468
|
|
|
478
469
|
// src/dev/index.ts
|
|
479
|
-
var
|
|
470
|
+
var import_chalk8 = __toESM(require("chalk"), 1);
|
|
480
471
|
async function dev_default(options, command) {
|
|
481
|
-
console.log(
|
|
482
|
-
Orionjs App ${
|
|
472
|
+
console.log(import_chalk8.default.bold(`
|
|
473
|
+
Orionjs App ${import_chalk8.default.green(import_chalk8.default.bold("V4"))} Dev mode
|
|
483
474
|
`));
|
|
484
475
|
if (!options.omitCursorRule) {
|
|
485
476
|
await copyCursorRule().catch(console.error);
|
|
@@ -488,14 +479,14 @@ Orionjs App ${import_chalk7.default.green(import_chalk7.default.bold("V4"))} Dev
|
|
|
488
479
|
await copyMCP().catch(console.error);
|
|
489
480
|
}
|
|
490
481
|
if (!options.omitMcpServer && !options.omitCursorRule) {
|
|
491
|
-
console.log(
|
|
482
|
+
console.log(import_chalk8.default.bold("=> \u2728 Orionjs AI is ready\n"));
|
|
492
483
|
}
|
|
493
484
|
const runner = getRunner(options, command);
|
|
494
485
|
watchAndCompile(runner);
|
|
495
486
|
}
|
|
496
487
|
|
|
497
488
|
// src/prod/index.ts
|
|
498
|
-
var
|
|
489
|
+
var import_chalk12 = __toESM(require("chalk"), 1);
|
|
499
490
|
|
|
500
491
|
// src/prod/runProd.ts
|
|
501
492
|
var import_node_child_process3 = require("child_process");
|
|
@@ -516,10 +507,10 @@ function runProd(options, command) {
|
|
|
516
507
|
}
|
|
517
508
|
|
|
518
509
|
// src/build/index.ts
|
|
519
|
-
var
|
|
510
|
+
var import_chalk11 = __toESM(require("chalk"), 1);
|
|
520
511
|
|
|
521
512
|
// src/build/build.ts
|
|
522
|
-
var
|
|
513
|
+
var import_chalk9 = __toESM(require("chalk"), 1);
|
|
523
514
|
var esbuild = __toESM(require("esbuild"), 1);
|
|
524
515
|
async function build2(options) {
|
|
525
516
|
const { output } = options;
|
|
@@ -537,11 +528,11 @@ async function build2(options) {
|
|
|
537
528
|
minify: true,
|
|
538
529
|
packages: "external"
|
|
539
530
|
});
|
|
540
|
-
console.log(
|
|
531
|
+
console.log(import_chalk9.default.green.bold("Build successful"));
|
|
541
532
|
}
|
|
542
533
|
|
|
543
534
|
// src/build/checkTs.ts
|
|
544
|
-
var
|
|
535
|
+
var import_chalk10 = __toESM(require("chalk"), 1);
|
|
545
536
|
var import_node_child_process4 = require("child_process");
|
|
546
537
|
var import_node_util = require("util");
|
|
547
538
|
var execPromise = (0, import_node_util.promisify)(import_node_child_process4.exec);
|
|
@@ -556,9 +547,9 @@ async function checkTs() {
|
|
|
556
547
|
gid: process.getgid(),
|
|
557
548
|
uid: process.getuid()
|
|
558
549
|
});
|
|
559
|
-
console.log(
|
|
550
|
+
console.log(import_chalk10.default.green.bold("TypeScript check passed"));
|
|
560
551
|
} catch (error) {
|
|
561
|
-
console.log(
|
|
552
|
+
console.log(import_chalk10.default.red.bold("TypeScript compilation failed"));
|
|
562
553
|
console.log(error.stderr || error.stdout || error.message);
|
|
563
554
|
process.exit(1);
|
|
564
555
|
}
|
|
@@ -566,19 +557,19 @@ async function checkTs() {
|
|
|
566
557
|
|
|
567
558
|
// src/build/index.ts
|
|
568
559
|
async function build_default(options) {
|
|
569
|
-
console.log(
|
|
560
|
+
console.log(import_chalk11.default.bold(`Building Orionjs App ${import_chalk11.default.green(import_chalk11.default.bold("V4"))}...`));
|
|
570
561
|
if (!options.output) {
|
|
571
562
|
options.output = "./build";
|
|
572
563
|
}
|
|
573
564
|
await cleanDirectory(options.output);
|
|
574
565
|
await Promise.all([checkTs(), build2(options)]);
|
|
575
|
-
console.log(
|
|
566
|
+
console.log(import_chalk11.default.bold("Build completed"));
|
|
576
567
|
}
|
|
577
568
|
|
|
578
569
|
// src/prod/index.ts
|
|
579
570
|
async function prod_default(options, command) {
|
|
580
|
-
console.log(
|
|
581
|
-
Orionjs App ${
|
|
571
|
+
console.log(import_chalk12.default.bold(`
|
|
572
|
+
Orionjs App ${import_chalk12.default.green(import_chalk12.default.bold("V4"))} Prod mode
|
|
582
573
|
`));
|
|
583
574
|
if (!options.path) {
|
|
584
575
|
await build_default({ output: "./build" });
|
|
@@ -588,16 +579,16 @@ Orionjs App ${import_chalk11.default.green(import_chalk11.default.bold("V4"))} P
|
|
|
588
579
|
}
|
|
589
580
|
|
|
590
581
|
// src/handleErrors.ts
|
|
591
|
-
var
|
|
582
|
+
var import_chalk13 = __toESM(require("chalk"), 1);
|
|
592
583
|
process.on("unhandledRejection", (error) => {
|
|
593
584
|
if (error.codeFrame) {
|
|
594
|
-
console.error(
|
|
585
|
+
console.error(import_chalk13.default.red(error.message));
|
|
595
586
|
console.log(error.codeFrame);
|
|
596
587
|
} else {
|
|
597
|
-
console.error(
|
|
588
|
+
console.error(import_chalk13.default.red(error.message), import_chalk13.default.red("Unhandled promise rejection"));
|
|
598
589
|
}
|
|
599
590
|
}).on("uncaughtException", (error) => {
|
|
600
|
-
console.error(
|
|
591
|
+
console.error(import_chalk13.default.red(error.message));
|
|
601
592
|
process.exit(1);
|
|
602
593
|
});
|
|
603
594
|
|
|
@@ -608,10 +599,10 @@ var version_default = "3.0";
|
|
|
608
599
|
var import_config = require("dotenv/config");
|
|
609
600
|
|
|
610
601
|
// src/check/index.ts
|
|
611
|
-
var
|
|
602
|
+
var import_chalk15 = __toESM(require("chalk"), 1);
|
|
612
603
|
|
|
613
604
|
// src/check/checkTs.ts
|
|
614
|
-
var
|
|
605
|
+
var import_chalk14 = __toESM(require("chalk"), 1);
|
|
615
606
|
var import_node_child_process5 = require("child_process");
|
|
616
607
|
function checkTs2() {
|
|
617
608
|
try {
|
|
@@ -625,18 +616,18 @@ function checkTs2() {
|
|
|
625
616
|
stdio: "inherit"
|
|
626
617
|
});
|
|
627
618
|
} catch {
|
|
628
|
-
console.log(
|
|
619
|
+
console.log(import_chalk14.default.red.bold("TypeScript compilation failed"));
|
|
629
620
|
process.exit(1);
|
|
630
621
|
}
|
|
631
622
|
}
|
|
632
623
|
|
|
633
624
|
// src/check/index.ts
|
|
634
625
|
async function check_default() {
|
|
635
|
-
console.log(
|
|
626
|
+
console.log(import_chalk15.default.bold(`Orionjs App ${import_chalk15.default.green(import_chalk15.default.bold("V4"))}
|
|
636
627
|
`));
|
|
637
628
|
console.log("Checking typescript...");
|
|
638
629
|
checkTs2();
|
|
639
|
-
console.log(
|
|
630
|
+
console.log(import_chalk15.default.bold.green("Check passed\n"));
|
|
640
631
|
}
|
|
641
632
|
|
|
642
633
|
// src/index.ts
|
|
@@ -645,10 +636,10 @@ var run = (action) => async (...args) => {
|
|
|
645
636
|
try {
|
|
646
637
|
await action(...args);
|
|
647
638
|
} catch (e) {
|
|
648
|
-
console.error(
|
|
639
|
+
console.error(import_chalk16.default.red(`Error: ${e.message}`));
|
|
649
640
|
}
|
|
650
641
|
};
|
|
651
|
-
program.command("dev").description("Run the Orionjs app in development mode").option("--
|
|
642
|
+
program.command("dev").description("Run the Orionjs app in development mode").option("--omit-cursor-rule", "Omit the creation of the Orionjs Cursor rule").option("--omit-mcp-server", "Omit the creation of the Orionjs MCP server").allowUnknownOption().action(run(dev_default));
|
|
652
643
|
program.command("check").description("Runs a typescript check").action(run(check_default));
|
|
653
644
|
program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
|
|
654
645
|
program.command("prod").allowUnknownOption().option(
|