Skip to content

Commit

Permalink
Merge pull request #3 from npohle/fix/macos-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre authored Dec 1, 2024
2 parents 89dcc56 + f563835 commit 70a4181
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/env node
#!/usr/bin/env node
import { execSync } from 'node:child_process';
import * as fs from 'node:fs';
import { dirname, join, parse } from 'node:path';
Expand Down Expand Up @@ -88,7 +88,7 @@ const blob = fs.readFileSync(blobPath);
fs.mkdirSync(prefix.endsWith('/') ? prefix : dirname(prefix), { recursive: true });

async function getNode(archiveBase: string) {
const isWindows = archiveBase.includes('win');
const isWindows = archiveBase.includes('-win');

const archiveFile = archiveBase + '.' + (isWindows ? 'zip' : 'tar.gz');
const archivePath = join(tempDir, archiveFile);
Expand Down Expand Up @@ -161,11 +161,22 @@ async function buildSEA(target: string) {

fs.mkdirSync(dirname(seaPath), { recursive: true });
fs.copyFileSync(join(tempDir, archiveBase), seaPath);

if (target == 'darwin-arm64') {
_log('Removing signature:', seaPath);
execSync(`codesign --remove-signature "${seaPath}"`);
}

_log('Injecting:', seaPath);
await inject(seaPath, 'NODE_SEA_BLOB', blob, {
machoSegmentName: 'NODE_SEA',
sentinelFuse: 'NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2',
});

if (target == 'darwin-arm64') {
_log('Signing binary:', seaPath);
execSync(`codesign --sign - "${seaPath}"`);
}
}

for (const target of options.target) {
Expand Down

0 comments on commit 70a4181

Please sign in to comment.