Skip to content

Commit

Permalink
fix: relative path for notarize file
Browse files Browse the repository at this point in the history
  • Loading branch information
panther7 committed Feb 25, 2024
1 parent df2d00d commit 12c438d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ For notarization, you need the following things:

* `options` Object
* `tool` String - The notarization tool to use, default is `notarytool`. Can be `legacy` or `notarytool`. `notarytool` is substantially (10x) faster and `legacy` is deprecated and will **stop working** on November 1st 2023.
* `appPath` String - The absolute path to your `.app` file
* `appPath` String - The absolute path to your `.app`, `.dmg` or `.pkg` file
* There are different options for each tool: Notarytool
* There are three authentication methods available: user name with password:
* `appleId` String - The username of your apple developer account
Expand Down
19 changes: 9 additions & 10 deletions src/notarytool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,18 @@ export async function isNotaryToolAvailable() {
export async function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions) {
d('starting notarize process for app:', opts.appPath);
return await withTempDir(async dir => {
const fileExt = path.extname(opts.appPath);
let filePath;
if (fileExt === '.dmg' || fileExt === '.pkg') {
filePath = path.resolve(dir, opts.appPath);
d('attempting to upload file to Apple: ', filePath);
const parsedAppPath = path.parse(opts.appPath);
let filename = opts.appPath;
if (['.dmg', '.pkg'].includes(parsedAppPath.ext)) {
d('attempting to upload file to Apple: ', filename);
} else {
filePath = path.resolve(dir, `${path.parse(opts.appPath).name}.zip`);
d('zipping application to:', filePath);
filename = path.resolve(dir, `${parsedAppPath.name}.zip`);
d('zipping application to:', filename);
const zipResult = await spawn(
'ditto',
['-c', '-k', '--sequesterRsrc', '--keepParent', path.basename(opts.appPath), filePath],
['-c', '-k', '--sequesterRsrc', '--keepParent', parsedAppPath.base, filename],
{
cwd: path.dirname(opts.appPath),
cwd: parsedAppPath.dir,
},
);
if (zipResult.code !== 0) {
Expand All @@ -75,7 +74,7 @@ export async function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions)
const notarizeArgs = [
'notarytool',
'submit',
filePath,
filename,
...authorizationArgs(opts),
'--wait',
'--output-format',
Expand Down

0 comments on commit 12c438d

Please sign in to comment.