Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions packages/mcp-debugger/scripts/bundle-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,24 @@ async function bundleCLI() {
});
console.log('npm pack artifact refreshed in packages/mcp-debugger/package/.');

// Copy tarball to stable name for local npx testing
const tgzFiles = fs.readdirSync(path.join(packageRoot, 'package'))
.filter(f => f.endsWith('.tgz'));
if (tgzFiles.length > 0) {
// Note: lexicographic sort may misorder semver (e.g., 0.9.0 > 0.10.0).
// For robustness, derive from package.json version if precise ordering matters.
const latestTgz = tgzFiles.sort().pop();
// Copy tarball to stable alias for local npx testing. Derive the exact
// filename from package.json — avoids two hazards in readdir-based discovery:
// the alias itself can win the lexicographic sort over the real tarball
// ('m' > 'd'), and version-named files can sort out of order (0.9.0 > 0.10.0).
const pkg = JSON.parse(
fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf8')
);
const tarballName = `${pkg.name.replace('@', '').replace('/', '-')}-${pkg.version}.tgz`;
const tarballPath = path.join(packageRoot, 'package', tarballName);

if (fs.existsSync(tarballPath)) {
fs.copyFileSync(
path.join(packageRoot, 'package', latestTgz),
tarballPath,
path.join(packageRoot, 'package', 'mcp-debugger-latest.tgz')
);
console.log(`Copied ${latestTgz} → mcp-debugger-latest.tgz`);
console.log(`Copied ${tarballName} → mcp-debugger-latest.tgz`);
} else {
console.warn(`Warning: expected tarball ${tarballName} not found; mcp-debugger-latest.tgz not refreshed.`);
}
} finally {
execSync(`node "${preparePackScript}" restore`, {
Expand Down
Loading