-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
--dist
by default and remove this flag in favour of `--target…
…=dir #413 BREAKING CHANGE: `appDir` CLI is removed — use [directories.app](https://github.com/electron-userland/electron-builder/wiki/Options#MetadataDirectories-app) in the development package.json. `sign` CLI is removed — use [build.osx.identity](https://github.com/electron-userland/electron-builder/wiki/Options#OsXBuildOptions-identity) in the development package.json.
- Loading branch information
Showing
21 changed files
with
308 additions
and
184 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,97 @@ | ||
#! /usr/bin/env node | ||
|
||
import { PackagerOptions } from "./platformPackager" | ||
import { PackagerOptions, commonTargets } from "./platformPackager" | ||
import { normalizePlatforms } from "./packager" | ||
import { build } from "./builder" | ||
import { PublishOptions } from "./gitHubPublisher" | ||
import { printErrorAndExit } from "./promise" | ||
import cla = require("command-line-args") | ||
import { readFileSync } from "fs" | ||
import * as path from "path" | ||
import { warn } from "./util" | ||
import yargs = require("yargs") | ||
import { underline } from "chalk" | ||
import { Platform } from "./metadata" | ||
|
||
//noinspection JSUnusedLocalSymbols | ||
const __awaiter = require("./awaiter") | ||
|
||
interface CliOptions extends PackagerOptions, PublishOptions { | ||
help: boolean | ||
osx?: Array<string> | ||
linux?: Array<string> | ||
win?: Array<string> | ||
|
||
arch?: string | ||
|
||
x64?: boolean | ||
ia32?: boolean | ||
} | ||
|
||
const args = <CliOptions>(yargs | ||
.version() | ||
.option("osx", { | ||
alias: "o", | ||
describe: "Build for OS X", | ||
type: "array", | ||
}) | ||
.option("linux", { | ||
alias: "l", | ||
describe: "Build for Linux", | ||
type: "array", | ||
}) | ||
.option("win", { | ||
alias: ["w", "windows"], | ||
describe: "Build for Windows", | ||
type: "array", | ||
}) | ||
.option("x64", { | ||
describe: "Build for x64", | ||
type: "boolean", | ||
}) | ||
.option("ia32", { | ||
describe: "Build for ia32", | ||
type: "boolean", | ||
}) | ||
.option("target", { | ||
alias: "t", | ||
describe: "Target package types", | ||
choices: commonTargets, | ||
}) | ||
.option("publish", { | ||
alias: "p", | ||
describe: `Publish artifacts (to GitHub Releases), see ${underline("https://goo.gl/WMlr4n")}`, | ||
choices: ["onTag", "onTagOrDraft", "always", "never"], | ||
}) | ||
.option("platform", { | ||
choices: ["osx", "win", "linux", "darwin", "win32", "all"], | ||
}) | ||
.option("arch", { | ||
choices: ["ia32", "x64", "all"], | ||
}) | ||
.strict() | ||
.help() | ||
.epilog(`Project home: ${underline("https://github.com/electron-userland/electron-builder")}`) | ||
.argv) | ||
|
||
const platforms = normalizePlatforms(args.platform) | ||
if (args.osx != null && !platforms.includes(Platform.OSX)) { | ||
platforms.push(Platform.OSX) | ||
} | ||
if (args.linux != null && !platforms.includes(Platform.LINUX)) { | ||
platforms.push(Platform.LINUX) | ||
} | ||
if (args.win != null && !platforms.includes(Platform.WINDOWS)) { | ||
platforms.push(Platform.WINDOWS) | ||
} | ||
|
||
const archAsProp = args.arch | ||
const archs = archAsProp === "all" ? ["ia32", "x64"] : (archAsProp == null ? [] : [archAsProp]) | ||
|
||
const cli = cla([ | ||
{name: "dist", type: Boolean, alias: "d", description: "Whether to package in a distributable format (e.g. DMG, windows installer, NuGet package)."}, | ||
{name: "publish", type: String, alias: "p", description: "Publish artifacts (to GitHub Releases): onTag (on tag push only) or onTagOrDraft (on tag push or if draft release exists)."}, | ||
{name: "platform", type: String, multiple: true, description: "darwin, linux, win32 or all. Current platform (" + process.platform + ") by default."}, | ||
{name: "arch", type: String, description: "ia32, x64 or all. Defaults to architecture you're running on."}, | ||
{name: "sign", type: String}, | ||
{name: "help", alias: "h", type: Boolean, description: "Display this usage guide."}, | ||
{name: "appDir", type: String} | ||
]) | ||
|
||
const args: CliOptions = cli.parse() | ||
|
||
if (args.help) { | ||
const version = process.env.npm_package_version || JSON.parse(readFileSync(path.join(__dirname, "..", "package.json"), "utf8")).version | ||
console.log(cli.getUsage({ | ||
title: "electron-builder " + version, | ||
footer: "Project home: [underline]{https://github.com/electron-userland/electron-builder}", | ||
hide: ["appDir"], | ||
})) | ||
if (args.x64 && !archs.includes("x64")) { | ||
archs.push("x64") | ||
} | ||
else { | ||
if (args.appDir) { | ||
warn(`-appDir CLI parameter is deprecated, please configure build.directories.app instead | ||
See https://github.com/electron-userland/electron-builder/wiki/Options#MetadataDirectories-app`) | ||
} | ||
|
||
build(args) | ||
.catch(printErrorAndExit) | ||
} | ||
if (args.ia32 && !archs.includes("ia32")) { | ||
archs.push("ia32") | ||
} | ||
|
||
build(Object.assign({}, args, { | ||
platform: platforms, | ||
arch: archs, | ||
})) | ||
.catch(printErrorAndExit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export { Packager } from "./packager" | ||
export { PackagerOptions, ArtifactCreated } from "./platformPackager" | ||
export { PackagerOptions, ArtifactCreated, DIR_TARGET } from "./platformPackager" | ||
export { BuildOptions, build, createPublisher } from "./builder" | ||
export { PublishOptions, Publisher } from "./gitHubPublisher" | ||
export { AppMetadata, DevMetadata, Platform, getProductName, BuildMetadata, OsXBuildOptions, WinBuildOptions, LinuxBuildOptions } from "./metadata" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.