Skip to content

Commit

Permalink
feat: retry staple up to 3 times (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound authored Jun 29, 2023
1 parent 12c1379 commit a59d260
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 9 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@
"@types/fs-extra": "^9.0.1",
"@types/jest": "^29.0.0",
"@types/node": "^13.7.7",
"@types/promise-retry": "^1.1.3",
"jest": "^29.0.0",
"prettier": "^1.18.2",
"ts-jest": "^29.0.0",
"typescript": "^4.8.4"
},
"dependencies": {
"debug": "^4.1.1",
"fs-extra": "^9.0.1"
"fs-extra": "^9.0.1",
"promise-retry": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as debug from 'debug';
import debug from 'debug';
import * as fs from 'fs-extra';
import * as os from 'os';
import * as path from 'path';
Expand Down
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as debug from 'debug';
import debug from 'debug';
import retry from 'promise-retry';

import { delay } from './helpers';
import { startLegacyNotarize, waitForLegacyNotarize } from './legacy';
import { isNotaryToolAvailable, notarizeAndWaitForNotaryTool } from './notarytool';
Expand Down Expand Up @@ -48,5 +50,7 @@ export async function notarize({ appPath, ...otherOptions }: NotarizeOptions) {
} as NotaryToolStartOptions);
}

await stapleApp({ appPath });
await retry(() => stapleApp({ appPath }), {
retries: 3,
});
}
2 changes: 1 addition & 1 deletion src/legacy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as debug from 'debug';
import debug from 'debug';
import * as path from 'path';

import { spawn } from './spawn';
Expand Down
2 changes: 1 addition & 1 deletion src/notarytool.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as debug from 'debug';
import debug from 'debug';
import * as path from 'path';

import { spawn } from './spawn';
Expand Down
2 changes: 1 addition & 1 deletion src/spawn.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { spawn as cpSpawn, SpawnOptions } from 'child_process';
import * as debug from 'debug';
import debug from 'debug';
import { isSecret } from './helpers';

const d = debug('electron-notarize:spawn');
Expand Down
2 changes: 1 addition & 1 deletion src/staple.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as debug from 'debug';
import debug from 'debug';
import * as path from 'path';

import { spawn } from './spawn';
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"noUnusedLocals": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noImplicitUseStrict": true,
"declaration": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"esModuleInterop": true
},
"include": [
"src/**/*"
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,18 @@
resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.1.tgz#dfd20e2dc35f027cdd6c1908e80a5ddc7499670e"
integrity sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==

"@types/promise-retry@^1.1.3":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@types/promise-retry/-/promise-retry-1.1.3.tgz#baab427419da9088a1d2f21bf56249c21b3dd43c"
integrity sha512-LxIlEpEX6frE3co3vCO2EUJfHIta1IOmhDlcAsR4GMMv9hev1iTI9VwberVGkePJAuLZs5rMucrV8CziCfuJMw==
dependencies:
"@types/retry" "*"

"@types/retry@*":
version "0.12.2"
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a"
integrity sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==

"@types/stack-utils@^2.0.0":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c"
Expand Down

0 comments on commit a59d260

Please sign in to comment.