@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Orionjs Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
8
|
var __copyProps = (to, from, except, desc) => {
|
|
10
9
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
10
|
for (let key of __getOwnPropNames(from))
|
|
@@ -24,7 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
23
|
));
|
|
25
24
|
|
|
26
25
|
// src/index.ts
|
|
27
|
-
var import_reflect_metadata = require("reflect-metadata");
|
|
28
26
|
var import_commander = require("commander");
|
|
29
27
|
|
|
30
28
|
// src/start/index.ts
|
|
@@ -39,12 +37,12 @@ var import_fs2 = __toESM(require("fs"), 1);
|
|
|
39
37
|
// src/helpers/ensureDirectory.ts
|
|
40
38
|
var import_fs = __toESM(require("fs"), 1);
|
|
41
39
|
var import_path = __toESM(require("path"), 1);
|
|
42
|
-
var ensureDirectory =
|
|
40
|
+
var ensureDirectory = function(filePath) {
|
|
43
41
|
const dirname = import_path.default.dirname(filePath);
|
|
44
42
|
if (import_fs.default.existsSync(dirname)) return true;
|
|
45
43
|
ensureDirectory(dirname);
|
|
46
44
|
import_fs.default.mkdirSync(dirname);
|
|
47
|
-
}
|
|
45
|
+
};
|
|
48
46
|
var ensureDirectory_default = ensureDirectory;
|
|
49
47
|
|
|
50
48
|
// src/helpers/writeFile.ts
|
|
@@ -52,7 +50,6 @@ async function writeFile_default(path9, content) {
|
|
|
52
50
|
ensureDirectory_default(path9);
|
|
53
51
|
import_fs2.default.writeFileSync(path9, content);
|
|
54
52
|
}
|
|
55
|
-
__name(writeFile_default, "default");
|
|
56
53
|
|
|
57
54
|
// src/start/runner/startProcess.ts
|
|
58
55
|
var import_child_process = require("child_process");
|
|
@@ -65,20 +62,13 @@ function getArgs(options) {
|
|
|
65
62
|
const [first, ...otherArgs] = process.env.START_COMMAND.split(" ");
|
|
66
63
|
startCommand = first;
|
|
67
64
|
args.push(...otherArgs);
|
|
68
|
-
console.log("Using custom command: " + [
|
|
69
|
-
startCommand,
|
|
70
|
-
...args
|
|
71
|
-
].join(" "));
|
|
65
|
+
console.log("Using custom command: " + [startCommand, ...args].join(" "));
|
|
72
66
|
} else if (options.shell) {
|
|
73
67
|
args.push("--inspect");
|
|
74
68
|
}
|
|
75
69
|
args.push(".orion/build/index.js");
|
|
76
|
-
return {
|
|
77
|
-
startCommand,
|
|
78
|
-
args
|
|
79
|
-
};
|
|
70
|
+
return { startCommand, args };
|
|
80
71
|
}
|
|
81
|
-
__name(getArgs, "getArgs");
|
|
82
72
|
|
|
83
73
|
// src/start/runner/startProcess.ts
|
|
84
74
|
function startProcess(options) {
|
|
@@ -93,7 +83,6 @@ function startProcess(options) {
|
|
|
93
83
|
detached: false
|
|
94
84
|
});
|
|
95
85
|
}
|
|
96
|
-
__name(startProcess, "startProcess");
|
|
97
86
|
|
|
98
87
|
// src/start/runner/index.ts
|
|
99
88
|
function getRunner(options) {
|
|
@@ -101,7 +90,7 @@ function getRunner(options) {
|
|
|
101
90
|
if (options.clean) {
|
|
102
91
|
console.log(import_safe.default.bold("=> Cleaning directory...\n"));
|
|
103
92
|
}
|
|
104
|
-
const start =
|
|
93
|
+
const start = () => {
|
|
105
94
|
console.log(import_safe.default.bold("=> Starting app...\n"));
|
|
106
95
|
appProcess = startProcess(options);
|
|
107
96
|
appProcess.on("exit", function(code, signal) {
|
|
@@ -111,23 +100,22 @@ function getRunner(options) {
|
|
|
111
100
|
}
|
|
112
101
|
});
|
|
113
102
|
writeFile_default(".orion/process", `${appProcess.pid}`);
|
|
114
|
-
}
|
|
115
|
-
const stop =
|
|
103
|
+
};
|
|
104
|
+
const stop = () => {
|
|
116
105
|
if (appProcess) {
|
|
117
106
|
appProcess.kill();
|
|
118
107
|
}
|
|
119
|
-
}
|
|
120
|
-
const restart =
|
|
108
|
+
};
|
|
109
|
+
const restart = () => {
|
|
121
110
|
stop();
|
|
122
111
|
start();
|
|
123
|
-
}
|
|
112
|
+
};
|
|
124
113
|
return {
|
|
125
114
|
restart,
|
|
126
115
|
stop,
|
|
127
116
|
basePath: `${process.cwd()}/.orion/build`
|
|
128
117
|
};
|
|
129
118
|
}
|
|
130
|
-
__name(getRunner, "getRunner");
|
|
131
119
|
|
|
132
120
|
// src/start/watchAndCompile/index.ts
|
|
133
121
|
var import_typescript4 = __toESM(require("typescript"), 1);
|
|
@@ -148,7 +136,6 @@ function rimraf(dir_path) {
|
|
|
148
136
|
import_fs3.default.rmdirSync(dir_path);
|
|
149
137
|
}
|
|
150
138
|
}
|
|
151
|
-
__name(rimraf, "rimraf");
|
|
152
139
|
async function cleanDirectory() {
|
|
153
140
|
try {
|
|
154
141
|
const path9 = `${process.cwd()}/.orion/build`;
|
|
@@ -156,7 +143,6 @@ async function cleanDirectory() {
|
|
|
156
143
|
} catch {
|
|
157
144
|
}
|
|
158
145
|
}
|
|
159
|
-
__name(cleanDirectory, "cleanDirectory");
|
|
160
146
|
|
|
161
147
|
// src/start/watchAndCompile/getHost.ts
|
|
162
148
|
var import_typescript3 = __toESM(require("typescript"), 1);
|
|
@@ -170,7 +156,6 @@ function readFile(filePath) {
|
|
|
170
156
|
if (!import_fs4.default.existsSync(filePath)) return null;
|
|
171
157
|
return import_fs4.default.readFileSync(filePath).toString();
|
|
172
158
|
}
|
|
173
|
-
__name(readFile, "readFile");
|
|
174
159
|
|
|
175
160
|
// src/start/watchAndCompile/ensureConfigComplies.ts
|
|
176
161
|
var import_comment_json = require("comment-json");
|
|
@@ -195,7 +180,6 @@ function ensureConfigComplies(configPath) {
|
|
|
195
180
|
console.log(`Error reading tsconfig ${error.message}`);
|
|
196
181
|
}
|
|
197
182
|
}
|
|
198
|
-
__name(ensureConfigComplies, "ensureConfigComplies");
|
|
199
183
|
|
|
200
184
|
// src/start/watchAndCompile/getConfigPath.ts
|
|
201
185
|
function getConfigPath() {
|
|
@@ -207,21 +191,17 @@ function getConfigPath() {
|
|
|
207
191
|
ensureConfigComplies(configPath);
|
|
208
192
|
return configPath;
|
|
209
193
|
}
|
|
210
|
-
__name(getConfigPath, "getConfigPath");
|
|
211
194
|
|
|
212
195
|
// src/start/watchAndCompile/reports.ts
|
|
213
196
|
var import_typescript2 = __toESM(require("typescript"), 1);
|
|
214
197
|
var format = {
|
|
215
|
-
getCanonicalFileName:
|
|
216
|
-
getCurrentDirectory:
|
|
217
|
-
getNewLine:
|
|
198
|
+
getCanonicalFileName: (fileName) => fileName,
|
|
199
|
+
getCurrentDirectory: () => process.cwd(),
|
|
200
|
+
getNewLine: () => import_typescript2.default.sys.newLine
|
|
218
201
|
};
|
|
219
202
|
function reportDiagnostic(diagnostic) {
|
|
220
|
-
console.log(import_typescript2.default.formatDiagnosticsWithColorAndContext([
|
|
221
|
-
diagnostic
|
|
222
|
-
], format));
|
|
203
|
+
console.log(import_typescript2.default.formatDiagnosticsWithColorAndContext([diagnostic], format));
|
|
223
204
|
}
|
|
224
|
-
__name(reportDiagnostic, "reportDiagnostic");
|
|
225
205
|
|
|
226
206
|
// src/start/watchAndCompile/getHost.ts
|
|
227
207
|
var import_safe2 = __toESM(require("colors/safe"), 1);
|
|
@@ -235,24 +215,29 @@ function writeIndex_default({ basePath }) {
|
|
|
235
215
|
const libContent = import_fs5.default.readFileSync(libContentPath).toString();
|
|
236
216
|
writeFile_default(libPath, libContent);
|
|
237
217
|
const aliasPath = `${basePath}/moduleAlias.js`;
|
|
238
|
-
writeFile_default(
|
|
218
|
+
writeFile_default(
|
|
219
|
+
aliasPath,
|
|
220
|
+
`"use strict";
|
|
239
221
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
240
222
|
const moduleAlias = require('./moduleAliasLib')
|
|
241
223
|
const path = __dirname + '/app'
|
|
242
224
|
moduleAlias.addAlias('app', path)
|
|
243
|
-
`
|
|
225
|
+
`
|
|
226
|
+
);
|
|
244
227
|
const indexPath = `${basePath}/index.js`;
|
|
245
|
-
writeFile_default(
|
|
228
|
+
writeFile_default(
|
|
229
|
+
indexPath,
|
|
230
|
+
`"use strict";
|
|
246
231
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
247
232
|
require("./moduleAlias");
|
|
248
233
|
require("./app");
|
|
249
|
-
`
|
|
234
|
+
`
|
|
235
|
+
);
|
|
250
236
|
}
|
|
251
|
-
__name(writeIndex_default, "default");
|
|
252
237
|
|
|
253
238
|
// src/start/watchAndCompile/getHost.ts
|
|
254
239
|
function getHost(runner) {
|
|
255
|
-
const reportWatchStatusChanged =
|
|
240
|
+
const reportWatchStatusChanged = (diagnostic) => {
|
|
256
241
|
if (diagnostic.category !== 3) return;
|
|
257
242
|
if (diagnostic.code === 6032 || diagnostic.code === 6031) {
|
|
258
243
|
runner.stop();
|
|
@@ -264,18 +249,22 @@ function getHost(runner) {
|
|
|
264
249
|
return;
|
|
265
250
|
}
|
|
266
251
|
}
|
|
267
|
-
writeIndex_default({
|
|
268
|
-
basePath: runner.basePath
|
|
269
|
-
});
|
|
252
|
+
writeIndex_default({ basePath: runner.basePath });
|
|
270
253
|
runner.restart();
|
|
271
254
|
}
|
|
272
|
-
}
|
|
255
|
+
};
|
|
273
256
|
const configPath = getConfigPath();
|
|
274
257
|
const createProgram = import_typescript3.default.createEmitAndSemanticDiagnosticsBuilderProgram;
|
|
275
|
-
const host = import_typescript3.default.createWatchCompilerHost(
|
|
258
|
+
const host = import_typescript3.default.createWatchCompilerHost(
|
|
259
|
+
configPath,
|
|
260
|
+
{},
|
|
261
|
+
import_typescript3.default.sys,
|
|
262
|
+
createProgram,
|
|
263
|
+
reportDiagnostic,
|
|
264
|
+
reportWatchStatusChanged
|
|
265
|
+
);
|
|
276
266
|
return host;
|
|
277
267
|
}
|
|
278
|
-
__name(getHost, "getHost");
|
|
279
268
|
|
|
280
269
|
// src/start/watchAndCompile/watchDeletes.ts
|
|
281
270
|
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
@@ -294,11 +283,12 @@ async function watchDeletes() {
|
|
|
294
283
|
import_fs6.default.unlinkSync(`${atBuildPath}.js`);
|
|
295
284
|
import_fs6.default.unlinkSync(`${atBuildPath}.d.ts`);
|
|
296
285
|
} catch (error) {
|
|
297
|
-
console.log(
|
|
286
|
+
console.log(
|
|
287
|
+
`Error cleaning ${atBuildPath}. Restar project is suggested. Error: ${error.message}`
|
|
288
|
+
);
|
|
298
289
|
}
|
|
299
290
|
});
|
|
300
291
|
}
|
|
301
|
-
__name(watchDeletes, "watchDeletes");
|
|
302
292
|
|
|
303
293
|
// src/start/watchAndCompile/writeEnvFile.ts
|
|
304
294
|
var import_chokidar2 = __toESM(require("chokidar"), 1);
|
|
@@ -306,17 +296,15 @@ var import_safe3 = __toESM(require("colors/safe"), 1);
|
|
|
306
296
|
var import_env = require("@orion-js/env");
|
|
307
297
|
var envFilePath = process.env.ORION_ENV_FILE_PATH;
|
|
308
298
|
var dtsFilePath = "./app/env.d.ts";
|
|
309
|
-
var watchEnvFile =
|
|
299
|
+
var watchEnvFile = async (runner) => {
|
|
310
300
|
if (!envFilePath) return;
|
|
311
301
|
(0, import_env.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
|
|
312
|
-
import_chokidar2.default.watch(envFilePath, {
|
|
313
|
-
ignoreInitial: true
|
|
314
|
-
}).on("change", async () => {
|
|
302
|
+
import_chokidar2.default.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
|
|
315
303
|
console.log(import_safe3.default.bold(`=> Environment file changed. Restarting...`));
|
|
316
304
|
(0, import_env.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
|
|
317
305
|
runner.restart();
|
|
318
306
|
});
|
|
319
|
-
}
|
|
307
|
+
};
|
|
320
308
|
|
|
321
309
|
// src/start/watchAndCompile/index.ts
|
|
322
310
|
async function watchAndCompile(runner) {
|
|
@@ -326,7 +314,6 @@ async function watchAndCompile(runner) {
|
|
|
326
314
|
watchDeletes();
|
|
327
315
|
watchEnvFile(runner);
|
|
328
316
|
}
|
|
329
|
-
__name(watchAndCompile, "watchAndCompile");
|
|
330
317
|
|
|
331
318
|
// src/start/copyCursorRule/index.ts
|
|
332
319
|
var import_path5 = __toESM(require("path"), 1);
|
|
@@ -341,7 +328,7 @@ var rules = [
|
|
|
341
328
|
"orionjs-services.mdx",
|
|
342
329
|
"orionjs-resolvers.mdx"
|
|
343
330
|
];
|
|
344
|
-
var downloadFile =
|
|
331
|
+
var downloadFile = (url) => {
|
|
345
332
|
return new Promise((resolve, reject) => {
|
|
346
333
|
import_https.default.get(url, (response) => {
|
|
347
334
|
if (response.statusCode !== 200) {
|
|
@@ -360,14 +347,12 @@ var downloadFile = /* @__PURE__ */ __name((url) => {
|
|
|
360
347
|
});
|
|
361
348
|
});
|
|
362
349
|
});
|
|
363
|
-
}
|
|
350
|
+
};
|
|
364
351
|
async function copyCursorRule() {
|
|
365
352
|
const baseUrl = `https://raw.githubusercontent.com/orionjs/orionjs/refs/heads/master/mdc`;
|
|
366
353
|
try {
|
|
367
354
|
const targetDir = import_path5.default.join(process.cwd(), ".cursor", "rules");
|
|
368
|
-
await import_promises.default.mkdir(targetDir, {
|
|
369
|
-
recursive: true
|
|
370
|
-
});
|
|
355
|
+
await import_promises.default.mkdir(targetDir, { recursive: true });
|
|
371
356
|
for (const rule of rules) {
|
|
372
357
|
const targetFileName = rule.replace(".mdx", ".mdc");
|
|
373
358
|
const targetFile = import_path5.default.join(targetDir, targetFileName);
|
|
@@ -381,7 +366,6 @@ async function copyCursorRule() {
|
|
|
381
366
|
console.error(import_safe4.default.red(`Error copying rule files: ${error.message}`));
|
|
382
367
|
}
|
|
383
368
|
}
|
|
384
|
-
__name(copyCursorRule, "copyCursorRule");
|
|
385
369
|
|
|
386
370
|
// src/start/copyMCP/index.ts
|
|
387
371
|
var import_path7 = __toESM(require("path"), 1);
|
|
@@ -395,15 +379,11 @@ async function execute_default(command) {
|
|
|
395
379
|
if (error) {
|
|
396
380
|
reject(error);
|
|
397
381
|
} else {
|
|
398
|
-
resolve({
|
|
399
|
-
stdout,
|
|
400
|
-
stderr
|
|
401
|
-
});
|
|
382
|
+
resolve({ stdout, stderr });
|
|
402
383
|
}
|
|
403
384
|
});
|
|
404
385
|
});
|
|
405
386
|
}
|
|
406
|
-
__name(execute_default, "default");
|
|
407
387
|
|
|
408
388
|
// src/start/copyMCP/index.ts
|
|
409
389
|
var import_safe6 = __toESM(require("colors/safe"), 1);
|
|
@@ -422,10 +402,7 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
422
402
|
try {
|
|
423
403
|
const stats = await import_promises2.default.stat(directoryPath);
|
|
424
404
|
if (!stats.isDirectory()) return false;
|
|
425
|
-
const expectedFiles = [
|
|
426
|
-
"settings.js",
|
|
427
|
-
"package.json"
|
|
428
|
-
];
|
|
405
|
+
const expectedFiles = ["settings.js", "package.json"];
|
|
429
406
|
for (const file of expectedFiles) {
|
|
430
407
|
try {
|
|
431
408
|
await import_promises2.default.access(import_path6.default.join(directoryPath, file));
|
|
@@ -437,7 +414,11 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
437
414
|
const versionPath = import_path6.default.join(directoryPath, VERSION_FILE);
|
|
438
415
|
const versionContent = await import_promises2.default.readFile(versionPath, "utf-8");
|
|
439
416
|
if (versionContent.trim() !== MCP_VERSION) {
|
|
440
|
-
console.log(
|
|
417
|
+
console.log(
|
|
418
|
+
import_safe5.default.yellow(
|
|
419
|
+
`=> \u2728 MCP version mismatch: installed=${versionContent.trim()}, required=${MCP_VERSION}`
|
|
420
|
+
)
|
|
421
|
+
);
|
|
441
422
|
return false;
|
|
442
423
|
}
|
|
443
424
|
} catch {
|
|
@@ -448,16 +429,13 @@ async function isValidMCPRepository(directoryPath) {
|
|
|
448
429
|
return false;
|
|
449
430
|
}
|
|
450
431
|
}
|
|
451
|
-
__name(isValidMCPRepository, "isValidMCPRepository");
|
|
452
432
|
|
|
453
433
|
// src/start/copyMCP/index.ts
|
|
454
434
|
async function copyMCP() {
|
|
455
435
|
const repoUrl = "https://github.com/orionjs/mcp-docs";
|
|
456
436
|
const targetDir = import_path7.default.join(process.cwd(), ".orion", "mcp");
|
|
457
437
|
try {
|
|
458
|
-
await import_promises3.default.mkdir(import_path7.default.join(process.cwd(), ".orion"), {
|
|
459
|
-
recursive: true
|
|
460
|
-
});
|
|
438
|
+
await import_promises3.default.mkdir(import_path7.default.join(process.cwd(), ".orion"), { recursive: true });
|
|
461
439
|
if (await isValidMCPRepository(targetDir)) {
|
|
462
440
|
console.log(import_safe6.default.bold(`=> \u2728 MCP documentation already installed`));
|
|
463
441
|
return;
|
|
@@ -465,11 +443,12 @@ async function copyMCP() {
|
|
|
465
443
|
try {
|
|
466
444
|
const stats = await import_promises3.default.stat(targetDir);
|
|
467
445
|
if (stats.isDirectory()) {
|
|
468
|
-
await import_promises3.default.rm(targetDir, {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
446
|
+
await import_promises3.default.rm(targetDir, { recursive: true, force: true });
|
|
447
|
+
console.log(
|
|
448
|
+
import_safe6.default.bold(
|
|
449
|
+
`=> \u2728 Removed existing .orion/mcp directory (invalid, incomplete, or outdated)`
|
|
450
|
+
)
|
|
451
|
+
);
|
|
473
452
|
}
|
|
474
453
|
} catch (error) {
|
|
475
454
|
}
|
|
@@ -477,17 +456,17 @@ async function copyMCP() {
|
|
|
477
456
|
await execute_default(`git clone ${repoUrl} ${targetDir}`);
|
|
478
457
|
await execute_default(`rm -rf ${import_path7.default.join(targetDir, ".git")}`);
|
|
479
458
|
await import_promises3.default.writeFile(import_path7.default.join(targetDir, VERSION_FILE), MCP_VERSION, "utf-8");
|
|
480
|
-
console.log(
|
|
459
|
+
console.log(
|
|
460
|
+
import_safe6.default.bold(`=> \u2728 Successfully downloaded MCP documentation v${MCP_VERSION} to .orion/mcp`)
|
|
461
|
+
);
|
|
481
462
|
console.log(import_safe6.default.bold(`=> \u2728 Installing MCP dependencies...`));
|
|
482
463
|
await execute_default(`cd ${targetDir} && npm install`);
|
|
483
464
|
console.log(import_safe6.default.bold(`=> \u2728 Successfully installed MCP dependencies`));
|
|
484
465
|
const mcpServerConfig = {
|
|
485
|
-
|
|
466
|
+
mcpServers: {
|
|
486
467
|
"Orionjs documentation search": {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
import_path7.default.join(targetDir, "src", "index.js")
|
|
490
|
-
]
|
|
468
|
+
command: "node",
|
|
469
|
+
args: [import_path7.default.join(targetDir, "src", "index.js")]
|
|
491
470
|
}
|
|
492
471
|
}
|
|
493
472
|
};
|
|
@@ -502,9 +481,7 @@ async function copyMCP() {
|
|
|
502
481
|
await import_promises3.default.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), "utf-8");
|
|
503
482
|
console.log(import_safe6.default.bold(`=> \u2728 Updated MCP server configuration in .cursor/mcp.json`));
|
|
504
483
|
} catch (error) {
|
|
505
|
-
await import_promises3.default.mkdir(import_path7.default.dirname(configPath), {
|
|
506
|
-
recursive: true
|
|
507
|
-
});
|
|
484
|
+
await import_promises3.default.mkdir(import_path7.default.dirname(configPath), { recursive: true });
|
|
508
485
|
await import_promises3.default.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), "utf-8");
|
|
509
486
|
console.log(import_safe6.default.bold(`=> \u2728 Created new MCP server configuration in .cursor/mcp.json`));
|
|
510
487
|
}
|
|
@@ -513,7 +490,6 @@ async function copyMCP() {
|
|
|
513
490
|
throw error;
|
|
514
491
|
}
|
|
515
492
|
}
|
|
516
|
-
__name(copyMCP, "copyMCP");
|
|
517
493
|
|
|
518
494
|
// src/start/index.ts
|
|
519
495
|
async function start_default(options) {
|
|
@@ -531,7 +507,6 @@ async function start_default(options) {
|
|
|
531
507
|
const runner = getRunner(options);
|
|
532
508
|
watchAndCompile(runner);
|
|
533
509
|
}
|
|
534
|
-
__name(start_default, "default");
|
|
535
510
|
|
|
536
511
|
// src/build/index.ts
|
|
537
512
|
var import_safe9 = __toESM(require("colors/safe"), 1);
|
|
@@ -554,7 +529,6 @@ function getCompilerOptionsJSONFollowExtends(filename) {
|
|
|
554
529
|
...config.compilerOptions
|
|
555
530
|
};
|
|
556
531
|
}
|
|
557
|
-
__name(getCompilerOptionsJSONFollowExtends, "getCompilerOptionsJSONFollowExtends");
|
|
558
532
|
function getOptions({ output }) {
|
|
559
533
|
const configPath = getConfigPath();
|
|
560
534
|
const config = getCompilerOptionsJSONFollowExtends(configPath);
|
|
@@ -567,17 +541,12 @@ function getOptions({ output }) {
|
|
|
567
541
|
}
|
|
568
542
|
return options;
|
|
569
543
|
}
|
|
570
|
-
__name(getOptions, "getOptions");
|
|
571
544
|
|
|
572
545
|
// src/build/compile.ts
|
|
573
546
|
var import_safe8 = __toESM(require("colors/safe"), 1);
|
|
574
547
|
function compile({ output }) {
|
|
575
|
-
const options = getOptions({
|
|
576
|
-
|
|
577
|
-
});
|
|
578
|
-
const program2 = import_typescript6.default.createProgram([
|
|
579
|
-
"./app/index.ts"
|
|
580
|
-
], options);
|
|
548
|
+
const options = getOptions({ output });
|
|
549
|
+
const program2 = import_typescript6.default.createProgram(["./app/index.ts"], options);
|
|
581
550
|
const preEmitDiagnostics = import_typescript6.default.getPreEmitDiagnostics(program2);
|
|
582
551
|
if (preEmitDiagnostics.length > 0) {
|
|
583
552
|
console.log(import_safe8.default.red(`
|
|
@@ -594,7 +563,6 @@ function compile({ output }) {
|
|
|
594
563
|
process.exit(1);
|
|
595
564
|
}
|
|
596
565
|
}
|
|
597
|
-
__name(compile, "compile");
|
|
598
566
|
|
|
599
567
|
// src/build/index.ts
|
|
600
568
|
async function build_default({ output }) {
|
|
@@ -604,15 +572,10 @@ async function build_default({ output }) {
|
|
|
604
572
|
console.log(import_safe9.default.bold(`Cleaning directory ${output}...`));
|
|
605
573
|
await execute_default(`rm -rf ${output}`);
|
|
606
574
|
console.log(import_safe9.default.bold("Compiling your app..."));
|
|
607
|
-
compile({
|
|
608
|
-
|
|
609
|
-
});
|
|
610
|
-
writeIndex_default({
|
|
611
|
-
basePath: output
|
|
612
|
-
});
|
|
575
|
+
compile({ output });
|
|
576
|
+
writeIndex_default({ basePath: output });
|
|
613
577
|
console.log(import_safe9.default.bold("Build created"));
|
|
614
578
|
}
|
|
615
|
-
__name(build_default, "default");
|
|
616
579
|
|
|
617
580
|
// src/create/index.ts
|
|
618
581
|
async function create_default({ name, kit }) {
|
|
@@ -628,7 +591,6 @@ async function create_default({ name, kit }) {
|
|
|
628
591
|
await execute_default(`cd ${name} && rm -rf .git`);
|
|
629
592
|
console.log("Your starter kit is ready");
|
|
630
593
|
}
|
|
631
|
-
__name(create_default, "default");
|
|
632
594
|
|
|
633
595
|
// src/index.ts
|
|
634
596
|
var import_safe11 = __toESM(require("colors/safe"), 1);
|
|
@@ -640,7 +602,6 @@ function test_default() {
|
|
|
640
602
|
console.log(import_safe10.default.bold(`ORION_DEV=LOCAL ORION_TEST=1 jest`));
|
|
641
603
|
process.exit(1);
|
|
642
604
|
}
|
|
643
|
-
__name(test_default, "default");
|
|
644
605
|
|
|
645
606
|
// src/handleErrors.ts
|
|
646
607
|
var import_colors = __toESM(require("colors"), 1);
|
|
@@ -662,7 +623,7 @@ var version_default = `3.0`;
|
|
|
662
623
|
// src/index.ts
|
|
663
624
|
var import_config = require("dotenv/config");
|
|
664
625
|
var program = new import_commander.Command();
|
|
665
|
-
var run =
|
|
626
|
+
var run = function(action) {
|
|
666
627
|
return async function(...args) {
|
|
667
628
|
try {
|
|
668
629
|
await action(...args);
|
|
@@ -670,7 +631,7 @@ var run = /* @__PURE__ */ __name(function(action) {
|
|
|
670
631
|
console.error(import_safe11.default.red("Error: " + e.message));
|
|
671
632
|
}
|
|
672
633
|
};
|
|
673
|
-
}
|
|
634
|
+
};
|
|
674
635
|
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));
|
|
675
636
|
program.command("test").allowUnknownOption().description("Deprecated command").action(run(test_default));
|
|
676
637
|
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));
|