@@ -79,12 +79,16 @@ export async function buildConfig(config: BuildConfiguration, opts: Options) {
7979
8080 logger . debug ( "> Building directories... " )
8181
82- const stagingDir = resolve (
83- join ( config . stagingDirectory , config . os , config . arch , config . runtime , `${ dist . abi ( ) } ` , config . addonSubdirectory ) ,
84- )
85- const targetDir = resolve (
86- join ( config . targetDirectory , config . os , config . arch , config . runtime , `${ dist . abi ( ) } ` , config . addonSubdirectory ) ,
82+ const subDirectory = join (
83+ config . os ,
84+ config . arch ,
85+ config . runtime ,
86+ `${ config . libc } -${ dist . abi ( ) } -${ config . buildType } ` ,
87+ config . addonSubdirectory ,
8788 )
89+
90+ const stagingDir = resolve ( join ( config . stagingDirectory , subDirectory ) )
91+ const targetDir = resolve ( join ( config . targetDirectory , subDirectory ) )
8892 logger . debug ( "[ DONE ]" )
8993
9094 logger . debug ( "> Applying overrides... " )
@@ -150,6 +154,18 @@ Build Type: ${config.buildType}
150154 manifest = JSON . parse ( manifestContent )
151155 }
152156 // add the new entry to the manifest
153- manifest [ JSON . stringify ( config ) ] = relative ( config . targetDirectory , addonPath )
157+ manifest [ serializeConfig ( config , config . packageDirectory ) ] = relative ( config . targetDirectory , addonPath )
154158 await writeFile ( manifestPath , JSON . stringify ( manifest , null , 2 ) )
155159}
160+
161+ function serializeConfig ( config : BuildConfiguration , rootDir : string ) {
162+ // replace absolute paths with relative paths
163+ const serialized = JSON . stringify ( config , ( _key , value ) => {
164+ if ( typeof value === "string" && value . startsWith ( rootDir ) ) {
165+ return relative ( rootDir , value )
166+ }
167+ return value
168+ } )
169+
170+ return serialized
171+ }
0 commit comments