Skip to content

Commit

Permalink
feat(nsis): always add plugin dir to override nsis plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed Mar 9, 2017
1 parent e9acd2d commit e8d1d0d
Show file tree
Hide file tree
Showing 23 changed files with 5,817 additions and 1,098 deletions.
6,646 changes: 5,673 additions & 973 deletions docs/API.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ You can use [file macros](#file-macros) in the `from` and `to` fields as well.
| --- | ---
| appId | <a name="Config-appId"></a><p>The application id. Used as [CFBundleIdentifier](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-102070) for MacOS and as [Application User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx) for Windows (NSIS target only, Squirrel.Windows not supported).</p> <p>Defaults to <code>com.electron.${name}</code>. It is strongly recommended that an explicit ID be set.</p>
| copyright | <a name="Config-copyright"></a>The human-readable copyright line for the app. Defaults to `Copyright © year author`.
| iconUrl | <a name="Config-iconUrl"></a>* @deprecated
| productName | <a name="Config-productName"></a><p>As [name](#AppMetadata-name), but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the [name property](https://docs.npmjs.com/files/package.json#name}).</p>
| files | <a name="Config-files"></a><p>A [glob patterns](https://www.npmjs.com/package/glob#glob-primer) relative to the [app directory](#MetadataDirectories-app), which specifies which files to include when copying files to create the package.</p> <p>See [File Patterns](#multiple-glob-patterns).</p>
| extraResources | <a name="Config-extraResources"></a><p>A [glob patterns](https://www.npmjs.com/package/glob#glob-primer) relative to the project directory, when specified, copy the file or directory with matching names directly into the app’s resources directory (<code>Contents/Resources</code> for MacOS, <code>resources</code> for Linux/Windows).</p> <p>Glob rules the same as for [files](#multiple-glob-patterns).</p>
Expand All @@ -133,7 +134,7 @@ You can use [file macros](#file-macros) in the `from` and `to` fields as well.
| nodeGypRebuild | <a name="Config-nodeGypRebuild"></a>Whether to execute `node-gyp rebuild` before starting to package the app. Defaults to `false`.
| electronDist | <a name="Config-electronDist"></a>The path to custom Electron build (e.g. `~/electron/out/R`). Only macOS supported, file issue if need for Linux or Windows.
| electronDownload | <a name="Config-electronDownload"></a>The [electron-download](https://github.com/electron-userland/electron-download#usage) options.
| publish | <a name="Config-publish"></a><ul> <li>Array of option objects. Order is important — first item will be used as a default auto-update server on Windows (NSIS).</li> <li></li> <li>See [publish](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#PublishConfiguration).</li> </ul>
| publish | <a name="Config-publish"></a><ul> <li>Array of option objects. Order is important — first item will be used as a default auto-update server on Windows (NSIS).</li> <li>@see [Publish options](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#publish-options).</li> </ul>
| forceCodeSigning | <a name="Config-forceCodeSigning"></a>Whether to fail if application will be not signed (to prevent unsigned app if code signing configuration is not correct).
| electronVersion | <a name="Config-electronVersion"></a>The version of electron you are packaging for. Defaults to version of `electron`, `electron-prebuilt` or `electron-prebuilt-compile` dependency.
| artifactName | <a name="Config-artifactName"></a><p>The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to <code>${productName}-${version}.${ext}</code> (some target can have another defaults, see corresponding options).</p> <p>Currently supported only for <code>mas</code>, <code>pkg</code>, <code>dmg</code> and <code>nsis</code>.</p>
Expand Down
10 changes: 10 additions & 0 deletions jsdoc/scope.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{#if scope}}
**Kind**: {{#if (equal kind "event") ~}}
event emitted{{#if memberof}} by {{>link to=memberof}}{{/if}}
{{else~}}
{{#unless (equal scope "static") ~}}{{scope}} {{/unless}}{{#if virtual}}abstract {{/if}}{{kindInThisContext}}{{#if memberof}} of {{>link to=memberof}}{{/if}}
{{/if~}}
{{else~}}
{{#if isExported}}**Kind**: Exported {{kind}}
{{/if~}}
{{/if~}}
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"set-versions": "node test/out/helpers/setVersions.js",
"npm-publish": "yarn compile && ./packages/npm-publish.sh && conventional-changelog -p angular -i CHANGELOG.md -s",
"schema": "typescript-json-schema packages/electron-builder/tsconfig.json Config --out packages/electron-builder/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks",
"jsdoc": "ts2jsdoc packages/electron-updater packages/electron-builder-http",
"docs": "jsdoc2md --files 'jsdoc/out/**/*.js' --name-format --module-index-format grouped --separators --plugin dmd-tf > docs/API.md",
"api-docs": "node ./test/vendor/yarn.js docs && node ./test/vendor/yarn.js docs"
"jsdoc": "ts2jsdoc packages/electron-updater packages/electron-builder-http packages/electron-builder-util packages/electron-publish packages/electron-builder",
"docs": "jsdoc2md --files 'jsdoc/out/**/*.js' --name-format --module-index-format grouped --separators --partial jsdoc/scope.hbs > docs/API.md",
"api-docs": "node ./test/vendor/yarn.js jsdoc && node ./test/vendor/yarn.js docs"
},
"//": "repository must be specified otherwise conventional-changelog will use forked repo (currently cloned)",
"repository": "electron-userland/electron-builder",
Expand Down Expand Up @@ -79,7 +79,6 @@
"convert-source-map": "^1.4.0",
"decompress-zip": "^0.3.0",
"depcheck": "^0.6.7",
"dmd-tf": "^3.0.3",
"electron-download-tf": "4.0.0",
"jest-cli": "^19.0.2",
"jest-environment-node-debug": "^2.0.0",
Expand Down
34 changes: 33 additions & 1 deletion packages/electron-builder-core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,36 @@ export interface TargetSpecificOptions {
}

export const DEFAULT_TARGET = "default"
export const DIR_TARGET = "dir"
export const DIR_TARGET = "dir"

export interface AuthorMetadata {
readonly name: string
readonly email?: string
}

export type CompressionLevel = "store" | "normal" | "maximum"

export interface RepositoryInfo {
readonly url: string
}

export interface FilePattern {
from?: string
to?: string
filter?: Array<string> | string
}

export interface AsarOptions {
smartUnpack?: boolean

ordering?: string | null

extraMetadata?: any | null
}

export interface BeforeBuildContext {
readonly appDir: string
readonly electronVersion: string
readonly platform: Platform
readonly arch: string
}
1 change: 1 addition & 0 deletions packages/electron-builder-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"outDir": "out"
},
"jsdoc": "../../jsdoc/out/core",
"declaration": true,
"include": [
"src/**/*.ts"
Expand Down
92 changes: 46 additions & 46 deletions packages/electron-builder-http/src/publishOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,38 @@ export interface PublishConfiguration {
readonly token?: string | null
}

/**
* GitHub options.
*/
export interface GithubOptions extends PublishConfiguration {
/**
* The repository name. [Detected automatically](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#github-repository).
*/
readonly repo?: string | null

/**
* Whether to use `v`-prefixed tag name.
* @default true
*/
readonly vPrefixedTagName?: boolean

/**
* The host (including the port if need).
* @default github.com
*/
readonly host?: string | null

/**
* The protocol. GitHub Publisher supports only `https`.
* @default https
*/
readonly protocol?: "https" | "http" | null
}

export function githubUrl(options: GithubOptions) {
return `${options.protocol || "https"}://${options.host || "github.com"}`
}

/**
* Generic (any HTTP(S) server) options.
*/
Expand Down Expand Up @@ -85,52 +117,6 @@ export function s3Url(options: S3Options) {
return url
}

export interface VersionInfo {
readonly version: string
}

export interface UpdateInfo extends VersionInfo {
readonly path: string
readonly githubArtifactName?: string | null
readonly sha2: string

readonly releaseName?: string | null
readonly releaseNotes?: string | null
readonly releaseDate: string
}

/**
* GitHub options.
*/
export interface GithubOptions extends PublishConfiguration {
/**
* The repository name. [Detected automatically](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#github-repository).
*/
readonly repo?: string | null

/**
* Whether to use `v`-prefixed tag name.
* @default true
*/
readonly vPrefixedTagName?: boolean

/**
* The host (including the port if need).
* @default github.com
*/
readonly host?: string | null

/**
* The protocol. GitHub Publisher supports only `https`.
* @default https
*/
readonly protocol?: "https" | "http" | null
}

export function githubUrl(options: GithubOptions) {
return `${options.protocol || "https"}://${options.host || "github.com"}`
}

/**
* Bintray options.
*/
Expand All @@ -150,4 +136,18 @@ export interface BintrayOptions extends PublishConfiguration {
* The Bintray user account. Used in cases where the owner is an organization.
*/
readonly user?: string | null
}

export interface VersionInfo {
readonly version: string
}

export interface UpdateInfo extends VersionInfo {
readonly path: string
readonly githubArtifactName?: string | null
readonly sha2: string

readonly releaseName?: string | null
readonly releaseNotes?: string | null
readonly releaseDate: string
}
15 changes: 15 additions & 0 deletions packages/electron-builder-util/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,19 @@ export function replaceDefault(inList: Array<string> | null | undefined, default
inList = list
}
return inList
}

export function getPlatformIconFileName(value: string | null | undefined, isMac: boolean) {
if (value === undefined) {
return undefined
}
if (value === null) {
return null
}

if (!value.includes(".")) {
return `${value}.${isMac ? "icns" : "ico"}`
}

return value.replace(isMac ? ".ico" : ".icns", isMac ? ".icns" : ".ico")
}
1 change: 1 addition & 0 deletions packages/electron-builder-util/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"outDir": "out"
},
"declaration": true,
"jsdoc": "../../jsdoc/out/util",
"include": [
"src/**/*.ts"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/src/asarUtil.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import BluebirdPromise from "bluebird-lst"
import { AsarOptions } from "electron-builder-core"
import { debug } from "electron-builder-util"
import { deepAssign } from "electron-builder-util/out/deepAssign"
import { CONCURRENCY, FileCopier, Filter, MAX_FILE_REQUESTS, statOrNull, walk } from "electron-builder-util/out/fs"
import { log } from "electron-builder-util/out/log"
import { createReadStream, createWriteStream, ensureDir, readFile, readJson, readlink, stat, Stats, writeFile } from "fs-extra-p"
import * as path from "path"
import { AsarFilesystem, Node, readAsar } from "./asar"
import { AsarOptions } from "./metadata"

const isBinaryFile: any = BluebirdPromise.promisify(require("isbinaryfile"))
const pickle = require ("chromium-pickle-js")
Expand Down
10 changes: 5 additions & 5 deletions packages/electron-builder/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export { Packager } from "./packager"
export { Packager, BuildResult } from "./packager"
export { PackagerOptions, ArtifactCreated, BuildInfo, SourceRepositoryInfo } from "./packagerApi"
export { getArchSuffix, Platform, Arch, archFromString, Target, DIR_TARGET } from "electron-builder-core"
export { BuildOptions, build, CliOptions, createTargets } from "./builder"
export { Metadata, Config, CompressionLevel, FilePattern } from "./metadata"
export { MacOptions, DmgOptions, MasBuildOptions, MacOsTargetName, PkgOptions } from "./options/macOptions"
export { WinBuildOptions, NsisOptions, SquirrelWindowsOptions, AppXOptions } from "./options/winOptions"
export { LinuxBuildOptions, DebOptions } from "./options/linuxOptions"
export { Metadata, Config, AfterPackContext, Protocol, MetadataDirectories, FileAssociation, PlatformSpecificBuildOptions } from "./metadata"
export { MacOptions, DmgOptions, MasBuildOptions, MacOsTargetName, PkgOptions, DmgContent, DmgWindow } from "./options/macOptions"
export { WinBuildOptions, NsisOptions, SquirrelWindowsOptions, AppXOptions, NsisWebOptions } from "./options/winOptions"
export { LinuxBuildOptions, DebOptions, SnapOptions, AppImageOptions } from "./options/linuxOptions"
58 changes: 5 additions & 53 deletions packages/electron-builder/src/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
import { Arch, Platform, Target, TargetConfig, TargetSpecificOptions } from "electron-builder-core"
import { Arch, AsarOptions, AuthorMetadata, BeforeBuildContext, CompressionLevel, FilePattern, RepositoryInfo, Target, TargetConfig, TargetSpecificOptions } from "electron-builder-core"
import { Publish } from "electron-builder-http/out/publishOptions"
import { AppImageOptions, DebOptions, LinuxBuildOptions, SnapOptions } from "./options/linuxOptions"
import { DmgOptions, MacOptions, MasBuildOptions, PkgOptions } from "./options/macOptions"
import { AppXOptions, NsisOptions, SquirrelWindowsOptions, WinBuildOptions } from "./options/winOptions"
import { PlatformPackager } from "./platformPackager"

export interface AsarOptions {
dot?: boolean

smartUnpack?: boolean

ordering?: string | null

extraMetadata?: any | null
}

/**
## Fields in the package.json
Expand Down Expand Up @@ -59,23 +49,6 @@ export interface Metadata {
readonly build?: Config
}

export interface RepositoryInfo {
readonly url: string
}

export interface AuthorMetadata {
readonly name: string
readonly email?: string
}

export type CompressionLevel = "store" | "normal" | "maximum"

export interface FilePattern {
from?: string
to?: string
filter?: Array<string> | string
}

/**
## Configuration Options
*/
Expand All @@ -94,7 +67,9 @@ export interface Config extends PlatformSpecificBuildOptions, TargetSpecificOpti
*/
readonly copyright?: string | null

// deprecated
/**
* @deprecated
*/
readonly iconUrl?: string | null

/**
Expand Down Expand Up @@ -207,8 +182,7 @@ export interface Config extends PlatformSpecificBuildOptions, TargetSpecificOpti

/**
* Array of option objects. Order is important — first item will be used as a default auto-update server on Windows (NSIS).
*
* See [publish](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#publish-options).
* @see [Publish options](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts#publish-options).
*/
readonly publish?: Publish

Expand Down Expand Up @@ -246,13 +220,6 @@ export interface AfterPackContext {
readonly targets: Array<Target>
}

export interface BeforeBuildContext {
readonly appDir: string
readonly electronVersion: string
readonly platform: Platform
readonly arch: string
}

/**
### `fileAssociations` File Associations
Expand Down Expand Up @@ -352,19 +319,4 @@ export interface PlatformSpecificBuildOptions extends TargetSpecificOptions {
readonly fileAssociations?: Array<FileAssociation> | FileAssociation

readonly publish?: Publish
}

export function getPlatformIconFileName(value: string | null | undefined, isMac: boolean) {
if (value === undefined) {
return undefined
}
if (value === null) {
return null
}

if (!value.includes(".")) {
return `${value}.${isMac ? "icns" : "ico"}`
}

return value.replace(isMac ? ".ico" : ".icns", isMac ? ".icns" : ".ico")
}
3 changes: 3 additions & 0 deletions packages/electron-builder/src/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ function checkConflictingOptions(options: any) {
}
}

/**
* @private
*/
export async function checkWineVersion(checkPromise: Promise<string>) {
function wineError(prefix: string): string {
return `${prefix}, please see https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build#${(process.platform === "linux" ? "linux" : "macos")}`
Expand Down
3 changes: 1 addition & 2 deletions packages/electron-builder/src/packager/mac.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import BluebirdPromise from "bluebird-lst"
import { asArray, use } from "electron-builder-util"
import { asArray, getPlatformIconFileName, use } from "electron-builder-util"
import { copyFile, unlinkIfExists } from "electron-builder-util/out/fs"
import { warn } from "electron-builder-util/out/log"
import { copy, readFile, rename, unlink, utimes, writeFile } from "fs-extra-p"
import * as path from "path"
import { build as buildPlist, parse as parsePlist } from "plist"
import { getPlatformIconFileName } from "../metadata"
import { normalizeExt, PlatformPackager } from "../platformPackager"

function doRename(basePath: string, oldName: string, newName: string) {
Expand Down
Loading

0 comments on commit e8d1d0d

Please sign in to comment.