frontmcp 0.1.7 → 0.1.8
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 +2 -17
- package/dist/version.js +7 -0
- package/package.json +1 -1
- package/src/cli.ts +3 -15
- 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);
|
|
@@ -611,7 +596,7 @@ function runCreate(projectArg) {
|
|
|
611
596
|
// 1) tsconfig
|
|
612
597
|
yield runInit(targetDir);
|
|
613
598
|
// 2) package.json (pinned deps + exact CLI version)
|
|
614
|
-
const selfVersion =
|
|
599
|
+
const selfVersion = (0, version_1.getSelfVersion)();
|
|
615
600
|
yield upsertPackageJson(targetDir, pkgName, selfVersion);
|
|
616
601
|
// 3) files
|
|
617
602
|
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
|
|
|
@@ -615,7 +603,7 @@ async function runCreate(projectArg?: string): Promise<void> {
|
|
|
615
603
|
await runInit(targetDir);
|
|
616
604
|
|
|
617
605
|
// 2) package.json (pinned deps + exact CLI version)
|
|
618
|
-
const selfVersion =
|
|
606
|
+
const selfVersion = getSelfVersion();
|
|
619
607
|
await upsertPackageJson(targetDir, pkgName, selfVersion);
|
|
620
608
|
|
|
621
609
|
// 3) files
|