Skip to content

Commit

Permalink
Add support for macOS signing.
Browse files Browse the repository at this point in the history
Using the technique from pkg vercel/pkg#1164.
  • Loading branch information
bruce-one committed Apr 12, 2023
1 parent fdd9d97 commit bade0d8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/steps/cli.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { platform } from 'os'
import { dirname, normalize, relative, resolve } from 'path'
import { createWriteStream, chmodSync, statSync } from 'fs'
import { createWriteStream, chmodSync, statSync, readFileSync, writeFileSync } from 'fs'
import { NexeCompiler } from '../compiler'
import { NexeTarget } from '../target'
import { STDIN_FLAG } from '../util'
import { patchMachOExecutable } from './mach-o'
import mkdirp = require('mkdirp')

/**
Expand Down Expand Up @@ -42,6 +44,10 @@ export default async function cli(compiler: NexeCompiler, next: () => Promise<vo
outputFileLogOutput = relative(process.cwd(), output)

chmodSync(output, mode.toString(8).slice(-3))
if (platform() === 'darwin') {
step.log('Preparing binary for macOS signing.')
writeFileSync(output, patchMachOExecutable(readFileSync(output)))
}
step.log(
`Entry: '${
compiler.stdinUsed
Expand Down

0 comments on commit bade0d8

Please sign in to comment.