11import { readFileSync , writeFileSync } from "node:fs" ;
22
3- const packagePath = new URL ( "../packages/posecode-mcp/package.json" , import . meta. url ) ;
3+ const mcpPackagePath = new URL ( "../packages/posecode-mcp/package.json" , import . meta. url ) ;
44const serverPath = new URL ( "../packages/posecode-mcp/server.json" , import . meta. url ) ;
5+ const embedPackagePath = new URL ( "../packages/posecode-embed/package.json" , import . meta. url ) ;
6+ const embedSourcePath = new URL ( "../packages/posecode-embed/src/compat.ts" , import . meta. url ) ;
57
6- const packageJson = JSON . parse ( readFileSync ( packagePath , "utf8" ) ) ;
8+ const packageJson = JSON . parse ( readFileSync ( mcpPackagePath , "utf8" ) ) ;
79const serverJson = JSON . parse ( readFileSync ( serverPath , "utf8" ) ) ;
10+ const embedPackageJson = JSON . parse ( readFileSync ( embedPackagePath , "utf8" ) ) ;
11+ const embedSource = readFileSync ( embedSourcePath , "utf8" ) ;
812
913serverJson . version = packageJson . version ;
1014for ( const pkg of serverJson . packages ?? [ ] ) {
@@ -14,4 +18,20 @@ for (const pkg of serverJson.packages ?? []) {
1418}
1519
1620writeFileSync ( serverPath , `${ JSON . stringify ( serverJson , null , 2 ) } \n` ) ;
17- console . log ( `Synced MCP Registry metadata to ${ packageJson . name } @${ packageJson . version } .` ) ;
21+
22+ const versionDeclaration = / e x p o r t c o n s t v e r s i o n = " [ ^ " ] + " ; / ;
23+ if ( ! versionDeclaration . test ( embedSource ) ) {
24+ throw new Error ( "Could not find the exported posecode-embed version declaration." ) ;
25+ }
26+ writeFileSync (
27+ embedSourcePath ,
28+ embedSource . replace (
29+ versionDeclaration ,
30+ `export const version = ${ JSON . stringify ( embedPackageJson . version ) } ;` ,
31+ ) ,
32+ ) ;
33+
34+ console . log (
35+ `Synced release metadata to ${ packageJson . name } @${ packageJson . version } and ` +
36+ `${ embedPackageJson . name } @${ embedPackageJson . version } .` ,
37+ ) ;
0 commit comments