diff --git a/.travis.yml b/.travis.yml
index 7f6af34ed6b..1965ac61742 100755
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,6 +17,7 @@ cache:
directories:
- node_modules
- $HOME/.electron
+ - "test/fixtures/app-executable-deps/app/node_modules"
before_install:
- curl -L https://dl.bintray.com/develar/bin/7za -o /tmp/7za
@@ -32,6 +33,7 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "osx" && "$NODE_VERSION" == "4" ]]; then npm install npm -g ; fi
- npm install
- npm prune
+- (cd test/fixtures/app-executable-deps/app && npm install && npm prune)
script:
- sudo ntpdate -u time.apple.com
diff --git a/README.md b/README.md
index 9a0478dafbb..21e6e34f7bd 100755
--- a/README.md
+++ b/README.md
@@ -97,15 +97,16 @@ For windows consider only [distributing 64-bit versions](https://github.com/elec
Execute `node_modules/.bin/build --help` to get actual CLI usage guide.
```
Building:
- --mac, -m, -o, --osx Build for MacOS, accepts target list (see
- https://goo.gl/HAnnq8). [array]
- --linux, -l Build for Linux, accepts target list (see
- https://goo.gl/O80IL2) [array]
- --win, -w, --windows Build for Windows, accepts target list (see
- https://goo.gl/dL4i8i) [array]
- --x64 Build for x64 [boolean]
- --ia32 Build for ia32 [boolean]
- --dir Build unpacked dir. Useful to test. [boolean]
+ --mac, -m, -o, --osx, --macos Build for MacOS, accepts target list (see
+ https://goo.gl/HAnnq8). [array]
+ --linux, -l Build for Linux, accepts target list (see
+ https://goo.gl/O80IL2) [array]
+ --win, -w, --windows Build for Windows, accepts target list (see
+ https://goo.gl/dL4i8i) [array]
+ --x64 Build for x64 [boolean]
+ --ia32 Build for ia32 [boolean]
+ --dir Build unpacked dir. Useful to test. [boolean]
+ --extraMetadata, --em Inject properties to application package.json
Publishing:
--publish, -p Publish artifacts (to GitHub Releases), see
@@ -128,6 +129,7 @@ Examples:
build -mwl build for MacOS, Windows and Linux
build --linux deb tar.xz build deb and tar.xz for Linux
build --win --ia32 build for Windows ia32
+ build --em.foo=bar set application package.json property `foo` to `bar`
```
# Programmatic Usage
diff --git a/docs/Options.md b/docs/Options.md
index 778cc5ec99d..60e5fb567b7 100644
--- a/docs/Options.md
+++ b/docs/Options.md
@@ -52,7 +52,7 @@ Here documented only `electron-builder` specific options:
| --- | ---
| appId |
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.
For windows only NSIS target supports it. Squirrel.Windows is not fixed yet.
Defaults to com.electron.${name}
. It is strongly recommended that an explicit ID be set.
| app-category-type | *macOS-only.* The application category type, as shown in the Finder via *View -> Arrange by Application Category* when viewing the Applications directory.
For example, app-category-type=public.app-category.developer-tools
will set the application category to *Developer Tools*.
Valid values are listed in [Apple’s documentation](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW8).
-| asar | Whether to package the application’s source code into an archive, using [Electron’s archive format](https://github.com/electron/asar). Defaults to true
. Reasons why you may want to disable this feature are described in [an application packaging tutorial in Electron’s documentation](http://electron.atom.io/docs/latest/tutorial/application-packaging/#limitations-on-node-api/).
Or you can pass object of any asar options.
+| asar | Whether to package the application’s source code into an archive, using [Electron’s archive format](https://github.com/electron/asar). Defaults to true
. Reasons why you may want to disable this feature are described in [an application packaging tutorial in Electron’s documentation](http://electron.atom.io/docs/latest/tutorial/application-packaging/#limitations-on-node-api/).
Or you can pass object of any asar options.
electron-builder detects node modules that must be unpacked automatically, you don’t need to explicitly set asar.unpackDir
- please file issue if this doesn’t work.
| productName | See [AppMetadata.productName](#AppMetadata-productName).
| files | 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. Defaults to **\/\*
(i.e. [hidden files are ignored by default](https://www.npmjs.com/package/glob#dots)).
Development dependencies are never copied in any case. You don’t need to ignore it explicitly.
[Multiple patterns](#multiple-glob-patterns) are supported. You can use ${os}
(expanded to mac, linux or win according to current platform) and ${arch}
in the pattern. If directory matched, all contents are copied. So, you can just specify foo
to copy foo
directory.
Remember that default pattern \*\*\/\*
is not added to your custom, so, you have to add it explicitly — e.g. ["\*\*\/\*", "!ignoreMe${/\*}"]
.
May be specified in the platform options (e.g. in the build.mac
).
| extraResources | 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 (Contents/Resources
for MacOS, resources
for Linux/Windows).
Glob rules the same as for [files](#BuildMetadata-files).
diff --git a/package.json b/package.json
index e16102cdb78..325a3bab425 100644
--- a/package.json
+++ b/package.json
@@ -65,6 +65,7 @@
"chalk": "^1.1.3",
"chromium-pickle-js": "^0.1.0",
"cli-cursor": "^1.0.2",
+ "cuint": "^0.2.1",
"debug": "^2.2.0",
"electron-download": "^2.1.2",
"electron-osx-sign": "^0.4.0-beta4",
@@ -105,13 +106,13 @@
]
},
"devDependencies": {
- "@develar/semantic-release": "^6.3.1",
+ "@develar/semantic-release": "^6.3.2",
"@types/debug": "0.0.28",
"@types/mime": "0.0.28",
"@types/progress": "^1.1.27",
"@types/semver": "^4.3.26",
"@types/source-map-support": "^0.2.27",
- "ava-tf": "^0.15.3",
+ "ava-tf": "^0.15.4",
"babel-plugin-array-includes": "^2.0.3",
"babel-plugin-transform-es2015-destructuring": "^6.9.0",
"babel-plugin-transform-es2015-parameters": "^6.11.4",
diff --git a/src/asarUtil.ts b/src/asarUtil.ts
index 4ae2460218a..8a9a78975da 100644
--- a/src/asarUtil.ts
+++ b/src/asarUtil.ts
@@ -1,6 +1,9 @@
import { AsarFileInfo, listPackage, statFile, AsarOptions } from "asar-electron-builder"
import { statOrNull, debug } from "./util/util"
-import { lstat, readdir, readFile, Stats, createWriteStream, ensureDir, createReadStream, readJson } from "fs-extra-p"
+import {
+ lstat, readdir, readFile, Stats, createWriteStream, ensureDir, createReadStream, readJson,
+ writeFile
+} from "fs-extra-p"
import { Promise as BluebirdPromise } from "bluebird"
import * as path from "path"
import pathSorter = require("path-sort")
@@ -10,6 +13,7 @@ import { Minimatch } from "minimatch"
const isBinaryFile: any = BluebirdPromise.promisify(require("isbinaryfile"))
const pickle = require ("chromium-pickle-js")
const Filesystem = require("asar-electron-builder/lib/filesystem")
+const UINT64 = require("cuint").UINT64
//noinspection JSUnusedLocalSymbols
const __awaiter = require("./util/awaiter")
@@ -123,10 +127,11 @@ async function order(src: string, filenames: Array, options: any) {
return filenamesSorted
}
-async function detectUnpackedDirs(src: string, files: Array, metadata: Map, autoUnpackDirs: Set, createDirPromises: Array>, unpackedDest: string, packageFileToData: Map>) {
+async function detectUnpackedDirs(src: string, files: Array, metadata: Map, autoUnpackDirs: Set, createDirPromises: Array>, unpackedDest: string, fileIndexToModulePackageData: Array>) {
const packageJsonStringLength = "package.json".length
const readPackageJsonPromises: Array> = []
- for (let file of files) {
+ for (let i = 0, n = files.length; i < n; i++) {
+ const file = files[i]
const index = file.lastIndexOf(NODE_MODULES_PATTERN)
if (index < 0) {
continue
@@ -151,7 +156,7 @@ async function detectUnpackedDirs(src: string, files: Array, metadata: M
readPackageJsonPromises.length = 0
}
readPackageJsonPromises.push(promise)
- packageFileToData.set(file, promise)
+ fileIndexToModulePackageData[i] = promise
}
if (autoUnpackDirs.has(nodeModuleDir)) {
@@ -200,7 +205,7 @@ async function detectUnpackedDirs(src: string, files: Array, metadata: M
}
}
-async function createPackageFromFiles(src: string, dest: string, files: Array, metadata: Map, options: any) {
+async function createPackageFromFiles(src: string, dest: string, files: Array, metadata: Map, options: AsarOptions) {
// search auto unpacked dir
const autoUnpackDirs = new Set()
@@ -208,9 +213,9 @@ async function createPackageFromFiles(src: string, dest: string, files: Array()
- const packageFileToData = new Map>()
+ const fileIndexToModulePackageData: Array> = new Array(files.length)
if (options.smartUnpack !== false) {
- await detectUnpackedDirs(src, files, metadata, autoUnpackDirs, createDirPromises, unpackedDest, packageFileToData)
+ await detectUnpackedDirs(src, files, metadata, autoUnpackDirs, createDirPromises, unpackedDest, fileIndexToModulePackageData)
}
const unpackDir = options.unpackDir == null ? null : new Minimatch(options.unpackDir)
@@ -221,46 +226,67 @@ async function createPackageFromFiles(src: string, dest: string, files: Array = []
const filesystem = new Filesystem(src)
const copyPromises: Array> = []
- for (let file of files) {
+ const mainPackageJson = path.join(src, "package.json")
+ for (let i = 0, n = files.length; i < n; i++) {
+ const file = files[i]
const stat = metadata.get(file)!
if (stat.isFile()) {
- const dir = path.dirname(file)
+ const fileParent = path.dirname(file)
+ const dirNode = filesystem.searchNodeFromPath(fileParent)
- let shouldUnpack = unpack != null && unpack.match(file)
- if (shouldUnpack) {
- const fileParent = path.dirname(file)
- if (!autoUnpackDirs.has(fileParent)) {
- // create parent dir to be able to copy file later without directory existence check
- createDirPromises.push(ensureDir(path.join(unpackedDest, path.relative(src, fileParent))))
+ if (dirNode.unpacked && createDirPromises.length > 0) {
+ await BluebirdPromise.all(createDirPromises)
+ createDirPromises.length = 0
+ }
+
+ const packageDataPromise = fileIndexToModulePackageData[i]
+ let newData: any | null = null
+ if (packageDataPromise == null) {
+ if (options.extraMetadata != null && file === mainPackageJson) {
+ newData = JSON.stringify(Object.assign(await readJson(file), options.extraMetadata), null, 2)
}
}
else {
- shouldUnpack = autoUnpackDirs.has(dir) || (unpackDir != null && isUnpackDir(path.relative(src, dir), unpackDir, options.unpackDir))
+ newData = cleanupPackageJson(packageDataPromise.value())
}
- if (shouldUnpack) {
- if (createDirPromises.length > 0) {
+ const fileSize = newData == null ? stat.size : Buffer.byteLength(newData)
+ const node = filesystem.searchNodeFromPath(file)
+ node.size = fileSize
+ if (dirNode.unpacked || (unpack != null && unpack.match(file))) {
+ node.unpacked = true
+
+ if (!dirNode.unpacked) {
+ createDirPromises.push(ensureDir(path.join(unpackedDest, path.relative(src, fileParent))))
await BluebirdPromise.all(createDirPromises)
createDirPromises.length = 0
}
- copyPromises.push(copyFile(file, path.join(unpackedDest, path.relative(src, file)), stat))
- // limit concurrency
+ const unpackedFile = path.join(unpackedDest, path.relative(src, file))
+ copyPromises.push(newData == null ? copyFile(file, unpackedFile, stat) : writeFile(unpackedFile, newData))
if (copyPromises.length > MAX_FILE_REQUESTS) {
await BluebirdPromise.all(copyPromises)
copyPromises.length = 0
}
}
else {
- toPack.push(file)
- }
+ if (newData != null) {
+ changedFiles.set(file, newData)
+ }
+
+ if (fileSize > 4294967295) {
+ throw new Error(`${file}: file size can not be larger than 4.2GB`)
+ }
- const packageDataPromise = packageFileToData.get(file)
- if (packageDataPromise != null) {
- cleanupPackageJson(file, stat, packageDataPromise.value(), changedFiles)
+ node.offset = filesystem.offset.toString()
+ //noinspection JSBitwiseOperatorUsage
+ if (process.platform !== "win32" && stat.mode & 0x40) {
+ node.executable = true
+ }
+ toPack.push(file)
}
- filesystem.insertFile(file, shouldUnpack, stat)
+ filesystem.offset.add(UINT64(fileSize))
}
else if (stat.isDirectory()) {
let unpacked = false
@@ -268,7 +294,7 @@ async function createPackageFromFiles(src: string, dest: string, files: Array) {
+function cleanupPackageJson(data: any): any {
try {
- let writeFile = false
+ let changed = false
for (let prop of Object.getOwnPropertyNames(data)) {
if (prop[0] === "_" || prop === "dist" || prop === "gitHead" || prop === "keywords") {
delete data[prop]
- writeFile = true
+ changed = true
}
}
- if (writeFile) {
- const value = JSON.stringify(data, null, 2)
- changedFiles.set(file, value)
- stat.size = Buffer.byteLength(value)
+ if (changed) {
+ return JSON.stringify(data, null, 2)
}
}
catch (e) {
debug(e)
}
+
+ return null
}
function writeAsarFile(filesystem: any, dest: string, toPack: Array, changedFiles: Map): Promise {
diff --git a/src/builder.ts b/src/builder.ts
index 9f40f3287ca..cc0d45ffd32 100644
--- a/src/builder.ts
+++ b/src/builder.ts
@@ -159,6 +159,8 @@ export function normalizeOptions(args: CliOptions): BuildOptions {
delete result.arch
const r = result
+ delete r.em
+
delete r.m
delete r.o
delete r.l
diff --git a/src/cliOptions.ts b/src/cliOptions.ts
index 706171cb9e8..9b57b0743b4 100644
--- a/src/cliOptions.ts
+++ b/src/cliOptions.ts
@@ -6,10 +6,12 @@ const buildGroup = "Building:"
const deprecated = "Deprecated:"
export function createYargs(): any {
+ //noinspection ReservedWordAsName
return yargs
.example("build -mwl", "build for MacOS, Windows and Linux")
.example("build --linux deb tar.xz", "build deb and tar.xz for Linux")
.example("build --win --ia32", "build for Windows ia32")
+ .example("build --em.foo=bar", "set application package.json property `foo` to `bar`")
.option("mac", {
group: buildGroup,
alias: ["m", "o", "osx", "macos"],
@@ -71,6 +73,11 @@ export function createYargs(): any {
describe: "The target arch (preferred to use --x64 or --ia32)",
choices: ["ia32", "x64", "all"],
})
+ .option("extraMetadata", {
+ alias: ["em",],
+ group: buildGroup,
+ describe: "Inject properties to application package.json (asar only)",
+ })
.strict()
.group(["help", "version"], "Other:")
.help()
diff --git a/src/metadata.ts b/src/metadata.ts
index f2836a3cbb9..a6b3c93c556 100755
--- a/src/metadata.ts
+++ b/src/metadata.ts
@@ -108,6 +108,8 @@ export interface BuildMetadata {
Reasons why you may want to disable this feature are described in [an application packaging tutorial in Electron's documentation](http://electron.atom.io/docs/latest/tutorial/application-packaging/#limitations-on-node-api/).
Or you can pass object of any asar options.
+
+ electron-builder detects node modules that must be unpacked automatically, you don't need to explicitly set `asar.unpackDir` - please file issue if this doesn't work.
*/
readonly asar?: AsarOptions | boolean | null
diff --git a/src/platformPackager.ts b/src/platformPackager.ts
index f2586b88f4a..aa28d245da5 100644
--- a/src/platformPackager.ts
+++ b/src/platformPackager.ts
@@ -46,6 +46,8 @@ export interface PackagerOptions {
readonly appMetadata?: AppMetadata
readonly effectiveOptionComputed?: (options: any) => boolean
+
+ readonly extraMetadata?: any
}
export interface BuildInfo {
@@ -301,8 +303,8 @@ export abstract class PlatformPackager
}
}
- return deepAssign(result, {
-
+ return Object.assign(result, {
+ extraMetadata: this.options.extraMetadata
})
}
diff --git a/test/fixtures/app-executable-deps/app/package.json b/test/fixtures/app-executable-deps/app/package.json
index fa12bdcbfed..161af9fb0b9 100644
--- a/test/fixtures/app-executable-deps/app/package.json
+++ b/test/fixtures/app-executable-deps/app/package.json
@@ -3,7 +3,7 @@
"version": "1.1.0",
"description": "app executable deps",
"main": "main.js",
- "author": "Foo",
+ "author": "Foo ",
"dependencies": {
"keytar": "^3.0.2",
"node-notifier": "^4.6.0"
diff --git a/test/fixtures/app-executable-deps/package.json b/test/fixtures/app-executable-deps/package.json
index 7406f9d76dc..454ea12d9f8 100644
--- a/test/fixtures/app-executable-deps/package.json
+++ b/test/fixtures/app-executable-deps/package.json
@@ -1,12 +1,9 @@
{
"devDependencies": {
- "electron-builder": "^5.17.0",
+ "electron-builder": "next",
"electron-prebuilt": "^1.3.1"
},
"build": {
- "app-category-type": "public.app-category.business",
- "win": {
- "target": "nsis"
- }
+ "app-category-type": "public.app-category.business"
}
}
diff --git a/test/fixtures/test-app-one/package.json b/test/fixtures/test-app-one/package.json
index 169669d16f5..7a1a326c52c 100755
--- a/test/fixtures/test-app-one/package.json
+++ b/test/fixtures/test-app-one/package.json
@@ -8,7 +8,7 @@
"author": "Foo Bar ",
"license": "MIT",
"build": {
- "electronVersion": "1.2.6",
+ "electronVersion": "1.3.1",
"appId": "org.electron-builder.testApp",
"app-category-type": "your.app.category.type",
"iconUrl": "https://raw.githubusercontent.com/szwacz/electron-boilerplate/master/resources/windows/icon.ico",
diff --git a/test/fixtures/test-app/package.json b/test/fixtures/test-app/package.json
index 2c7ee6fb94a..c8be6a4b391 100755
--- a/test/fixtures/test-app/package.json
+++ b/test/fixtures/test-app/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"build": {
- "electronVersion": "1.2.6",
+ "electronVersion": "1.3.1",
"appId": "org.electron-builder.testApp",
"app-category-type": "your.app.category.type",
"iconUrl": "https://raw.githubusercontent.com/szwacz/electron-boilerplate/master/resources/windows/icon.ico",
diff --git a/test/src/BuildTest.ts b/test/src/BuildTest.ts
index 99b3226013b..ce0b47f14f2 100755
--- a/test/src/BuildTest.ts
+++ b/test/src/BuildTest.ts
@@ -1,12 +1,13 @@
import test from "./helpers/avaEx"
import { assertPack, modifyPackageJson, platform, getPossiblePlatforms, currentPlatform } from "./helpers/packTester"
-import { move, outputJson } from "fs-extra-p"
+import { move, outputJson, readJson } from "fs-extra-p"
import { Promise as BluebirdPromise } from "bluebird"
import * as path from "path"
import { assertThat } from "./helpers/fileAssert"
-import { archFromString, BuildOptions, Platform, Arch, PackagerOptions, DIR_TARGET, createTargets, PublishOptions } from "out"
+import { archFromString, BuildOptions, Platform, Arch, PackagerOptions, DIR_TARGET, createTargets } from "out"
import { normalizeOptions } from "out/builder"
import { createYargs } from "out/cliOptions"
+import { extractFile } from "asar-electron-builder"
//noinspection JSUnusedLocalSymbols
const __awaiter = require("out/util/awaiter")
@@ -14,14 +15,13 @@ const __awaiter = require("out/util/awaiter")
test("cli", () => {
const yargs = createYargs()
- const base: PublishOptions = {
- publish: undefined,
- draft: undefined,
- prerelease: undefined,
- }
-
- function expected(opt: PackagerOptions): any {
- return Object.assign(base, opt)
+ function expected(opt: BuildOptions): any {
+ return Object.assign({
+ publish: undefined,
+ draft: undefined,
+ prerelease: undefined,
+ extraMetadata: undefined,
+ }, opt)
}
function parse(input: string): BuildOptions {
@@ -50,6 +50,15 @@ test("cli", () => {
assertThat(parse("-l tar.gz:x64")).isEqualTo(expected({targets: Platform.LINUX.createTarget("tar.gz", Arch.x64)}))
assertThat(parse("-l tar.gz")).isEqualTo(expected({targets: Platform.LINUX.createTarget("tar.gz", archFromString(process.arch))}))
assertThat(parse("-w tar.gz:x64")).isEqualTo(expected({targets: Platform.WINDOWS.createTarget("tar.gz", Arch.x64)}))
+
+ function parseExtraMetadata(input: string) {
+ const result = parse(input)
+ delete result.targets
+ return result
+ }
+ assertThat(parseExtraMetadata("--em.foo=bar")).isEqualTo(expected({extraMetadata: {
+ foo: "bar",
+ }}))
})
test("custom buildResources dir", () => assertPack("test-app-one", allPlatforms(), {
@@ -139,7 +148,7 @@ test("relative index", () => assertPack("test-app", allPlatforms(false), {
}, true)
}))
-const electronVersion = "1.2.6"
+const electronVersion = "1.3.1"
test.ifNotWindows("electron version from electron-prebuilt dependency", () => assertPack("test-app-one", {
targets: Platform.LINUX.createTarget(DIR_TARGET),
@@ -168,7 +177,7 @@ test("www as default dir", () => assertPack("test-app", currentPlatform(), {
}))
test("afterPack", t => {
- const targets = process.env.CI ? Platform.fromString(process.platform).createTarget(DIR_TARGET) : getPossiblePlatforms()
+ const targets = process.env.CI ? Platform.fromString(process.platform).createTarget(DIR_TARGET) : getPossiblePlatforms(DIR_TARGET)
let called = 0
return assertPack("test-app-one", {
targets: targets,
@@ -188,6 +197,34 @@ test("afterPack", t => {
})
})
+test.ifDevOrLinuxCi("extra metadata", () => {
+ const extraMetadata = {foo: "bar"}
+ return assertPack("test-app-one", {
+ targets: Platform.LINUX.createTarget(DIR_TARGET),
+ extraMetadata: extraMetadata,
+ }, {
+ packed: projectDir => {
+ assertThat(JSON.parse(extractFile(path.join(projectDir, "dist", "linux", "resources", "app.asar"), "package.json").toString())).hasProperties(extraMetadata)
+ return BluebirdPromise.resolve()
+ }
+ })
+})
+
+test.ifOsx("app-executable-deps", () => {
+ return assertPack("app-executable-deps", {
+ targets: Platform.current().createTarget(DIR_TARGET),
+ }, {
+ packed: async (projectDir) => {
+ const data = await readJson(path.join(projectDir, "dist/mac/app-executable-deps.app/Contents/Resources/app.asar.unpacked", "node_modules", "node-notifier", "package.json"))
+ for (let name of Object.getOwnPropertyNames(data)) {
+ if (name[0] === "_") {
+ throw new Error("Property name starts with _")
+ }
+ }
+ }
+ })
+})
+
test.ifWinCi("Build MacOS on Windows is not supported", (t: any) => t.throws(assertPack("test-app-one", platform(Platform.MAC)), /Build for MacOS is supported only on MacOS.+/))
function allPlatforms(dist: boolean = true): PackagerOptions {
diff --git a/test/src/helpers/expectedContents.ts b/test/src/helpers/expectedContents.ts
index 2f76e4ab3ae..b499f00c203 100755
--- a/test/src/helpers/expectedContents.ts
+++ b/test/src/helpers/expectedContents.ts
@@ -55,6 +55,7 @@ export const expectedLinuxContents = [
//noinspection SpellCheckingInspection
export const expectedWinContents = [
+ "lib/net45/blink_image_resources_200_percent.pak",
"lib/net45/content_resources_200_percent.pak",
"lib/net45/content_shell.pak",
"lib/net45/d3dcompiler_47.dll",
@@ -70,6 +71,7 @@ export const expectedWinContents = [
"lib/net45/TestApp.exe",
"lib/net45/ui_resources_200_percent.pak",
"lib/net45/Update.exe",
+ "lib/net45/views_resources_200_percent.pak",
"lib/net45/xinput1_3.dll",
"lib/net45/locales/en-US.pak",
"lib/net45/resources/app.asar",
diff --git a/test/src/helpers/fileAssert.ts b/test/src/helpers/fileAssert.ts
index 686a0e6c175..d353b878684 100644
--- a/test/src/helpers/fileAssert.ts
+++ b/test/src/helpers/fileAssert.ts
@@ -13,6 +13,7 @@ export function assertThat(actual: any): Assertions {
return new Assertions(actual)
}
+//noinspection JSUnusedLocalSymbols
function jsonReplacer(key: any, value: any): any {
if (value instanceof Map) {
return [...value]
@@ -32,6 +33,16 @@ class Assertions {
compare(this.actual.slice().sort(), Array.from(expected).slice().sort())
}
+ hasProperties(expected: any) {
+ const actual = Object.create(null)
+ for (let name of Object.getOwnPropertyNames(this.actual)) {
+ if (name in expected) {
+ actual[name] = this.actual[name]
+ }
+ }
+ compare(actual, expected)
+ }
+
isAbsolute() {
if (!path.isAbsolute(this.actual)) {
throw new Error(`Path ${this.actual} is not absolute`)
diff --git a/test/src/helpers/packTester.ts b/test/src/helpers/packTester.ts
index ed783612eb2..3b89239a8ab 100755
--- a/test/src/helpers/packTester.ts
+++ b/test/src/helpers/packTester.ts
@@ -38,7 +38,7 @@ interface AssertPackOptions {
export async function assertPack(fixtureName: string, packagerOptions: PackagerOptions, checkOptions?: AssertPackOptions): Promise {
const tempDirCreated = checkOptions == null ? null : checkOptions.tempDirCreated
- const useTempDir = tempDirCreated != null || packagerOptions.devMetadata != null || (checkOptions != null && checkOptions.useTempDir) || packagerOptions.targets.values().next().value.values().next().value[0] !== DEFAULT_TARGET
+ const useTempDir = fixtureName !== "app-executable-deps" && (tempDirCreated != null || packagerOptions.devMetadata != null || (checkOptions != null && checkOptions.useTempDir) || packagerOptions.targets.values().next().value.values().next().value[0] !== DEFAULT_TARGET)
let projectDir = path.join(__dirname, "..", "..", "fixtures", fixtureName)
// const isDoNotUseTempDir = platform === "darwin"
diff --git a/test/src/helpers/runTests.ts b/test/src/helpers/runTests.ts
index 003ba240c3f..067a833c472 100755
--- a/test/src/helpers/runTests.ts
+++ b/test/src/helpers/runTests.ts
@@ -20,7 +20,7 @@ const rootDir = path.join(__dirname, "..", "..", "..")
const testPackageDir = path.join(require("os").tmpdir(), "electron_builder_published")
const testNodeModules = path.join(testPackageDir, "node_modules")
-const electronVersion = "1.2.6"
+const electronVersion = "1.3.1"
async function main() {
await BluebirdPromise.all([
diff --git a/test/tsconfig.json b/test/tsconfig.json
index 2a2321b8a1c..382e52f5f17 100755
--- a/test/tsconfig.json
+++ b/test/tsconfig.json
@@ -18,7 +18,7 @@
"../typings/**/*.d.ts",
"typings/**/*.d.ts",
"src/**/*.ts",
- "../node_modules/ava-tf/index.d.ts",
+ "../node_modules/ava-tf/types/generated.d.ts",
"../node_modules/fs-extra-p/index.d.ts",
"../node_modules/fs-extra-p/bluebird.d.ts",
"../node_modules/electron-osx-sign/index.d.ts",
diff --git a/typings/asar.d.ts b/typings/asar.d.ts
index 29698766c92..b5efe8cc6e3 100644
--- a/typings/asar.d.ts
+++ b/typings/asar.d.ts
@@ -1,6 +1,4 @@
declare module "asar-electron-builder" {
- import { Stats } from "fs"
-
interface AsarFileInfo {
offset: number
size: number
@@ -11,7 +9,11 @@ declare module "asar-electron-builder" {
unpackDir?: string
dot?: boolean
+ smartUnpack?: boolean
+
ordering?: string | null
+
+ extraMetadata?: any | null
}
export function listPackage(archive: string): Array
@@ -19,5 +21,7 @@ declare module "asar-electron-builder" {
// followLinks defaults to true
export function statFile(archive: string, filename: string, followLinks?: boolean): AsarFileInfo | null
+ export function extractFile(archive: string, filename: string): Buffer | null
+
// export function createPackageFromFiles(src: string, dest: string, filenames: Array, metadata: { [key: string]: AsarFileMetadata;}, options: AsarOptions, callback: (error?: Error) => void): void
}
\ No newline at end of file