Skip to content

Commit

Permalink
docs: Multiplatform Build Documentation is lacking
Browse files Browse the repository at this point in the history
Closes #412
  • Loading branch information
develar committed Jun 11, 2016
1 parent 24f6045 commit f1eaab8
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 21 deletions.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Complete solution to package and build ready for distribution and "auto update"
* Development dependencies are never included. You don't need to ignore it explicitly.
* [Code Signing](https://github.com/electron-userland/electron-builder/wiki/Code-Signing) on a CI server or development machine.
* [Auto Update](#auto-update) ready application packaging.
* [Build version management](#build-version-management).
* [Build version management](https://github.com/electron-userland/electron-builder/wiki/Options#build-version-management).
* Numerous target formats:
* All platforms: `7z`, `zip`, `tar.xz`, `tar.lz`, `tar.gz`, `tar.bz2`.
* [OS X](https://github.com/electron-userland/electron-builder/wiki/Options#OsXBuildOptions-target): `dmg`, `mas`.
Expand Down Expand Up @@ -92,13 +92,25 @@ See the [Publishing Artifacts](https://github.com/electron-userland/electron-bui

For windows consider only [distributing 64-bit versions](https://github.com/electron-userland/electron-builder/issues/359#issuecomment-214851130).

# Build Version Management
`CFBundleVersion` (OS X) and `FileVersion` (Windows) will be set automatically to `version`.`build_number` on CI server (Travis, AppVeyor and CircleCI supported).

# CLI Usage
Execute `node_modules/.bin/build --help` to get actual CLI usage guide.
In most cases you should not explicitly pass flags, so, we don't want to promote it here ([npm lifecycle](https://docs.npmjs.com/misc/scripts#current-lifecycle-event) is supported and script name is taken in account).
Want more — please file issue.
```
--osx, -o Build for OS X [array]
--linux, -l Build for Linux [array]
--win, -w, --windows Build for Windows [array]
--x64 Build for x64 [boolean]
--ia32 Build for ia32 [boolean]
--publish, -p Publish artifacts (to GitHub Releases), see
https://goo.gl/WMlr4n
[choices: "onTag", "onTagOrDraft", "always", "never"]
--platform The target platform (preferred to use --osx, --win or
--linux)
[choices: "osx", "win", "linux", "darwin", "win32", "all"]
--arch The target arch (preferred to use --x64 or --ia32)
[choices: "ia32", "x64", "all"]
--help Show help [boolean]
--version Show version number [boolean]
```
# Programmatic Usage
See `node_modules/electron-builder/out/electron-builder.d.ts`. [Typings](https://github.com/Microsoft/TypeScript/wiki/Typings-for-npm-packages) is supported.
Expand Down
11 changes: 10 additions & 1 deletion docs/Multi Platform Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ Don't expect that you can build app for all platforms on one platform.
[prebuild](https://www.npmjs.com/package/prebuild) is a solution, but most node modules [don't provide](https://github.com/atom/node-keytar/issues/27) prebuilt binaries.

* OS Code Signing works only on OS X. [Cannot be fixed](http://stackoverflow.com/a/12156576).
* Windows Code Signing doesn't work on Linux. We are going to fix it soon.

Don't think that mentioned issues are major, you should use build servers — e.g. [AppVeyor](http://www.appveyor.com/) to build Windows app and [Travis](https://travis-ci.org) to build OS X/Linux apps.

See [sample appveyor.yml](https://github.com/develar/onshape-desktop-shell/blob/master/appveyor.yml) to build Electron app for Windows.
And [sample .travis.yml](https://github.com/develar/onshape-desktop-shell/blob/master/.travis.yml) to build Electron app for OS X.

By default build for current platform and current arch. Use CLI flags `--osx`, `--win`, `--linux` to specify platforms. And `--ia32`, `--x64` to specify arch.

For example, to build app for OS X, Windows and Linux:
```
npm run build -owl
```

Build performed in parallel, so, it is highly recommended to not use npm task per platform (e.g. `npm run dist:osx && npm run dist:win32`), but specify multiple platforms/targets in one build command.
You don't need to clean dist output before build — output directory is cleaned automatically.

## OS X

Use [brew](http://brew.sh) to install required packages.
Expand Down
5 changes: 4 additions & 1 deletion docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,7 @@ MAS (Mac Application Store) specific options (in addition to `build.osx`).
## Excluding directories

Remember that `!doNotCopyMe/**/*` would match the files *in* the `doNotCopyMe` directory, but not the directory itself, so the [empty directory](https://github.com/gulpjs/gulp/issues/165#issuecomment-32613179) would be created.
Solution — use macro `${/*}`, e.g. `!doNotCopyMe${/*}`.
Solution — use macro `${/*}`, e.g. `!doNotCopyMe${/*}`.
# Build Version Management
`CFBundleVersion` (OS X) and `FileVersion` (Windows) will be set automatically to `version`.`build_number` on CI server (Travis, AppVeyor and CircleCI supported).
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@
"json8": "^0.9.0",
"path-sort": "^0.1.0",
"plist": "^1.2.0",
"pre-git": "^3.8.4",
"pre-git": "^3.9.0",
"semantic-release": "^6.3.0",
"should": "^9.0.0",
"should": "^9.0.2",
"ts-babel": "^1.0.2",
"tsconfig-glob": "^0.4.3",
"tslint": "3.10.0-dev.2",
"typescript": "1.9.0-dev.20160607-1.0",
"tslint": "3.11.0-dev.0",
"typescript": "^1.9.0-dev.20160611-1.0",
"whitespace": "^2.0.0"
},
"babel": {
Expand Down
17 changes: 9 additions & 8 deletions src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,15 @@ export function normalizeOptions(args: CliOptions): BuildOptions {
delete result.platform
delete result.arch

delete (<any>result)["o"]
delete (<any>result)["l"]
delete (<any>result)["w"]
delete (<any>result)["windows"]
delete (<any>result)["$0"]
delete (<any>result)["_"]
delete (<any>result).version
delete (<any>result).help
const r = <any>result
delete r.o
delete r.l
delete r.w
delete r.windows
delete r["$0"]
delete r._
delete r.version
delete r.help

delete result.ia32
delete result.x64
Expand Down
2 changes: 1 addition & 1 deletion src/cliOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import yargs = require("yargs")

export function createYargs(): any {
return yargs
.version()
.option("osx", {
alias: "o",
describe: "Build for OS X",
Expand Down Expand Up @@ -42,5 +41,6 @@ export function createYargs(): any {
})
.strict()
.help()
.version()
.epilog(`Project home: ${underline("https://github.com/electron-userland/electron-builder")}`)
}

0 comments on commit f1eaab8

Please sign in to comment.