frontmcp 0.1.7 → 0.1.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/cli.js +4 -18
- package/dist/version.js +7 -0
- package/package.json +1 -1
- package/src/cli.ts +5 -16
- package/src/version.ts +5 -0
package/dist/cli.js
CHANGED
|
@@ -51,6 +51,7 @@ const fs = __importStar(require("fs"));
|
|
|
51
51
|
const fs_1 = require("fs");
|
|
52
52
|
const path = __importStar(require("path"));
|
|
53
53
|
const child_process_1 = require("child_process");
|
|
54
|
+
const version_1 = require("./version");
|
|
54
55
|
const COLORS = {
|
|
55
56
|
reset: '\x1b[0m',
|
|
56
57
|
bold: '\x1b[1m',
|
|
@@ -218,22 +219,6 @@ function sanitizeForNpm(name) {
|
|
|
218
219
|
}
|
|
219
220
|
return name.replace(/[^a-z0-9._-]/gi, '-').toLowerCase() || 'frontmcp-app';
|
|
220
221
|
}
|
|
221
|
-
/* ------------------------ Self-version detection -------------------------- */
|
|
222
|
-
function getSelfVersion() {
|
|
223
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
-
const binPath = process.argv[1] || __filename;
|
|
225
|
-
const candidates = [
|
|
226
|
-
path.resolve(path.dirname(binPath), '../package.json'),
|
|
227
|
-
path.resolve(path.dirname(binPath), '../../package.json'),
|
|
228
|
-
];
|
|
229
|
-
for (const p of candidates) {
|
|
230
|
-
const j = yield readJSON(p);
|
|
231
|
-
if (j === null || j === void 0 ? void 0 : j.version)
|
|
232
|
-
return j.version;
|
|
233
|
-
}
|
|
234
|
-
return '0.0.0';
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
222
|
/* --------------------------------- Actions -------------------------------- */
|
|
238
223
|
function isTsLike(p) {
|
|
239
224
|
return /\.tsx?$/i.test(p);
|
|
@@ -314,7 +299,7 @@ const RECOMMENDED_TSCONFIG = {
|
|
|
314
299
|
module: REQUIRED_DECORATOR_FIELDS.module,
|
|
315
300
|
emitDecoratorMetadata: REQUIRED_DECORATOR_FIELDS.emitDecoratorMetadata,
|
|
316
301
|
experimentalDecorators: REQUIRED_DECORATOR_FIELDS.experimentalDecorators,
|
|
317
|
-
moduleResolution: '
|
|
302
|
+
moduleResolution: 'node',
|
|
318
303
|
strict: true,
|
|
319
304
|
esModuleInterop: true,
|
|
320
305
|
resolveJsonModule: true,
|
|
@@ -513,6 +498,7 @@ function upsertPackageJson(cwd, nameOverride, selfVersion) {
|
|
|
513
498
|
devDependencies: {
|
|
514
499
|
frontmcp: selfVersion, // exact CLI version used by npx
|
|
515
500
|
tsx: '^4.20.6',
|
|
501
|
+
"@types/node": "^20.11.30",
|
|
516
502
|
typescript: '^5.5.3',
|
|
517
503
|
},
|
|
518
504
|
};
|
|
@@ -611,7 +597,7 @@ function runCreate(projectArg) {
|
|
|
611
597
|
// 1) tsconfig
|
|
612
598
|
yield runInit(targetDir);
|
|
613
599
|
// 2) package.json (pinned deps + exact CLI version)
|
|
614
|
-
const selfVersion =
|
|
600
|
+
const selfVersion = (0, version_1.getSelfVersion)();
|
|
615
601
|
yield upsertPackageJson(targetDir, pkgName, selfVersion);
|
|
616
602
|
// 3) files
|
|
617
603
|
yield scaffoldFileIfMissing(targetDir, path.join(targetDir, 'src', 'main.ts'), TEMPLATE_MAIN_TS);
|
package/dist/version.js
ADDED
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -8,6 +8,7 @@ import * as fs from 'fs';
|
|
|
8
8
|
import {promises as fsp} from 'fs';
|
|
9
9
|
import * as path from 'path';
|
|
10
10
|
import {spawn, ChildProcess} from 'child_process';
|
|
11
|
+
import {getSelfVersion} from "./version";
|
|
11
12
|
|
|
12
13
|
/* ----------------------------- Types & Helpers ---------------------------- */
|
|
13
14
|
|
|
@@ -180,20 +181,7 @@ function sanitizeForNpm(name: string): string {
|
|
|
180
181
|
return name.replace(/[^a-z0-9._-]/gi, '-').toLowerCase() || 'frontmcp-app';
|
|
181
182
|
}
|
|
182
183
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
async function getSelfVersion(): Promise<string> {
|
|
186
|
-
const binPath = process.argv[1] || __filename;
|
|
187
|
-
const candidates = [
|
|
188
|
-
path.resolve(path.dirname(binPath), '../package.json'),
|
|
189
|
-
path.resolve(path.dirname(binPath), '../../package.json'),
|
|
190
|
-
];
|
|
191
|
-
for (const p of candidates) {
|
|
192
|
-
const j = await readJSON<any>(p);
|
|
193
|
-
if (j?.version) return j.version;
|
|
194
|
-
}
|
|
195
|
-
return '0.0.0';
|
|
196
|
-
}
|
|
184
|
+
|
|
197
185
|
|
|
198
186
|
/* --------------------------------- Actions -------------------------------- */
|
|
199
187
|
|
|
@@ -286,7 +274,7 @@ const RECOMMENDED_TSCONFIG = {
|
|
|
286
274
|
emitDecoratorMetadata: REQUIRED_DECORATOR_FIELDS.emitDecoratorMetadata,
|
|
287
275
|
experimentalDecorators: REQUIRED_DECORATOR_FIELDS.experimentalDecorators,
|
|
288
276
|
|
|
289
|
-
moduleResolution: '
|
|
277
|
+
moduleResolution: 'node',
|
|
290
278
|
strict: true,
|
|
291
279
|
esModuleInterop: true,
|
|
292
280
|
resolveJsonModule: true,
|
|
@@ -482,6 +470,7 @@ async function upsertPackageJson(cwd: string, nameOverride: string | undefined,
|
|
|
482
470
|
devDependencies: {
|
|
483
471
|
frontmcp: selfVersion, // exact CLI version used by npx
|
|
484
472
|
tsx: '^4.20.6',
|
|
473
|
+
"@types/node": "^20.11.30",
|
|
485
474
|
typescript: '^5.5.3',
|
|
486
475
|
},
|
|
487
476
|
};
|
|
@@ -615,7 +604,7 @@ async function runCreate(projectArg?: string): Promise<void> {
|
|
|
615
604
|
await runInit(targetDir);
|
|
616
605
|
|
|
617
606
|
// 2) package.json (pinned deps + exact CLI version)
|
|
618
|
-
const selfVersion =
|
|
607
|
+
const selfVersion = getSelfVersion();
|
|
619
608
|
await upsertPackageJson(targetDir, pkgName, selfVersion);
|
|
620
609
|
|
|
621
610
|
// 3) files
|