mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
edca35d122
* chore(deps): add Renovate config and enforce packageManager pnpm version in CI Refs #1422 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * chore: bump pnpm to 11.17.0 and format the whole repo with oxfmt format/format:check drop their hand-maintained path list: oxfmt already skips node_modules and honors .gitignore, so the only exclusion list is .oxfmtrc.json ignorePatterns. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(mutation): accept either quote style in the affected-lane path filter Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * chore(deps): keep fixture-app runtime deps as individual Renovate PRs Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import process from 'node:process';
|
|
|
|
const root = process.cwd();
|
|
const checkOnly = process.argv.includes('--check');
|
|
const packagePath = path.join(root, 'package.json');
|
|
const serverPath = path.join(root, 'server.json');
|
|
|
|
const pkg = readJson(packagePath);
|
|
const server = readJson(serverPath);
|
|
const expectedName = pkg.mcpName;
|
|
const expectedVersion = pkg.version;
|
|
const registryDescriptionMaxLength = 100;
|
|
|
|
if (typeof expectedName !== 'string' || expectedName.length === 0) {
|
|
fail('package.json must define mcpName.');
|
|
}
|
|
if (typeof expectedVersion !== 'string' || expectedVersion.length === 0) {
|
|
fail('package.json must define version.');
|
|
}
|
|
if (
|
|
typeof server.description === 'string' &&
|
|
server.description.length > registryDescriptionMaxLength
|
|
) {
|
|
fail(`server.json description must be ${registryDescriptionMaxLength} characters or fewer.`);
|
|
}
|
|
|
|
server.name = expectedName;
|
|
server.version = expectedVersion;
|
|
if (Array.isArray(server.packages)) {
|
|
for (const packageEntry of server.packages) {
|
|
if (packageEntry?.identifier === pkg.name) {
|
|
packageEntry.version = expectedVersion;
|
|
}
|
|
}
|
|
}
|
|
|
|
const next = `${JSON.stringify(server, null, 2)}\n`;
|
|
const current = fs.readFileSync(serverPath, 'utf8');
|
|
|
|
if (checkOnly) {
|
|
if (next !== current) {
|
|
fail('server.json is out of sync. Run `pnpm sync:mcp-metadata`.');
|
|
}
|
|
process.exit(0);
|
|
}
|
|
|
|
if (next !== current) {
|
|
fs.writeFileSync(serverPath, next);
|
|
}
|
|
|
|
function readJson(filePath) {
|
|
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
}
|
|
|
|
function fail(message) {
|
|
process.stderr.write(`${message}\n`);
|
|
process.exit(1);
|
|
}
|