Skip to content

Commit

Permalink
Require Node.js 18
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 30, 2024
1 parent aee41e8 commit 557974c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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+

Expand Down Expand Up @@ -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);
}
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
"bin": {
"create-dmg": "./cli.js"
},
"sideEffects": false,
"engines": {
"node": ">=14.16"
"node": ">=18"
},
"scripts": {
"test": "ava"
Expand Down Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand All @@ -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')) {
Expand All @@ -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')) {
Expand Down

0 comments on commit 557974c

Please sign in to comment.