diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fcadac3..e5c4df3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,9 +10,8 @@ jobs: fail-fast: false matrix: node-version: + - 20 - 18 - - 16 - - 14 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 diff --git a/cli.js b/cli.js index 7594dbb..5e98580 100755 --- a/cli.js +++ b/cli.js @@ -82,12 +82,12 @@ async function init() { appInfo = plist.parse(stdout); } - const appName = appInfo.CFBundleDisplayName || appInfo.CFBundleName; + const appName = appInfo.CFBundleDisplayName ?? appInfo.CFBundleName; if (!appName) { throw new Error('The app must have `CFBundleDisplayName` or `CFBundleName` defined in its `Info.plist`.'); } - const dmgTitle = cli.flags.dmgTitle || appName; + const dmgTitle = cli.flags.dmgTitle ?? appName; const dmgFilename = `${appName} ${appInfo.CFBundleShortVersionString}.dmg`; const dmgPath = path.join(destinationPath, dmgFilename); @@ -110,7 +110,6 @@ async function init() { composedIconPath = await composeIcon(path.join(appPath, 'Contents/Resources', `${appIconName}.icns`)); } - // Xcode 14+ only supports building apps for macOS 10.13+ const dmgFormat = 'ULFO'; // ULFO requires macOS 10.11+ const dmgFilesystem = 'APFS'; // APFS requires macOS 10.13+ @@ -212,6 +211,6 @@ async function init() { try { await init(); } catch (error) { - ora.fail((error && error.stack) || error); + ora.fail(error?.stack || error); process.exit(1); } diff --git a/package.json b/package.json index 50e0a6a..6ee8ed9 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,8 @@ "bin": { "create-dmg": "./cli.js" }, - "sideEffects": false, "engines": { - "node": ">=14.16" + "node": ">=18" }, "scripts": { "test": "ava" @@ -44,16 +43,16 @@ ], "dependencies": { "appdmg": "^0.6.6", - "execa": "^6.1.0", + "execa": "^8.0.1", "gm": "^1.25.0", "icns-lib": "^1.0.1", - "meow": "^11.0.0", - "ora": "^6.1.2", - "plist": "^3.0.6", - "tempy": "^3.0.0" + "meow": "^13.1.0", + "ora": "^8.0.1", + "plist": "^3.1.0", + "tempy": "^3.1.0" }, "devDependencies": { - "ava": "^5.2.0", - "xo": "^0.53.1" + "ava": "^6.1.1", + "xo": "^0.56.0" } } diff --git a/readme.md b/readme.md index 1426461..afb635b 100644 --- a/readme.md +++ b/readme.md @@ -10,7 +10,7 @@ Imagine you have finished a macOS app, exported it from Xcode, and now want to d ## Install -Ensure you have [Node.js](https://nodejs.org) 14 or later installed. Then run the following: +Ensure you have [Node.js](https://nodejs.org) 18 or later installed. Then run the following: ```sh npm install --global create-dmg diff --git a/test.js b/test.js index c10d686..3ae3ecc 100644 --- a/test.js +++ b/test.js @@ -11,7 +11,7 @@ test('main', async t => { const cwd = temporaryDirectory(); try { - await execa(path.join(__dirname, 'cli.js'), [path.join(__dirname, 'fixtures/Fixture.app')], {cwd}); + await execa(path.join(__dirname, 'cli.js'), ['--identity=0', path.join(__dirname, 'fixtures/Fixture.app')], {cwd}); } catch (error) { // Silence code signing failure if (!error.message.includes('No suitable code signing')) { @@ -26,7 +26,7 @@ test('binary plist', async t => { const cwd = temporaryDirectory(); try { - await execa(path.join(__dirname, 'cli.js'), [path.join(__dirname, 'fixtures/Fixture-with-binary-plist.app')], {cwd}); + await execa(path.join(__dirname, 'cli.js'), ['--identity=0', path.join(__dirname, 'fixtures/Fixture-with-binary-plist.app')], {cwd}); } catch (error) { // Silence code signing failure if (!error.message.includes('No suitable code signing')) { @@ -41,7 +41,7 @@ test('app without icon', async t => { const cwd = temporaryDirectory(); try { - await execa(path.join(__dirname, 'cli.js'), [path.join(__dirname, 'fixtures/Fixture-no-icon.app')], {cwd}); + await execa(path.join(__dirname, 'cli.js'), ['--identity=0', path.join(__dirname, 'fixtures/Fixture-no-icon.app')], {cwd}); } catch (error) { // Silence code signing failure if (!error.message.includes('No suitable code signing')) {