@orion-js/core 4.0.0-next.2 → 4.0.0-next.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/LICENSE +21 -0
- package/dist/index.cjs +71 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +71 -111
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
2
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
3
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
4
|
}) : x)(function(x) {
|
|
@@ -9,7 +7,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
9
7
|
});
|
|
10
8
|
|
|
11
9
|
// src/index.ts
|
|
12
|
-
import "reflect-metadata";
|
|
13
10
|
import { Command } from "commander";
|
|
14
11
|
|
|
15
12
|
// src/start/index.ts
|
|
@@ -24,12 +21,12 @@ import fs2 from "fs";
|
|
|
24
21
|
// src/helpers/ensureDirectory.ts
|
|
25
22
|
import fs from "fs";
|
|
26
23
|
import path from "path";
|
|
27
|
-
var ensureDirectory =
|
|
24
|
+
var ensureDirectory = function(filePath) {
|
|
28
25
|
const dirname = path.dirname(filePath);
|
|
29
26
|
if (fs.existsSync(dirname)) return true;
|
|
30
27
|
ensureDirectory(dirname);
|
|
31
28
|
fs.mkdirSync(dirname);
|
|
32
|
-
}
|
|
29
|
+
};
|
|
33
30
|
var ensureDirectory_default = ensureDirectory;
|
|
34
31
|
|
|
35
32
|
// src/helpers/writeFile.ts
|
|
@@ -37,7 +34,6 @@ async function writeFile_default(path9, content) {
|
|
|
37
34
|
ensureDirectory_default(path9);
|
|
38
35
|
fs2.writeFileSync(path9, content);
|
|
39
36
|
}
|
|
40
|
-
__name(writeFile_default, "default");
|
|
41
37
|
|
|
42
38
|
// src/start/runner/startProcess.ts
|
|
43
39
|
import { spawn } from "child_process";
|
|
@@ -50,20 +46,13 @@ function getArgs(options) {
|
|
|
50
46
|
const [first, ...otherArgs] = process.env.START_COMMAND.split(" ");
|
|
51
47
|
startCommand = first;
|
|
52
48
|
args.push(...otherArgs);
|
|
53
|
-
console.log("Using custom command: " + [
|
|
54
|
-
startCommand,
|
|
55
|
-
...args
|
|
56
|
-
].join(" "));
|
|
49
|
+
console.log("Using custom command: " + [startCommand, ...args].join(" "));
|
|
57
50
|
} else if (options.shell) {
|
|
58
51
|
args.push("--inspect");
|
|
59
52
|
}
|
|
60
53
|
args.push(".orion/build/index.js");
|
|
61
|
-
return {
|
|
62
|
-
startCommand,
|
|
63
|
-
args
|
|
64
|
-
};
|
|
54
|
+
return { startCommand, args };
|
|
65
55
|
}
|
|
66
|
-
__name(getArgs, "getArgs");
|
|
67
56
|
|
|
68
57
|
// src/start/runner/startProcess.ts
|
|
69
58
|
function startProcess(options) {
|
|
@@ -78,7 +67,6 @@ function startProcess(options) {
|
|
|
78
67
|
detached: false
|
|
79
68
|
});
|
|
80
69
|
}
|
|
81
|
-
__name(startProcess, "startProcess");
|
|
82
70
|
|
|
83
71
|
// src/start/runner/index.ts
|
|
84
72
|
function getRunner(options) {
|
|
@@ -86,7 +74,7 @@ function getRunner(options) {
|
|
|
86
74
|
if (options.clean) {
|
|
87
75
|
console.log(colors.bold("=> Cleaning directory...\n"));
|
|
88
76
|
}
|
|
89
|
-
const start =
|
|
77
|
+
const start = () => {
|
|
90
78
|
console.log(colors.bold("=> Starting app...\n"));
|
|
91
79
|
appProcess = startProcess(options);
|
|
92
80
|
appProcess.on("exit", function(code, signal) {
|
|
@@ -96,23 +84,22 @@ function getRunner(options) {
|
|
|
96
84
|
}
|
|
97
85
|
});
|
|
98
86
|
writeFile_default(".orion/process", `${appProcess.pid}`);
|
|
99
|
-
}
|
|
100
|
-
const stop =
|
|
87
|
+
};
|
|
88
|
+
const stop = () => {
|
|
101
89
|
if (appProcess) {
|
|
102
90
|
appProcess.kill();
|
|
103
91
|
}
|
|
104
|
-
}
|
|
105
|
-
const restart =
|
|
92
|
+
};
|
|
93
|
+
const restart = () => {
|
|
106
94
|
stop();
|
|
107
95
|
start();
|
|
108
|
-
}
|
|
96
|
+
};
|
|
109
97
|
return {
|
|
110
98
|
restart,
|
|
111
99
|
stop,
|
|
112
100
|
basePath: `${process.cwd()}/.orion/build`
|
|
113
101
|
};
|
|
114
102
|
}
|
|
115
|
-
__name(getRunner, "getRunner");
|
|
116
103
|
|
|
117
104
|
// src/start/watchAndCompile/index.ts
|
|
118
105
|
import ts4 from "typescript";
|
|
@@ -133,7 +120,6 @@ function rimraf(dir_path) {
|
|
|
133
120
|
fs3.rmdirSync(dir_path);
|
|
134
121
|
}
|
|
135
122
|
}
|
|
136
|
-
__name(rimraf, "rimraf");
|
|
137
123
|
async function cleanDirectory() {
|
|
138
124
|
try {
|
|
139
125
|
const path9 = `${process.cwd()}/.orion/build`;
|
|
@@ -141,7 +127,6 @@ async function cleanDirectory() {
|
|
|
141
127
|
} catch {
|
|
142
128
|
}
|
|
143
129
|
}
|
|
144
|
-
__name(cleanDirectory, "cleanDirectory");
|
|
145
130
|
|
|
146
131
|
// src/start/watchAndCompile/getHost.ts
|
|
147
132
|
import ts3 from "typescript";
|
|
@@ -155,7 +140,6 @@ function readFile(filePath) {
|
|
|
155
140
|
if (!fs4.existsSync(filePath)) return null;
|
|
156
141
|
return fs4.readFileSync(filePath).toString();
|
|
157
142
|
}
|
|
158
|
-
__name(readFile, "readFile");
|
|
159
143
|
|
|
160
144
|
// src/start/watchAndCompile/ensureConfigComplies.ts
|
|
161
145
|
import { parse, stringify } from "comment-json";
|
|
@@ -180,7 +164,6 @@ function ensureConfigComplies(configPath) {
|
|
|
180
164
|
console.log(`Error reading tsconfig ${error.message}`);
|
|
181
165
|
}
|
|
182
166
|
}
|
|
183
|
-
__name(ensureConfigComplies, "ensureConfigComplies");
|
|
184
167
|
|
|
185
168
|
// src/start/watchAndCompile/getConfigPath.ts
|
|
186
169
|
function getConfigPath() {
|
|
@@ -192,21 +175,17 @@ function getConfigPath() {
|
|
|
192
175
|
ensureConfigComplies(configPath);
|
|
193
176
|
return configPath;
|
|
194
177
|
}
|
|
195
|
-
__name(getConfigPath, "getConfigPath");
|
|
196
178
|
|
|
197
179
|
// src/start/watchAndCompile/reports.ts
|
|
198
180
|
import ts2 from "typescript";
|
|
199
181
|
var format = {
|
|
200
|
-
getCanonicalFileName:
|
|
201
|
-
getCurrentDirectory:
|
|
202
|
-
getNewLine:
|
|
182
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
183
|
+
getCurrentDirectory: () => process.cwd(),
|
|
184
|
+
getNewLine: () => ts2.sys.newLine
|
|
203
185
|
};
|
|
204
186
|
function reportDiagnostic(diagnostic) {
|
|
205
|
-
console.log(ts2.formatDiagnosticsWithColorAndContext([
|
|
206
|
-
diagnostic
|
|
207
|
-
], format));
|
|
187
|
+
console.log(ts2.formatDiagnosticsWithColorAndContext([diagnostic], format));
|
|
208
188
|
}
|
|
209
|
-
__name(reportDiagnostic, "reportDiagnostic");
|
|
210
189
|
|
|
211
190
|
// src/start/watchAndCompile/getHost.ts
|
|
212
191
|
import colors2 from "colors/safe";
|
|
@@ -220,24 +199,29 @@ function writeIndex_default({ basePath }) {
|
|
|
220
199
|
const libContent = fs5.readFileSync(libContentPath).toString();
|
|
221
200
|
writeFile_default(libPath, libContent);
|
|
222
201
|
const aliasPath = `${basePath}/moduleAlias.js`;
|
|
223
|
-
writeFile_default(
|
|
202
|
+
writeFile_default(
|
|
203
|
+
aliasPath,
|
|
204
|
+
`"use strict";
|
|
224
205
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
225
206
|
const moduleAlias = require('./moduleAliasLib')
|
|
226
207
|
const path = __dirname + '/app'
|
|
227
208
|
moduleAlias.addAlias('app', path)
|
|
228
|
-
`
|
|
209
|
+
`
|
|
210
|
+
);
|
|
229
211
|
const indexPath = `${basePath}/index.js`;
|
|
230
|
-
writeFile_default(
|
|
212
|
+
writeFile_default(
|
|
213
|
+
indexPath,
|
|
214
|
+
`"use strict";
|
|
231
215
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
232
216
|
require("./moduleAlias");
|
|
233
217
|
require("./app");
|
|
234
|
-
`
|
|
218
|
+
`
|
|
219
|
+
);
|
|
235
220
|
}
|
|
236
|
-
__name(writeIndex_default, "default");
|
|
237
221
|
|
|
238
222
|
// src/start/watchAndCompile/getHost.ts
|
|
239
223
|
function getHost(runner) {
|
|
240
|
-
const reportWatchStatusChanged =
|
|
224
|
+
const reportWatchStatusChanged = (diagnostic) => {
|
|
241
225
|
if (diagnostic.category !== 3) return;
|
|
242
226
|
if (diagnostic.code === 6032 || diagnostic.code === 6031) {
|
|
243
227
|
runner.stop();
|
|
@@ -249,18 +233,22 @@ function getHost(runner) {
|
|
|
249
233
|
return;
|
|
250
234
|
}
|
|
251
235
|
}
|
|
252
|
-
writeIndex_default({
|
|
253
|
-
basePath: runner.basePath
|
|
254
|
-
});
|
|
236
|
+
writeIndex_default({ basePath: runner.basePath });
|
|
255
237
|
runner.restart();
|
|
256
238
|
}
|
|
257
|
-
}
|
|
239
|
+
};
|
|
258
240
|
const configPath = getConfigPath();
|
|
259
241
|
const createProgram = ts3.createEmitAndSemanticDiagnosticsBuilderProgram;
|
|
260
|
-
const host = ts3.createWatchCompilerHost(
|
|
242
|
+
const host = ts3.createWatchCompilerHost(
|
|
243
|
+
configPath,
|
|
244
|
+
{},
|
|
245
|
+
ts3.sys,
|
|
246
|
+
createProgram,
|
|
247
|
+
reportDiagnostic,
|
|
248
|
+
reportWatchStatusChanged
|
|
249
|
+
);
|
|
261
250
|
return host;
|
|
262
251
|
}
|
|
263
|
-
__name(getHost, "getHost");
|
|
264
252
|
|
|
265
253
|
// src/start/watchAndCompile/watchDeletes.ts
|
|
266
254
|
import chokidar from "chokidar";
|
|
@@ -279,11 +267,12 @@ async function watchDeletes() {
|
|
|
279
267
|
fs6.unlinkSync(`${atBuildPath}.js`);
|
|
280
268
|
fs6.unlinkSync(`${atBuildPath}.d.ts`);
|
|
281
269
|
} catch (error) {
|
|
282
|
-
console.log(
|
|
270
|
+
console.log(
|
|
271
|
+
`Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`
|
|
272
|
+
);
|
|
283
273
|
}
|
|
284
274
|
});
|
|
285
275
|
}
|
|
286
|
-
__name(watchDeletes, "watchDeletes");
|
|
287
276
|
|
|
288
277
|
// src/start/watchAndCompile/writeEnvFile.ts
|
|
289
278
|
import chokidar2 from "chokidar";
|
|
@@ -291,17 +280,15 @@ import colors3 from "colors/safe";
|
|
|
291
280
|
import { writeDtsFileFromConfigFile } from "@orion-js/env";
|
|
292
281
|
var envFilePath = process.env.ORION_ENV_FILE_PATH;
|
|
293
282
|
var dtsFilePath = "./app/env.d.ts";
|
|
294
|
-
var watchEnvFile =
|
|
283
|
+
var watchEnvFile = async (runner) => {
|
|
295
284
|
if (!envFilePath) return;
|
|
296
285
|
writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
|
|
297
|
-
chokidar2.watch(envFilePath, {
|
|
298
|
-
ignoreInitial: true
|
|
299
|
-
}).on("change", async () => {
|
|
286
|
+
chokidar2.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
|
|
300
287
|
console.log(colors3.bold(`=> Environment file changed. Restarting...`));
|
|
301
288
|
writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
|
|
302
289
|
runner.restart();
|
|
303
290
|
});
|
|
304
|
-
}
|
|
291
|
+
};
|
|
305
292
|
|
|
306
293
|
// src/start/watchAndCompile/index.ts
|
|
307
294
|
async function watchAndCompile(runner) {
|
|
@@ -311,7 +298,6 @@ async function watchAndCompile(runner) {
|
|
|
311
298
|
watchDeletes();
|
|
312
299
|
watchEnvFile(runner);
|
|
313
300
|
}
|
|
314
|
-
__name(watchAndCompile, "watchAndCompile");
|
|
315
301
|
|
|
316
302
|
// src/start/copyCursorRule/index.ts
|
|
317
303
|
import path5 from "path";
|
|
@@ -326,7 +312,7 @@ var rules = [
|
|
|
326
312
|
"orionjs-services.mdx",
|
|
327
313
|
"orionjs-resolvers.mdx"
|
|
328
314
|
];
|
|
329
|
-
var downloadFile =
|
|
315
|
+
var downloadFile = (url) => {
|
|
330
316
|
return new Promise((resolve, reject) => {
|
|
331
317
|
https.get(url, (response) => {
|
|
332
318
|
if (response.statusCode !== 200) {
|
|
@@ -345,14 +331,12 @@ var downloadFile = /* @__PURE__ */ __name((url) => {
|
|
|
345
331
|
});
|
|
346
332
|
});
|
|
347
333
|
});
|
|
348
|
-
}
|
|
334
|
+
};
|
|
349
335
|
async function copyCursorRule() {
|
|
350
336
|
const baseUrl = `https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc`;
|
|
351
337
|
try {
|
|
352
338
|
const targetDir = path5.join(process.cwd(), ".cursor", "rules");
|
|
353
|
-
await fs7.mkdir(targetDir, {
|
|
354
|
-
recursive: true
|
|
355
|
-
});
|
|
339
|
+
await fs7.mkdir(targetDir, { recursive: true });
|
|
356
340
|
for (const rule of rules) {
|
|
357
341
|
const targetFileName = rule.replace(".mdx", ".mdc");
|
|
358
342
|
const targetFile = path5.join(targetDir, targetFileName);
|
|
@@ -366,7 +350,6 @@ async function copyCursorRule() {
|
|
|
366
350
|
console.error(colors4.red(`Error copying rule files: ${error.message}`));
|
|
367
351
|
}
|
|
368
352
|
}
|
|
369
|
-
__name(copyCursorRule, "copyCursorRule");
|
|
370
353
|
|
|
371
354
|
// src/start/copyMCP/index.ts
|
|
372
355
|
import path7 from "path";
|
|
@@ -380,15 +363,11 @@ async function execute_default(command) {
|
|
|
380
363
|
if (error) {
|
|
381
364
|
reject(error);
|
|
382
365
|
} else {
|
|
383
|
-
resolve({
|
|
384
|
-
stdout,
|
|
385
|
-
stderr
|
|
386
|
-
});
|
|
366
|
+
resolve({ stdout, stderr });
|
|
387
367
|
}
|
|
388
368
|
});
|
|
389
369
|
});
|
|
390
370
|
}
|
|
391
|
-
__name(execute_default, "default");
|
|
392
371
|
|
|
393
372
|
// src/start/copyMCP/index.ts
|
|
394
373
|
import colors6 from "colors/safe";
|
|
@@ -407,10 +386,7 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
407
386
|
try {
|
|
408
387
|
const stats = await fs8.stat(directoryPath);
|
|
409
388
|
if (!stats.isDirectory()) return false;
|
|
410
|
-
const expectedFiles = [
|
|
411
|
-
"settings.js",
|
|
412
|
-
"package.json"
|
|
413
|
-
];
|
|
389
|
+
const expectedFiles = ["settings.js", "package.json"];
|
|
414
390
|
for (const file of expectedFiles) {
|
|
415
391
|
try {
|
|
416
392
|
await fs8.access(path6.join(directoryPath, file));
|
|
@@ -422,7 +398,11 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
422
398
|
const versionPath = path6.join(directoryPath, VERSION_FILE);
|
|
423
399
|
const versionContent = await fs8.readFile(versionPath, "utf-8");
|
|
424
400
|
if (versionContent.trim() !== MCP_VERSION) {
|
|
425
|
-
console.log(
|
|
401
|
+
console.log(
|
|
402
|
+
colors5.yellow(
|
|
403
|
+
`=> \u2728 MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`
|
|
404
|
+
)
|
|
405
|
+
);
|
|
426
406
|
return false;
|
|
427
407
|
}
|
|
428
408
|
} catch {
|
|
@@ -433,16 +413,13 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
433
413
|
return false;
|
|
434
414
|
}
|
|
435
415
|
}
|
|
436
|
-
__name(isValidMCPRepository, "isValidMCPRepository");
|
|
437
416
|
|
|
438
417
|
// src/start/copyMCP/index.ts
|
|
439
418
|
async function copyMCP() {
|
|
440
419
|
const repoUrl = "https://github.com/orionjs/mcp-docs";
|
|
441
420
|
const targetDir = path7.join(process.cwd(), ".orion", "mcp");
|
|
442
421
|
try {
|
|
443
|
-
await fs9.mkdir(path7.join(process.cwd(), ".orion"), {
|
|
444
|
-
recursive: true
|
|
445
|
-
});
|
|
422
|
+
await fs9.mkdir(path7.join(process.cwd(), ".orion"), { recursive: true });
|
|
446
423
|
if (await isValidMCPRepository(targetDir)) {
|
|
447
424
|
console.log(colors6.bold(`=> \u2728 MCP documentation already installed`));
|
|
448
425
|
return;
|
|
@@ -450,11 +427,12 @@ async function copyMCP() {
|
|
|
450
427
|
try {
|
|
451
428
|
const stats = await fs9.stat(targetDir);
|
|
452
429
|
if (stats.isDirectory()) {
|
|
453
|
-
await fs9.rm(targetDir, {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
430
|
+
await fs9.rm(targetDir, { recursive: true, force: true });
|
|
431
|
+
console.log(
|
|
432
|
+
colors6.bold(
|
|
433
|
+
`=> \u2728 Removed existing .orion/mcp directory (invalid, incomplete, or outdated)`
|
|
434
|
+
)
|
|
435
|
+
);
|
|
458
436
|
}
|
|
459
437
|
} catch (error) {
|
|
460
438
|
}
|
|
@@ -462,17 +440,17 @@ async function copyMCP() {
|
|
|
462
440
|
await execute_default(`git clone ${repoUrl} ${targetDir}`);
|
|
463
441
|
await execute_default(`rm -rf ${path7.join(targetDir, ".git")}`);
|
|
464
442
|
await fs9.writeFile(path7.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
|
|
465
|
-
console.log(
|
|
443
|
+
console.log(
|
|
444
|
+
colors6.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
|
|
445
|
+
);
|
|
466
446
|
console.log(colors6.bold(`=> \u2728 Installing MCP dependencies...`));
|
|
467
447
|
await execute_default(`cd ${targetDir} && npm install`);
|
|
468
448
|
console.log(colors6.bold(`=> \u2728 Successfully installed MCP dependencies`));
|
|
469
449
|
const mcpServerConfig = {
|
|
470
|
-
|
|
450
|
+
mcpServers: {
|
|
471
451
|
"Orionjs documentation search": {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
path7.join(targetDir, "src", "index.js")
|
|
475
|
-
]
|
|
452
|
+
command: "node",
|
|
453
|
+
args: [path7.join(targetDir, "src", "index.js")]
|
|
476
454
|
}
|
|
477
455
|
}
|
|
478
456
|
};
|
|
@@ -487,9 +465,7 @@ async function copyMCP() {
|
|
|
487
465
|
await fs9.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), "utf-8");
|
|
488
466
|
console.log(colors6.bold(`=> \u2728 Updated MCP server configuration in .cursor/mcp.json`));
|
|
489
467
|
} catch (error) {
|
|
490
|
-
await fs9.mkdir(path7.dirname(configPath), {
|
|
491
|
-
recursive: true
|
|
492
|
-
});
|
|
468
|
+
await fs9.mkdir(path7.dirname(configPath), { recursive: true });
|
|
493
469
|
await fs9.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), "utf-8");
|
|
494
470
|
console.log(colors6.bold(`=> \u2728 Created new MCP server configuration in .cursor/mcp.json`));
|
|
495
471
|
}
|
|
@@ -498,7 +474,6 @@ async function copyMCP() {
|
|
|
498
474
|
throw error;
|
|
499
475
|
}
|
|
500
476
|
}
|
|
501
|
-
__name(copyMCP, "copyMCP");
|
|
502
477
|
|
|
503
478
|
// src/start/index.ts
|
|
504
479
|
async function start_default(options) {
|
|
@@ -516,7 +491,6 @@ async function start_default(options) {
|
|
|
516
491
|
const runner = getRunner(options);
|
|
517
492
|
watchAndCompile(runner);
|
|
518
493
|
}
|
|
519
|
-
__name(start_default, "default");
|
|
520
494
|
|
|
521
495
|
// src/build/index.ts
|
|
522
496
|
import colors9 from "colors/safe";
|
|
@@ -539,7 +513,6 @@ function getCompilerOptionsJSONFollowExtends(filename) {
|
|
|
539
513
|
...config.compilerOptions
|
|
540
514
|
};
|
|
541
515
|
}
|
|
542
|
-
__name(getCompilerOptionsJSONFollowExtends, "getCompilerOptionsJSONFollowExtends");
|
|
543
516
|
function getOptions({ output }) {
|
|
544
517
|
const configPath = getConfigPath();
|
|
545
518
|
const config = getCompilerOptionsJSONFollowExtends(configPath);
|
|
@@ -552,17 +525,12 @@ function getOptions({ output }) {
|
|
|
552
525
|
}
|
|
553
526
|
return options;
|
|
554
527
|
}
|
|
555
|
-
__name(getOptions, "getOptions");
|
|
556
528
|
|
|
557
529
|
// src/build/compile.ts
|
|
558
530
|
import colors8 from "colors/safe";
|
|
559
531
|
function compile({ output }) {
|
|
560
|
-
const options = getOptions({
|
|
561
|
-
|
|
562
|
-
});
|
|
563
|
-
const program2 = ts6.createProgram([
|
|
564
|
-
"./app/index.ts"
|
|
565
|
-
], options);
|
|
532
|
+
const options = getOptions({ output });
|
|
533
|
+
const program2 = ts6.createProgram(["./app/index.ts"], options);
|
|
566
534
|
const preEmitDiagnostics = ts6.getPreEmitDiagnostics(program2);
|
|
567
535
|
if (preEmitDiagnostics.length > 0) {
|
|
568
536
|
console.log(colors8.red(`
|
|
@@ -579,7 +547,6 @@ function compile({ output }) {
|
|
|
579
547
|
process.exit(1);
|
|
580
548
|
}
|
|
581
549
|
}
|
|
582
|
-
__name(compile, "compile");
|
|
583
550
|
|
|
584
551
|
// src/build/index.ts
|
|
585
552
|
async function build_default({ output }) {
|
|
@@ -589,15 +556,10 @@ async function build_default({ output }) {
|
|
|
589
556
|
console.log(colors9.bold(`Cleaning directory ${output}...`));
|
|
590
557
|
await execute_default(`rm -rf ${output}`);
|
|
591
558
|
console.log(colors9.bold("Compiling your app..."));
|
|
592
|
-
compile({
|
|
593
|
-
|
|
594
|
-
});
|
|
595
|
-
writeIndex_default({
|
|
596
|
-
basePath: output
|
|
597
|
-
});
|
|
559
|
+
compile({ output });
|
|
560
|
+
writeIndex_default({ basePath: output });
|
|
598
561
|
console.log(colors9.bold("Build created"));
|
|
599
562
|
}
|
|
600
|
-
__name(build_default, "default");
|
|
601
563
|
|
|
602
564
|
// src/create/index.ts
|
|
603
565
|
async function create_default({ name, kit }) {
|
|
@@ -613,7 +575,6 @@ async function create_default({ name, kit }) {
|
|
|
613
575
|
await execute_default(`cd ${name} && rm -rf .git`);
|
|
614
576
|
console.log("Your starter kit is ready");
|
|
615
577
|
}
|
|
616
|
-
__name(create_default, "default");
|
|
617
578
|
|
|
618
579
|
// src/index.ts
|
|
619
580
|
import colors12 from "colors/safe";
|
|
@@ -625,7 +586,6 @@ function test_default() {
|
|
|
625
586
|
console.log(colors10.bold(`ORION_DEV=LOCAL ORION_TEST=1 jest`));
|
|
626
587
|
process.exit(1);
|
|
627
588
|
}
|
|
628
|
-
__name(test_default, "default");
|
|
629
589
|
|
|
630
590
|
// src/handleErrors.ts
|
|
631
591
|
import colors11 from "colors";
|
|
@@ -647,7 +607,7 @@ var version_default = `3.0`;
|
|
|
647
607
|
// src/index.ts
|
|
648
608
|
import "dotenv/config";
|
|
649
609
|
var program = new Command();
|
|
650
|
-
var run =
|
|
610
|
+
var run = function(action) {
|
|
651
611
|
return async function(...args) {
|
|
652
612
|
try {
|
|
653
613
|
await action(...args);
|
|
@@ -655,7 +615,7 @@ var run = /* @__PURE__ */ __name(function(action) {
|
|
|
655
615
|
console.error(colors12.red("Error: " + e.message));
|
|
656
616
|
}
|
|
657
617
|
};
|
|
658
|
-
}
|
|
618
|
+
};
|
|
659
619
|
program.command("start").description("Run the Orionjs app").option("--shell", "Opens a shell in Chrome developer tools").option("--clean", "Build the typescript project from scratch").option("--omit-cursor-rule", "Omit the creation of the Orionjs Cursor rule").option("--omit-mcp-server", "Omit the creation of the Orionjs MCP server").action(run(start_default));
|
|
660
620
|
program.command("test").allowUnknownOption().description("Deprecated command").action(run(test_default));
|
|
661
621
|
program.command("build").description("Compiles an Orionjs app and exports it to a simple nodejs app").option("-o, --output [output]", "Output directory").action(run(build_default));
|