parent
4394f4f445
commit
fab154ff35
18
cli.js
18
cli.js
|
@ -79,7 +79,6 @@ async function init() {
|
|||
}
|
||||
|
||||
const appName = appInfo.CFBundleDisplayName || appInfo.CFBundleName;
|
||||
const appIconName = appInfo.CFBundleIconFile.replace(/\.icns/, '');
|
||||
const dmgTitle = appName.length > 27 ? (cli.flags.dmgTitle || appName) : appName;
|
||||
const dmgPath = path.join(destinationPath, `${appName} ${appInfo.CFBundleShortVersionString}.dmg`);
|
||||
|
||||
|
@ -89,8 +88,13 @@ async function init() {
|
|||
} catch (_) {}
|
||||
}
|
||||
|
||||
ora.text = 'Creating icon';
|
||||
const composedIconPath = await composeIcon(path.join(appPath, 'Contents/Resources', `${appIconName}.icns`));
|
||||
const hasAppIcon = appInfo.CFBundleIconFile;
|
||||
let composedIconPath;
|
||||
if (hasAppIcon) {
|
||||
ora.text = 'Creating icon';
|
||||
const appIconName = appInfo.CFBundleIconFile.replace(/\.icns/, '');
|
||||
composedIconPath = await composeIcon(path.join(appPath, 'Contents/Resources', `${appIconName}.icns`));
|
||||
}
|
||||
|
||||
const minSystemVersion = (Object.prototype.hasOwnProperty.call(appInfo, 'LSMinimumSystemVersion') && appInfo.LSMinimumSystemVersion.length > 0) ? appInfo.LSMinimumSystemVersion.toString() : '10.11';
|
||||
const minorVersion = Number(minSystemVersion.split('.')[1]) || 0;
|
||||
|
@ -143,9 +147,11 @@ async function init() {
|
|||
ora.text = 'Adding Software License Agreement if needed';
|
||||
await addLicenseAgreementIfNeeded(dmgPath, dmgFormat);
|
||||
|
||||
ora.text = 'Replacing DMG icon';
|
||||
// `seticon`` is a native tool to change files icons (Source: https://github.com/sveinbjornt/osxiconutils)
|
||||
await execa(path.join(__dirname, 'seticon'), [composedIconPath, dmgPath]);
|
||||
if (hasAppIcon) {
|
||||
ora.text = 'Replacing DMG icon';
|
||||
// `seticon`` is a native tool to change files icons (Source: https://github.com/sveinbjornt/osxiconutils)
|
||||
await execa(path.join(__dirname, 'seticon'), [composedIconPath, dmgPath]);
|
||||
}
|
||||
|
||||
ora.text = 'Code signing DMG';
|
||||
let identity;
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>15G1217</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>fixture</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.sindresorhus.create-dmg.fixture</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Fixture</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string></string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>8C38</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>16C58</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.12</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0820</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>8C38</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.11</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>EventViewerApplication</string>
|
||||
<key>NSSupportsSuddenTermination</key>
|
||||
<string>YES</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
APPL????
|
Binary file not shown.
Binary file not shown.
19
test.js
19
test.js
|
@ -8,7 +8,7 @@ test('main', async t => {
|
|||
const cwd = tempy.directory();
|
||||
|
||||
try {
|
||||
await execa(path.join(__dirname, 'cli.js'), [path.join(__dirname, 'fixture.app')], {cwd});
|
||||
await execa(path.join(__dirname, 'cli.js'), [path.join(__dirname, 'fixtures/Fixture.app')], {cwd});
|
||||
} catch (error) {
|
||||
// Silence code signing failure
|
||||
if (!error.message.includes('Code signing failed')) {
|
||||
|
@ -23,7 +23,22 @@ test('binary plist', async t => {
|
|||
const cwd = tempy.directory();
|
||||
|
||||
try {
|
||||
await execa(path.join(__dirname, 'cli.js'), [path.join(__dirname, 'fixture-with-binary-plist.app')], {cwd});
|
||||
await execa(path.join(__dirname, 'cli.js'), [path.join(__dirname, 'fixtures/Fixture-with-binary-plist.app')], {cwd});
|
||||
} catch (error) {
|
||||
// Silence code signing failure
|
||||
if (!error.message.includes('Code signing failed')) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
t.true(fs.existsSync(path.join(cwd, 'Fixture 0.0.1.dmg')));
|
||||
});
|
||||
|
||||
test('app without icon', async t => {
|
||||
const cwd = tempy.directory();
|
||||
|
||||
try {
|
||||
await execa(path.join(__dirname, 'cli.js'), [path.join(__dirname, 'fixtures/Fixture-no-icon.app')], {cwd});
|
||||
} catch (error) {
|
||||
// Silence code signing failure
|
||||
if (!error.message.includes('Code signing failed')) {
|
||||
|
|
Loading…
Reference in New Issue