diff --git a/forge.sidecar.ts b/forge.sidecar.ts index 683b4a7c..e7d00ed2 100644 --- a/forge.sidecar.ts +++ b/forge.sidecar.ts @@ -59,7 +59,7 @@ function build( binDir: string, binName: string, ) { - const commands: Array<[string, string[]]> = [ + const commands: Array<[string, string[], object?]> = [ [ 'tsc', ['--project', 'tsconfig.sidecar.json', '--outDir', `${sourcesDir}`], @@ -73,7 +73,10 @@ function build( path.resolve(binDir, binName) : // otherwise build in arch-specific directory within binDir path.resolve(binDir, arch, binName); - + + // FIXME: rebuilding mountutils shouldn't be necessary, but it is. It's comming from etcher-sdk a fix has been upstreamed but to use the latest etcher-sdk we need to upgrade axios at the same time) + commands.push(['npm', ['run', 'rebuild'], { cwd: 'node_modules/mountutils' }]) + commands.push([ 'pkg', [ @@ -86,8 +89,8 @@ function build( '--public-packages', '"*"', // always build for host platform and node version - '--target', - arch, + // https://github.com/vercel/pkg-fetch/releases + `--target node18-${arch}`, '--output', `${binPath}`, ], @@ -96,10 +99,10 @@ function build( //commands.push(['ls', ['-alFR', `'${binDir}'`]]); }); - commands.forEach(([cmd, args]) => { + commands.forEach(([cmd, args, opt]) => { debug('running command:', cmd, args.join(' ')); try { - execFileSync(cmd, args, { shell: true, stdio: 'inherit' }); + execFileSync(cmd, args, { shell: true, stdio: 'inherit', ...opt }); } catch (error) {console.log(error)} }); } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 9f74e0d9..2929ce6a 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -7,6 +7,7 @@ "": { "name": "balena-etcher", "version": "1.18.13", + "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@balena/sudo-prompt": "9.2.1-workaround-windows-amperstand-in-username-0849e215b947987a643fe5763902aea201255534",