From f1eaab8bd410eb1b89f0e2ad7e81bb0ef97300fd Mon Sep 17 00:00:00 2001 From: develar Date: Sat, 11 Jun 2016 13:14:02 +0200 Subject: [PATCH] docs: Multiplatform Build Documentation is lacking Closes #412 --- README.md | 24 ++++++++++++++++++------ docs/Multi Platform Build.md | 11 ++++++++++- docs/Options.md | 5 ++++- package.json | 8 ++++---- src/builder.ts | 17 +++++++++-------- src/cliOptions.ts | 2 +- 6 files changed, 46 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index cc37e863fec..0c01a9dae4b 100755 --- a/README.md +++ b/README.md @@ -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`. @@ -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. diff --git a/docs/Multi Platform Build.md b/docs/Multi Platform Build.md index 0c205beea0e..0da48ac727d 100755 --- a/docs/Multi Platform Build.md +++ b/docs/Multi Platform Build.md @@ -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. diff --git a/docs/Options.md b/docs/Options.md index 3211603b49b..130ee0960d1 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -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${/*}`. \ No newline at end of file +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). \ No newline at end of file diff --git a/package.json b/package.json index 191d5b9da45..80fbaa056be 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/builder.ts b/src/builder.ts index db1f52b7c08..9be71416bb5 100644 --- a/src/builder.ts +++ b/src/builder.ts @@ -145,14 +145,15 @@ export function normalizeOptions(args: CliOptions): BuildOptions { delete result.platform delete result.arch - delete (result)["o"] - delete (result)["l"] - delete (result)["w"] - delete (result)["windows"] - delete (result)["$0"] - delete (result)["_"] - delete (result).version - delete (result).help + const r = 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 diff --git a/src/cliOptions.ts b/src/cliOptions.ts index e82d0995c03..2af13cd37b7 100644 --- a/src/cliOptions.ts +++ b/src/cliOptions.ts @@ -3,7 +3,6 @@ import yargs = require("yargs") export function createYargs(): any { return yargs - .version() .option("osx", { alias: "o", describe: "Build for OS X", @@ -42,5 +41,6 @@ export function createYargs(): any { }) .strict() .help() + .version() .epilog(`Project home: ${underline("https://github.com/electron-userland/electron-builder")}`) }