Skip to content

Commit

Permalink
feat(mac): option to set minimum macOS version the app is supported on
Browse files Browse the repository at this point in the history
Close #2472
  • Loading branch information
develar committed Jan 16, 2018
1 parent efc1923 commit 14fbed1
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 162 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"7zip-bin": "^2.3.4",
"archiver": "^2.1.1",
"async-exit-hook": "^2.0.1",
"aws-sdk": "^2.181.0",
"aws-sdk": "^2.182.0",
"bluebird-lst": "^1.0.5",
"chalk": "^2.3.0",
"chromium-pickle-js": "^0.2.0",
Expand Down Expand Up @@ -95,7 +95,7 @@
"gitbook-plugin-github": "^2.0.0",
"gitbook-plugin-github-buttons": "^3.0.0",
"globby": "^7.1.1",
"jest-cli": "^22.0.6",
"jest-cli": "^22.1.1",
"jest-junit": "^3.4.1",
"jsdoc-to-markdown": "^3.0.4",
"path-sort": "^0.1.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/electron-builder-lib/src/options/macOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export interface MacConfiguration extends PlatformSpecificBuildOptions {
*/
readonly binaries?: Array<string> | null

/**
* The minimum version of macOS required for the app to run. Corresponds to `LSMinimumSystemVersion`.
*/
readonly minimumSystemVersion?: string | null

/**
* Path of [requirements file](https://developer.apple.com/library/mac/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html) used in signing. Not applicable for MAS.
*/
Expand Down
6 changes: 5 additions & 1 deletion packages/electron-builder-lib/src/packager/mac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function createMacApp(packager: PlatformPackager<any>, appOutDir: s
const helperEHPlist = parsePlist(fileContents[2])
const helperNPPlist = parsePlist(fileContents[3])

// If an extend-info file was supplied, copy its contents in first
// if an extend-info file was supplied, copy its contents in first
if (fileContents[4] != null) {
Object.assign(appPlist, parsePlist(fileContents[4]))
}
Expand Down Expand Up @@ -92,6 +92,10 @@ export async function createMacApp(packager: PlatformPackager<any>, appOutDir: s
appPlist.CFBundleShortVersionString = macOptions.bundleShortVersion || appInfo.version
appPlist.CFBundleVersion = appInfo.buildVersion

if (macOptions.minimumSystemVersion != null) {
appPlist.LSMinimumSystemVersion = macOptions.minimumSystemVersion
}

const protocols = asArray(buildMetadata.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))
if (protocols.length > 0) {
appPlist.CFBundleURLTypes = protocols.map(protocol => {
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-publisher-s3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"dependencies": {
"fs-extra-p": "^4.5.0",
"aws-sdk": "^2.181.0",
"aws-sdk": "^2.182.0",
"mime": "^2.2.0",
"electron-publish": "~0.0.0-semantic-release",
"builder-util": "^0.0.0-semantic-release",
Expand Down
2 changes: 1 addition & 1 deletion test/out/mac/__snapshots__/macPackagerTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Object {
"DTXcode": "0821",
"DTXcodeBuild": "8C1002",
"LSApplicationCategoryType": "your.app.category.type",
"LSMinimumSystemVersion": "10.9.0",
"LSMinimumSystemVersion": "10.12.0",
"LSUIElement": true,
"NSHighResolutionCapable": true,
"NSMainNibFile": "MainMenu",
Expand Down
1 change: 1 addition & 0 deletions test/src/mac/macPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ test.ifMac("one-package", app({
extendInfo: {
LSUIElement: true,
},
minimumSystemVersion: "10.12.0",
fileAssociations: [
{
ext: "foo",
Expand Down
Loading

0 comments on commit 14fbed1

Please sign in to comment.