chore: bump ext-apps to 1.0.1 (#369)
* chore: bump ext-apps to 1.0.1 * chore: update examples to depend on ext-apps ^1.0.1 * fix: revert examples to ext-apps ^1.0.0 and fix cheerio version - Revert ext-apps dependency to ^1.0.0 (works with 1.0.1 once published) - Fix accidental cheerio bump in wiki-explorer-server - Remove broken override attempt * fix: allow compatible semver ranges in version check The check-versions script now accepts any compatible semver range, not just exact version matches. For example, ^1.0.0 is allowed when root version is 1.0.1, since semver compatibility is maintained. * style: fix indentation in package.json
This commit is contained in:
parent
ae9b96e1fd
commit
605e31b6c5
3 changed files with 40 additions and 9 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@modelcontextprotocol/ext-apps",
|
"name": "@modelcontextprotocol/ext-apps",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@modelcontextprotocol/ext-apps",
|
"name": "@modelcontextprotocol/ext-apps",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"url": "https://github.com/modelcontextprotocol/ext-apps"
|
"url": "https://github.com/modelcontextprotocol/ext-apps"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/modelcontextprotocol/ext-apps",
|
"homepage": "https://github.com/modelcontextprotocol/ext-apps",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "MCP Apps SDK — Enable MCP servers to display interactive user interfaces in conversational clients.",
|
"description": "MCP Apps SDK — Enable MCP servers to display interactive user interfaces in conversational clients.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
/**
|
/**
|
||||||
* Checks that example package.json files reference the same version
|
* Checks that example package.json files reference a compatible version
|
||||||
* of @modelcontextprotocol/ext-apps as the root package.json.
|
* of @modelcontextprotocol/ext-apps as the root package.json.
|
||||||
*
|
*
|
||||||
* This ensures examples stay in sync with the library version.
|
* This ensures examples stay in sync with the library version.
|
||||||
|
|
@ -13,7 +13,38 @@ const rootPkg = JSON.parse(readFileSync("package.json", "utf-8"));
|
||||||
const rootVersion = rootPkg.version;
|
const rootVersion = rootPkg.version;
|
||||||
const pkgName = rootPkg.name;
|
const pkgName = rootPkg.name;
|
||||||
|
|
||||||
const expectedDep = `^${rootVersion}`;
|
// Parse semver major.minor.patch
|
||||||
|
const [major, minor] = rootVersion.split(".").map(Number);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a dependency range is compatible with the root version.
|
||||||
|
* Allows:
|
||||||
|
* - "../.." (local dev)
|
||||||
|
* - "^X.Y.Z" where X.Y matches root major.minor (e.g., ^1.0.0 is compatible with 1.0.1)
|
||||||
|
* - Exact match like "1.0.1"
|
||||||
|
*/
|
||||||
|
function isCompatible(dep) {
|
||||||
|
if (dep === "../..") return true;
|
||||||
|
|
||||||
|
// Handle caret ranges like ^1.0.0
|
||||||
|
if (dep.startsWith("^")) {
|
||||||
|
const version = dep.slice(1);
|
||||||
|
const [depMajor, depMinor] = version.split(".").map(Number);
|
||||||
|
// For major version 0, minor must match; for major > 0, only major must match
|
||||||
|
if (major === 0) {
|
||||||
|
return depMajor === major && depMinor === minor;
|
||||||
|
}
|
||||||
|
return depMajor === major;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle exact version
|
||||||
|
if (/^\d+\.\d+\.\d+$/.test(dep)) {
|
||||||
|
const [depMajor] = dep.split(".").map(Number);
|
||||||
|
return depMajor === major;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let hasError = false;
|
let hasError = false;
|
||||||
|
|
||||||
|
|
@ -28,22 +59,22 @@ for (const example of examples) {
|
||||||
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
||||||
|
|
||||||
const dep = pkg.dependencies?.[pkgName];
|
const dep = pkg.dependencies?.[pkgName];
|
||||||
// Allow "../.." (local dev) or the correct versioned dependency
|
if (dep && !isCompatible(dep)) {
|
||||||
if (dep && dep !== expectedDep && dep !== "../..") {
|
|
||||||
console.error(
|
console.error(
|
||||||
`❌ ${pkgPath}: expected "${pkgName}": "${expectedDep}" (or "../.."), got "${dep}"`,
|
`❌ ${pkgPath}: "${pkgName}": "${dep}" is not compatible with root version ${rootVersion}`,
|
||||||
);
|
);
|
||||||
hasError = true;
|
hasError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
|
const expectedDep = `^${major}.${minor}.0`;
|
||||||
console.error(
|
console.error(
|
||||||
`\nRun the following to fix:\n npm pkg set dependencies.${pkgName}=${expectedDep} --workspaces`,
|
`\nRun the following to fix:\n npm pkg set dependencies.${pkgName}=${expectedDep} --workspaces`,
|
||||||
);
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
`✅ All examples reference ${pkgName}@${expectedDep} (root version: ${rootVersion})`,
|
`✅ All examples reference compatible ${pkgName} versions (root version: ${rootVersion})`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue