Skip to content

Commit 60d004d

Browse files
committed
Merge branch 'main' into build/use-azure-docs
2 parents 8e5f564 + d914d04 commit 60d004d

20 files changed

+611
-2617
lines changed

.github/workflows/docs.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jobs:
1717
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2
1818
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # tag: v4.2.0
1919
with:
20-
node-version: 22.12.x
20+
node-version: '22.12.x'
21+
cache: 'yarn'
2122
- name: Install dependencies
2223
run: yarn --frozen-lockfile
2324
- name: Build API documentation

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup Node.js
2525
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
2626
with:
27-
node-version: 20.x
27+
node-version: '22.12.x'
2828
cache: 'yarn'
2929
- name: Install
3030
run: yarn install --frozen-lockfile

.github/workflows/test.yml

+2-13
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,18 @@ jobs:
1717
strategy:
1818
matrix:
1919
node-version:
20-
- '20.9'
21-
- '18.17'
22-
- '16.20'
23-
- '14.16'
20+
- '22.12.x'
2421
runs-on: macos-latest
2522
steps:
26-
- name: Install Rosetta
27-
if: ${{ matrix.node-version == '14.16' }}
28-
run: /usr/sbin/softwareupdate --install-rosetta --agree-to-license
2923
- name: Checkout
3024
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3125
- name: Setup Node.js
3226
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
3327
with:
3428
node-version: "${{ matrix.node-version }}"
3529
cache: 'yarn'
36-
architecture: ${{ matrix.node-version == '14.16' && 'x64' || env.RUNNER_ARCH }}
37-
- name: Install (Node.js v16+)
38-
if : ${{ matrix.node-version != '14.16' }}
30+
- name: Install dependencies
3931
run: yarn install --frozen-lockfile
40-
- name: Install (Node.js < v16)
41-
if : ${{ matrix.node-version == '14.16' }}
42-
run: yarn install --frozen-lockfile --ignore-engines
4332
- name: Lint
4433
run: yarn lint
4534
- name: Test

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.12

jest.config.js

-4
This file was deleted.

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "@electron/notarize",
33
"version": "0.0.0-development",
44
"description": "Notarize your Electron app",
5-
"main": "lib/index.js",
5+
"type": "module",
6+
"exports": "./lib/index.js",
67
"typings": "lib/index.d.ts",
78
"author": "Samuel Attard",
89
"license": "MIT",
@@ -20,33 +21,32 @@
2021
"lint": "prettier --check \"src/**/*.ts\"",
2122
"prettier:write": "prettier --write \"src/**/*.ts\"",
2223
"prepare": "yarn build",
23-
"test": "jest"
24+
"test": "vitest run"
2425
},
2526
"files": [
2627
"lib"
2728
],
2829
"engines": {
29-
"node": ">= 10.0.0"
30+
"node": ">= 22.12.0"
3031
},
3132
"publishConfig": {
3233
"provenance": true
3334
},
3435
"devDependencies": {
35-
"@types/debug": "^4.1.5",
36-
"@types/fs-extra": "^9.0.1",
37-
"@types/jest": "^29.0.0",
38-
"@types/node": "^13.7.7",
36+
"@tsconfig/node22": "^22.0.0",
37+
"@types/debug": "^4.1.12",
38+
"@types/graceful-fs": "^4.1.9",
39+
"@types/node": "~22.10.7",
3940
"@types/promise-retry": "^1.1.3",
40-
"jest": "^29.0.0",
4141
"prettier": "^3.4.2",
42-
"ts-jest": "^29.0.0",
4342
"typedoc": "~0.25.13",
4443
"typedoc-plugin-missing-exports": "^2.2.0",
45-
"typescript": "4.9.3"
44+
"typescript": "~5.4.5",
45+
"vitest": "^3.0.8"
4646
},
4747
"dependencies": {
48-
"debug": "^4.1.1",
49-
"fs-extra": "^9.0.1",
48+
"debug": "^4.4.0",
49+
"graceful-fs": "^4.2.11",
5050
"promise-retry": "^2.0.1"
5151
}
5252
}

src/check-signature.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as path from 'path';
22

3-
import { spawn } from './spawn';
4-
import { NotaryToolNotarizeAppOptions } from './types';
3+
import { spawn } from './spawn.js';
4+
import { NotaryToolNotarizeAppOptions } from './types.js';
55
import debug from 'debug';
66
const d = debug('electron-notarize');
77

src/helpers.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
import debug from 'debug';
2-
import * as fs from 'fs-extra';
3-
import * as os from 'os';
4-
import * as path from 'path';
2+
import * as fs from 'graceful-fs';
3+
4+
import * as os from 'node:os';
5+
import * as path from 'node:path';
6+
import * as util from 'node:util';
57

68
const d = debug('electron-notarize:helpers');
79

810
export async function withTempDir<T>(fn: (dir: string) => Promise<T>) {
9-
const dir = await fs.mkdtemp(path.resolve(os.tmpdir(), 'electron-notarize-'));
11+
const dir = await util.promisify(fs.mkdtemp)(path.resolve(os.tmpdir(), 'electron-notarize-'));
1012
d('doing work inside temp dir:', dir);
1113
let result: T;
1214
try {
1315
result = await fn(dir);
1416
} catch (err) {
1517
d('work failed');
16-
await fs.remove(dir);
18+
await util.promisify(fs.rm)(dir, { recursive: true, force: true });
1719
throw err;
1820
}
1921
d('work succeeded');
20-
await fs.remove(dir);
22+
await util.promisify(fs.rm)(dir, { recursive: true, force: true });
2123
return result;
2224
}
2325

src/index.ts

+7-22
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
import debug from 'debug';
22
import retry from 'promise-retry';
33

4-
import { checkSignatures } from './check-signature';
5-
import { isNotaryToolAvailable, notarizeAndWaitForNotaryTool } from './notarytool';
6-
import { stapleApp } from './staple';
7-
import {
8-
NotarizeOptions,
9-
NotaryToolStartOptions,
10-
NotarizeOptionsLegacy,
11-
NotarizeOptionsNotaryTool,
12-
} from './types';
4+
import { checkSignatures } from './check-signature.js';
5+
import { isNotaryToolAvailable, notarizeAndWaitForNotaryTool } from './notarytool.js';
6+
import { stapleApp } from './staple.js';
7+
import { NotarizeOptions } from './types.js';
138

149
const d = debug('electron-notarize');
1510

1611
export { NotarizeOptions };
1712

18-
export { validateNotaryToolAuthorizationArgs as validateAuthorizationArgs } from './validate-args';
13+
export { validateNotaryToolAuthorizationArgs as validateAuthorizationArgs } from './validate-args.js';
1914

2015
/**
2116
* Sends your app to Apple for notarization with `notarytool` and staples a successful
@@ -28,19 +23,9 @@ export { validateNotaryToolAuthorizationArgs as validateAuthorizationArgs } from
2823
* @param args Options for notarization
2924
* @returns The Promise resolves once notarization is complete. Note that this may take a few minutes.
3025
*/
31-
async function notarize(args: NotarizeOptionsNotaryTool): Promise<void>;
32-
/**
33-
* @deprecated
34-
*/
35-
async function notarize(args: NotarizeOptionsLegacy): Promise<void>;
26+
async function notarize(args: NotarizeOptions): Promise<void>;
3627

3728
async function notarize({ appPath, ...otherOptions }: NotarizeOptions) {
38-
if (otherOptions.tool === 'legacy') {
39-
throw new Error(
40-
'Notarization with the legacy altool system was decommisioned as of November 2023',
41-
);
42-
}
43-
4429
await checkSignatures({ appPath });
4530

4631
d('notarizing using notarytool');
@@ -53,7 +38,7 @@ async function notarize({ appPath, ...otherOptions }: NotarizeOptions) {
5338
await notarizeAndWaitForNotaryTool({
5439
appPath,
5540
...otherOptions,
56-
} as NotaryToolStartOptions);
41+
} as NotarizeOptions);
5742

5843
await retry(() => stapleApp({ appPath }), {
5944
retries: 3,

src/legacy.ts

-18
This file was deleted.

src/notarytool.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import debug from 'debug';
2-
import * as path from 'path';
2+
import path from 'node:path';
33

4-
import { spawn } from './spawn';
5-
import { makeSecret, withTempDir } from './helpers';
4+
import { spawn } from './spawn.js';
5+
import { makeSecret, withTempDir } from './helpers.js';
66
import {
77
validateNotaryToolAuthorizationArgs,
88
isNotaryToolPasswordCredentials,
99
isNotaryToolApiKeyCredentials,
10-
} from './validate-args';
11-
import { NotaryToolCredentials, NotaryToolStartOptions } from './types';
10+
} from './validate-args.js';
11+
import { NotarizeOptions, NotaryToolCredentials } from './types.js';
1212

1313
const d = debug('electron-notarize:notarytool');
1414

@@ -47,7 +47,7 @@ function authorizationArgs(rawOpts: NotaryToolCredentials): string[] {
4747
}
4848
}
4949

50-
async function getNotarizationLogs(opts: NotaryToolStartOptions, id: string) {
50+
async function getNotarizationLogs(opts: NotarizeOptions, id: string) {
5151
try {
5252
const logResult = await runNotaryTool(
5353
['log', id, ...authorizationArgs(opts)],
@@ -70,7 +70,7 @@ export async function isNotaryToolAvailable(notarytoolPath?: string) {
7070
}
7171
}
7272

73-
export async function notarizeAndWaitForNotaryTool(opts: NotaryToolStartOptions) {
73+
export async function notarizeAndWaitForNotaryTool(opts: NotarizeOptions) {
7474
d('starting notarize process for app:', opts.appPath);
7575
return await withTempDir(async (dir) => {
7676
const fileExt = path.extname(opts.appPath);

src/spawn.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { spawn as cpSpawn, SpawnOptions } from 'child_process';
1+
import { spawn as cpSpawn, SpawnOptions } from 'node:child_process';
2+
23
import debug from 'debug';
3-
import { isSecret } from './helpers';
4+
5+
import { isSecret } from './helpers.js';
46

57
const d = debug('electron-notarize:spawn');
68

src/staple.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import debug from 'debug';
22
import * as path from 'path';
33

4-
import { spawn } from './spawn';
5-
import { NotaryToolNotarizeAppOptions } from './types';
4+
import { spawn } from './spawn.js';
5+
import { NotaryToolNotarizeAppOptions } from './types.js';
66

77
const d = debug('electron-notarize:staple');
88

0 commit comments

Comments
 (0)