@@ -9,7 +9,6 @@ const streamPipeline = promisify(pipeline);
9
9
const CLI_ROOT = resolve ( fileURLToPath ( import . meta. url ) , "../.." ) ;
10
10
const PACKAGES_PGLT_ROOT = resolve ( CLI_ROOT , ".." ) ;
11
11
const PGLT_ROOT = resolve ( PACKAGES_PGLT_ROOT , "../.." ) ;
12
- const MANIFEST_PATH = resolve ( CLI_ROOT , "package.json" ) ;
13
12
const SUPPORTED_PLATFORMS = [
14
13
"pc-windows-msvc" ,
15
14
"apple-darwin" ,
@@ -66,23 +65,31 @@ async function downloadBinary(platform, arch, os, releaseTag, githubToken) {
66
65
console . log ( `Downloaded asset for ${ buildName } (v${ releaseTag } )` ) ;
67
66
}
68
67
69
- async function overwriteManifestVersions ( releaseTag , isPrerelease ) {
70
- const version = getVersion ( releaseTag , isPrerelease ) ;
68
+ async function writeManifest ( packagePath , version ) {
69
+ const manifestPath = resolve ( PACKAGES_PGLT_ROOT , packagePath , "package.json" ) ;
71
70
72
- const manifestClone = structuredClone ( rootManifest ( ) ) ;
71
+ const manifestData = JSON . parse (
72
+ fs . readFileSync ( manifestPath ) . toString ( "utf-8" ) ,
73
+ ) ;
73
74
74
- manifestClone . version = version ;
75
- for ( const dep in manifestClone . optionalDependencies ) {
76
- manifestClone . optionalDependencies [ dep ] = version ;
77
- }
75
+ const nativePackages = SUPPORTED_PLATFORMS . flatMap ( ( platform ) =>
76
+ SUPPORTED_ARCHITECTURES . map ( ( arch ) => [
77
+ `@pglt/${ getName ( platform , arch ) } ` ,
78
+ version ,
79
+ ] ) ,
80
+ ) ;
81
+
82
+ manifestData . version = version ;
83
+ manifestData . optionalDependencies = Object . fromEntries ( nativePackages ) ;
84
+
85
+ console . log ( `Update manifest ${ manifestPath } ` ) ;
86
+ const content = JSON . stringify ( manifestData , null , 2 ) ;
78
87
79
88
/**
80
89
* writeFileSync seemed to not work reliably?
81
90
*/
82
91
await new Promise ( ( res , rej ) => {
83
- fs . writeFile ( MANIFEST_PATH , JSON . stringify ( manifestClone , null , 2 ) , ( e ) =>
84
- e ? rej ( e ) : res ( ) ,
85
- ) ;
92
+ fs . writeFile ( manifestPath , content , ( e ) => ( e ? rej ( e ) : res ( ) ) ) ;
86
93
} ) ;
87
94
}
88
95
@@ -224,7 +231,9 @@ function getVersion(releaseTag, isPrerelease) {
224
231
const isPrerelease = process . env . PRERELEASE === "true" ;
225
232
226
233
await downloadSchema ( releaseTag , githubToken ) ;
227
- await overwriteManifestVersions ( releaseTag , isPrerelease ) ;
234
+ const version = getVersion ( releaseTag , isPrerelease ) ;
235
+ await writeManifest ( "pglt" , version ) ;
236
+ await writeManifest ( "backend-jsonrpc" , version ) ;
228
237
229
238
for ( const platform of SUPPORTED_PLATFORMS ) {
230
239
const os = getOs ( platform ) ;
0 commit comments