Skip to content

Commit 605e31b

Browse files
authored
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
1 parent ae9b96e commit 605e31b

File tree

3 files changed

+40
-9
lines changed

3 files changed

+40
-9
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"url": "https://github.com/modelcontextprotocol/ext-apps"
66
},
77
"homepage": "https://github.com/modelcontextprotocol/ext-apps",
8-
"version": "1.0.0",
8+
"version": "1.0.1",
99
"license": "MIT",
1010
"description": "MCP Apps SDK — Enable MCP servers to display interactive user interfaces in conversational clients.",
1111
"type": "module",

scripts/check-versions.mjs

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
/**
3-
* Checks that example package.json files reference the same version
3+
* Checks that example package.json files reference a compatible version
44
* of @modelcontextprotocol/ext-apps as the root package.json.
55
*
66
* This ensures examples stay in sync with the library version.
@@ -13,7 +13,38 @@ const rootPkg = JSON.parse(readFileSync("package.json", "utf-8"));
1313
const rootVersion = rootPkg.version;
1414
const pkgName = rootPkg.name;
1515

16-
const expectedDep = `^${rootVersion}`;
16+
// Parse semver major.minor.patch
17+
const [major, minor] = rootVersion.split(".").map(Number);
18+
19+
/**
20+
* Check if a dependency range is compatible with the root version.
21+
* Allows:
22+
* - "../.." (local dev)
23+
* - "^X.Y.Z" where X.Y matches root major.minor (e.g., ^1.0.0 is compatible with 1.0.1)
24+
* - Exact match like "1.0.1"
25+
*/
26+
function isCompatible(dep) {
27+
if (dep === "../..") return true;
28+
29+
// Handle caret ranges like ^1.0.0
30+
if (dep.startsWith("^")) {
31+
const version = dep.slice(1);
32+
const [depMajor, depMinor] = version.split(".").map(Number);
33+
// For major version 0, minor must match; for major > 0, only major must match
34+
if (major === 0) {
35+
return depMajor === major && depMinor === minor;
36+
}
37+
return depMajor === major;
38+
}
39+
40+
// Handle exact version
41+
if (/^\d+\.\d+\.\d+$/.test(dep)) {
42+
const [depMajor] = dep.split(".").map(Number);
43+
return depMajor === major;
44+
}
45+
46+
return false;
47+
}
1748

1849
let hasError = false;
1950

@@ -28,22 +59,22 @@ for (const example of examples) {
2859
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
2960

3061
const dep = pkg.dependencies?.[pkgName];
31-
// Allow "../.." (local dev) or the correct versioned dependency
32-
if (dep && dep !== expectedDep && dep !== "../..") {
62+
if (dep && !isCompatible(dep)) {
3363
console.error(
34-
`❌ ${pkgPath}: expected "${pkgName}": "${expectedDep}" (or "../.."), got "${dep}"`,
64+
`❌ ${pkgPath}: "${pkgName}": "${dep}" is not compatible with root version ${rootVersion}`,
3565
);
3666
hasError = true;
3767
}
3868
}
3969

4070
if (hasError) {
71+
const expectedDep = `^${major}.${minor}.0`;
4172
console.error(
4273
`\nRun the following to fix:\n npm pkg set dependencies.${pkgName}=${expectedDep} --workspaces`,
4374
);
4475
process.exit(1);
4576
} else {
4677
console.log(
47-
`✅ All examples reference ${pkgName}@${expectedDep} (root version: ${rootVersion})`,
78+
`✅ All examples reference compatible ${pkgName} versions (root version: ${rootVersion})`,
4879
);
4980
}

0 commit comments

Comments
 (0)