Skip to content

Commit

Permalink
chore: remove "osx" name support — use "mac" instead
Browse files Browse the repository at this point in the history
BREAKING CHANGE: remove "osx" name support — use "mac" instead
  • Loading branch information
develar committed Nov 10, 2016
1 parent b1ea8cd commit aa05ac0
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 44 deletions.
1 change: 0 additions & 1 deletion src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export function normalizeOptions(args: CliOptions): BuildOptions {
delete r.l
delete r.w
delete r.windows
delete r.osx
delete r.macos
delete r.$0
delete r._
Expand Down
4 changes: 2 additions & 2 deletions src/cliOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function createYargs(): any {
.example("build --em.foo=bar", "set application package.json property `foo` to `bar`")
.option("mac", {
group: buildGroup,
alias: ["m", "o", "osx", "macos"],
alias: ["m", "o", "macos"],
describe: `Build for MacOS, accepts target list (see ${underline("https://goo.gl/HAnnq8")}).`,
type: "array",
})
Expand Down Expand Up @@ -71,7 +71,7 @@ export function createYargs(): any {
.option("platform", {
group: deprecated,
describe: "The target platform (preferred to use --mac, --win or --linux)",
choices: ["mac", "osx", "win", "linux", "darwin", "win32", "all"],
choices: ["mac", "win", "linux", "darwin", "win32", "all"],
})
.option("arch", {
group: deprecated,
Expand Down
4 changes: 0 additions & 4 deletions src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ export default class MacPackager extends PlatformPackager<MacOptions> {
return iconPath == null ? await this.getDefaultIcon("icns") : path.resolve(this.projectDir, iconPath)
}

normalizePlatformSpecificBuildOptions(options: MacOptions | n): MacOptions {
return super.normalizePlatformSpecificBuildOptions(options == null ? (<any>this.info.devMetadata.build).osx : options)
}

createTargets(targets: Array<string>, mapper: (name: string, factory: () => Target) => void, cleanupTasks: Array<() => Promise<any>>): void {
for (let name of targets) {
switch (name) {
Expand Down
4 changes: 0 additions & 4 deletions src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ export interface BuildMetadata {
*/
readonly dmg?: DmgOptions | null

// deprecated
readonly osx?: MacOptions | null

/*
See [.build.mas](#MasBuildOptions).
*/
Expand Down Expand Up @@ -377,7 +374,6 @@ export class Platform {
switch (name) {
case Platform.MAC.nodeName:
case Platform.MAC.name:
case "osx":
return Platform.MAC

case Platform.WINDOWS.nodeName:
Expand Down
3 changes: 3 additions & 0 deletions src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ export class Packager implements BuildInfo {
if (build["osx-sign"] != null) {
throw new Error("osx-sign is deprecated and not supported — please see https://github.com/electron-userland/electron-builder/wiki/Code-Signing")
}
if (build["osx"] != null) {
throw new Error(`"osx" in the "build" is deprecated and not supported — please see use "mac" instead`)
}

const author = appMetadata.author
if (author == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/targets/dmg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class DmgTarget extends TargetEx {
x: 400,
y: 100,
},
}, Object.assign({}, this.packager.devMetadata.build.osx, packager.devMetadata.build.dmg))
}, packager.devMetadata.build.dmg)

// appdmg
const oldPosition = specification.window.position
Expand Down
2 changes: 0 additions & 2 deletions test/src/BuildTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ test("cli", () => {
return normalizeOptions(yargs.parse(input.split(" ")))
}

assertThat(parse("--platform osx")).isEqualTo(expected({targets: Platform.MAC.createTarget()}))
assertThat(parse("--platform mac")).isEqualTo(expected({targets: Platform.MAC.createTarget()}))

const all = expected({targets: new Map([...Platform.MAC.createTarget(null, Arch.x64), ...Platform.WINDOWS.createTarget(null, Arch.x64, Arch.ia32), ...Platform.LINUX.createTarget(null, Arch.x64, Arch.ia32)])})
Expand All @@ -38,7 +37,6 @@ test("cli", () => {
assertThat(parse("--ia32 --dir")).isEqualTo(expected({targets: Platform.current().createTarget(DIR_TARGET, Arch.ia32)}))
assertThat(parse("--platform linux --dir")).isEqualTo(expected({targets: Platform.LINUX.createTarget(DIR_TARGET)}))

assertThat(parse("--osx")).isEqualTo(expected({targets: Platform.MAC.createTarget()}))
assertThat(parse("--arch x64")).isEqualTo(expected({targets: Platform.current().createTarget(null, Arch.x64)}))
assertThat(parse("--ia32 --x64")).isEqualTo(expected({targets: Platform.current().createTarget(null, Arch.x64, Arch.ia32)}))
assertThat(parse("--linux")).isEqualTo(expected({targets: Platform.LINUX.createTarget()}))
Expand Down
2 changes: 1 addition & 1 deletion test/src/helpers/packTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function assertPack(fixtureName: string, packagerOptions: PackagerO
const customTmpDir = process.env.TEST_APP_TMP_DIR
let dirToDelete: string | null = null
if (useTempDir) {
// non-osx test uses the same dir as osx test, but we cannot share node_modules (because tests executed in parallel)
// non-macOS test uses the same dir as macOS test, but we cannot share node_modules (because tests executed in parallel)
const dir = customTmpDir == null ? path.join(testDir, `${(tmpDirCounter++).toString(16)}`) : path.resolve(customTmpDir)
if (customTmpDir == null) {
dirToDelete = dir
Expand Down
29 changes: 0 additions & 29 deletions test/src/macPackagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,30 +187,6 @@ test.ifOsx("no build directory", app(platform(Platform.MAC), {
projectDirCreated: projectDir => remove(path.join(projectDir, "build"))
}))

test.ifOsx("custom background - old way", () => {
let platformPackager: CheckingMacPackager = null
const customBackground = "customBackground.tiff"
return assertPack("test-app-one", {
targets: Platform.MAC.createTarget(),
platformPackagerFactory: (packager, platform, cleanupTasks) => platformPackager = new CheckingMacPackager(packager)
}, {
projectDirCreated: projectDir => BluebirdPromise.all([
copy(path.join(__dirname, "..", "..", "templates", "dmg", "background.tiff"), path.join(projectDir, customBackground)),
modifyPackageJson(projectDir, data => {
data.build.osx = {
background: customBackground,
icon: "foo.icns",
}
})
]),
packed: () => {
assertThat(platformPackager.effectiveDistOptions.background).isEqualTo(customBackground)
assertThat(platformPackager.effectiveDistOptions.icon).isEqualTo("foo.icns")
return BluebirdPromise.resolve(null)
},
})
})

test.ifOsx("custom background - new way", () => {
let platformPackager: CheckingMacPackager = null
const customBackground = "customBackground.png"
Expand All @@ -229,11 +205,6 @@ test.ifOsx("custom background - new way", () => {
background: customBackground,
icon: "foo.icns",
}

data.build.osx = {
background: null,
icon: "ignoreMe.icns",
}
})
]),
packed: async context => {
Expand Down

0 comments on commit aa05ac0

Please sign in to comment.