-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathsync-mcp-server-json.js
More file actions
27 lines (19 loc) · 932 Bytes
/
sync-mcp-server-json.js
File metadata and controls
27 lines (19 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env node
// Syncs the version in packages/fiori-mcp-server/server.json with its package.json.
// Called from the version job in pipeline.yml after `changeset version` bumps package.json.
'use strict';
const fs = require('fs');
const path = require('path');
const pkgPath = path.join(__dirname, '..', 'package.json');
const serverJsonPath = path.join(__dirname, '..', 'server.json');
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
const serverJson = JSON.parse(fs.readFileSync(serverJsonPath, 'utf8'));
const { version } = pkg;
// Update top-level version
serverJson.version = version;
// Update version inside packages[0] (npm package entry)
if (Array.isArray(serverJson.packages) && serverJson.packages.length > 0) {
serverJson.packages[0].version = version;
}
fs.writeFileSync(serverJsonPath, JSON.stringify(serverJson, null, 4) + '\n');
console.log(`Updated server.json to version ${version}`);