From c16dc7c9ac4217df44f30fecd15e77fb3c9d7486 Mon Sep 17 00:00:00 2001 From: heyikang Date: Thu, 9 May 2024 15:10:35 +0800 Subject: [PATCH 1/2] fix: app name contains spaces --- src/check-signature.ts | 13 ++----------- src/notarytool.ts | 5 +---- src/staple.ts | 5 +---- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/check-signature.ts b/src/check-signature.ts index 8730187..ab77858 100644 --- a/src/check-signature.ts +++ b/src/check-signature.ts @@ -6,22 +6,13 @@ import debug from 'debug'; const d = debug('electron-notarize'); const codesignDisplay = async (opts: NotarizeStapleOptions) => { - const result = await spawn('codesign', ['-dv', '-vvvv', '--deep', path.basename(opts.appPath)], { - cwd: path.dirname(opts.appPath), - }); + const result = await spawn('codesign', ['-dv', '-vvvv', '--deep', opts.appPath]); return result; }; const codesign = async (opts: NotarizeStapleOptions) => { d('attempting to check codesign of app:', opts.appPath); - const result = await spawn( - 'codesign', - ['-vvv', '--deep', '--strict', path.basename(opts.appPath)], - { - cwd: path.dirname(opts.appPath), - }, - ); - + const result = await spawn('codesign', ['-vvv', '--deep', '--strict', opts.appPath]); return result; }; export async function checkSignatures(opts: NotarizeStapleOptions): Promise { diff --git a/src/notarytool.ts b/src/notarytool.ts index 6b43431..95381f4 100644 --- a/src/notarytool.ts +++ b/src/notarytool.ts @@ -59,10 +59,7 @@ export async function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions) d('zipping application to:', filePath); const zipResult = await spawn( 'ditto', - ['-c', '-k', '--sequesterRsrc', '--keepParent', path.basename(opts.appPath), filePath], - { - cwd: path.dirname(opts.appPath), - }, + ['-c', '-k', '--sequesterRsrc', '--keepParent', opts.appPath, filePath], ); if (zipResult.code !== 0) { throw new Error( diff --git a/src/staple.ts b/src/staple.ts index 037fba8..67e45ec 100644 --- a/src/staple.ts +++ b/src/staple.ts @@ -1,5 +1,4 @@ import debug from 'debug'; -import * as path from 'path'; import { spawn } from './spawn'; import { NotarizeStapleOptions } from './types'; @@ -8,9 +7,7 @@ const d = debug('electron-notarize:staple'); export async function stapleApp(opts: NotarizeStapleOptions): Promise { d('attempting to staple app:', opts.appPath); - const result = await spawn('xcrun', ['stapler', 'staple', '-v', path.basename(opts.appPath)], { - cwd: path.dirname(opts.appPath), - }); + const result = await spawn('xcrun', ['stapler', 'staple', '-v', opts.appPath]); if (result.code !== 0) { throw new Error( From 3a8b71bc7e6af2d3c110b6052c56cd83508d4110 Mon Sep 17 00:00:00 2001 From: Erick Zhao Date: Thu, 14 Nov 2024 10:20:21 -0800 Subject: [PATCH 2/2] fix formatting --- src/notarytool.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/notarytool.ts b/src/notarytool.ts index 0631ee1..35434e9 100644 --- a/src/notarytool.ts +++ b/src/notarytool.ts @@ -81,10 +81,14 @@ export async function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions) } else { filePath = path.resolve(dir, `${path.parse(opts.appPath).name}.zip`); d('zipping application to:', filePath); - const zipResult = await spawn( - 'ditto', - ['-c', '-k', '--sequesterRsrc', '--keepParent', opts.appPath, filePath], - ); + const zipResult = await spawn('ditto', [ + '-c', + '-k', + '--sequesterRsrc', + '--keepParent', + opts.appPath, + filePath, + ]); if (zipResult.code !== 0) { throw new Error( `Failed to zip application, exited with code: ${zipResult.code}\n\n${zipResult.output}`,