diff --git a/.idea/electron-builder.iml b/.idea/electron-builder.iml index cdea3c1d2d5..81b7e41308e 100644 --- a/.idea/electron-builder.iml +++ b/.idea/electron-builder.iml @@ -26,6 +26,7 @@ + diff --git a/docs/api/electron-builder-util.md b/docs/api/electron-builder-util.md index 85390f97d3f..a28c3a4c6e7 100644 --- a/docs/api/electron-builder-util.md +++ b/docs/api/electron-builder-util.md @@ -94,6 +94,12 @@ ### FileCopier **Kind**: class of [electron-builder-util/out/fs](#module_electron-builder-util/out/fs) +**Properties** + +| Name | Type | +| --- | --- | +| **isUseHardLink**| Boolean | + #### `fileCopier.copy(src, dest, stat)` ⇒ Promise<void> @@ -117,8 +123,8 @@ Hard links is used if supported and allowed. | --- | --- | | src | String | | destination | String | -| filter | module:electron-builder-util/out/fs.__type | -| transformer | module:electron-builder-util/out/fs.__type | +| filter | module:electron-builder-util/out/fs.__type \| null | +| transformer | module:electron-builder-util/out/fs.__type \| null | | isUseHardLink | callback | diff --git a/package.json b/package.json index 685d90674d8..1860018c06e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "update-deps": "node ./packages/update-deps.js", "set-versions": "node test/out/helpers/setVersions.js", "npm-publish": "yarn set-versions && 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 --titles", + "schema": "typescript-json-schema packages/electron-builder/tsconfig.json Config --out packages/electron-builder/scheme.json --noExtraProps --useTypeOfKeyword --strictNullChecks --titles --required", "jsdoc": "ts2jsdoc packages/electron-builder-http packages/electron-updater packages/electron-builder-util packages/electron-builder packages/electron-builder-core packages/electron-publish", "jsdoc2md": "node packages/jsdoc2md.js", "api": "node ./test/vendor/yarn.js jsdoc && node ./test/vendor/yarn.js jsdoc2md" @@ -81,7 +81,7 @@ "convert-source-map": "^1.5.0", "decompress-zip": "^0.3.0", "depcheck": "^0.6.7", - "develar-typescript-json-schema": "0.11.0", + "develar-typescript-json-schema": "0.13.3", "env-paths": "^1.0.0", "globby": "^6.1.0", "jest-cli": "^20.0.4", diff --git a/packages/electron-builder-util/src/fs.ts b/packages/electron-builder-util/src/fs.ts index fb93f9d4c51..50a72960f00 100644 --- a/packages/electron-builder-util/src/fs.ts +++ b/packages/electron-builder-util/src/fs.ts @@ -159,9 +159,10 @@ export function copyOrLinkFile(src: string, dest: string, stats?: Stats | null, } export class FileCopier { - private isUseHardLink = _isUseHardLink + isUseHardLink: boolean - constructor(private readonly isUseHardLinkFunction?: (file: string) => boolean, private readonly transformer?: FileTransformer) { + constructor(private readonly isUseHardLinkFunction?: (file: string) => boolean, private readonly transformer?: FileTransformer | null) { + this.isUseHardLink = _isUseHardLink && isUseHardLinkFunction !== DO_NOT_USE_HARD_LINKS } async copy(src: string, dest: string, stat: Stats | undefined) { @@ -203,13 +204,14 @@ export class FileCopier { * Empty directories is never created. * Hard links is used if supported and allowed. */ -export function copyDir(src: string, destination: string, filter?: Filter, transformer?: FileTransformer, isUseHardLink?: (file: string) => boolean): Promise { +export function copyDir(src: string, destination: string, filter?: Filter | null, transformer?: FileTransformer | null, isUseHardLink?: (file: string) => boolean): Promise { + const fileCopier = new FileCopier(isUseHardLink, transformer) + if (debug.enabled) { - debug(`Copying ${src} to ${destination}${_isUseHardLink ? " using hard links" : ""}`) + debug(`Copying ${src} to ${destination}${fileCopier.isUseHardLink ? " using hard links" : ""}`) } const createdSourceDirs = new Set() - const fileCopier = new FileCopier(isUseHardLink, transformer) const links: Array = [] return walk(src, filter, async(file, stat, parent) => { if (!stat.isFile() && !stat.isSymbolicLink()) { @@ -232,6 +234,8 @@ export function copyDir(src: string, destination: string, filter?: Filter, trans .then(() => BluebirdPromise.map(links, it => symlink(it.link, it.file), CONCURRENCY)) } +export const DO_NOT_USE_HARD_LINKS = (file: string) => false + interface Link { readonly link: string, readonly file: string diff --git a/packages/electron-builder/src/packager.ts b/packages/electron-builder/src/packager.ts index 2b4be393491..9634a0bd1a4 100644 --- a/packages/electron-builder/src/packager.ts +++ b/packages/electron-builder/src/packager.ts @@ -255,8 +255,12 @@ export class Packager implements BuildInfo { const targetList = createTargets(nameToTarget, targetNames.length === 0 ? packager.defaultTarget : targetNames, outDir, packager, cleanupTasks) const ourDirs = new Set() for (const target of targetList) { - const outDir = target.outDir - if (!createdOutDirs.has(outDir) && !(target instanceof NoOpTarget)) { + if (target instanceof NoOpTarget) { + continue + } + + const outDir = (target).outDir + if (createdOutDirs.has(outDir)) { ourDirs.add(outDir) } } diff --git a/packages/electron-builder/src/packager/dirPackager.ts b/packages/electron-builder/src/packager/dirPackager.ts index 7fb797b454c..f76a9bde598 100644 --- a/packages/electron-builder/src/packager/dirPackager.ts +++ b/packages/electron-builder/src/packager/dirPackager.ts @@ -1,7 +1,7 @@ import { path7za } from "7zip-bin" import BluebirdPromise from "bluebird-lst" import { debug7zArgs, spawn } from "electron-builder-util" -import { copyDir } from "electron-builder-util/out/fs" +import { copyDir, DO_NOT_USE_HARD_LINKS } from "electron-builder-util/out/fs" import { log, warn } from "electron-builder-util/out/log" import { chmod, emptyDir } from "fs-extra-p" import * as path from "path" @@ -61,7 +61,7 @@ async function unpack(packager: PlatformPackager, out: string, platform: st const destination = packager.getElectronDestDir(out) log(`Copying Electron from "${source}" to "${destination}"`) await emptyDir(out) - await copyDir(source, destination) + await copyDir(source, destination, null, null, DO_NOT_USE_HARD_LINKS) } if (platform === "linux") { diff --git a/packages/jsdoc2md.js b/packages/jsdoc2md.js index 2d62dd9aa08..1102dc1bc5c 100644 --- a/packages/jsdoc2md.js +++ b/packages/jsdoc2md.js @@ -49,7 +49,6 @@ async function main() { const developerFiles = (await globby([ "builder/**/*.js", - "!**/*-dirPackager.js", "!***/*-asarUtil.js", "!***/*-fileMatcher.js", "!***/*-fileTransformer.js", diff --git a/typings/yargs.d.ts b/typings/yargs.d.ts index 543df9c10a9..63886831bc9 100644 --- a/typings/yargs.d.ts +++ b/typings/yargs.d.ts @@ -127,7 +127,7 @@ declare namespace yargs { completion(cmd: string, fn?: SyncCompletionFunction): Yargs; - completion(cmd: string, description?: string, fn?: AsyncCompletionFunction): Yargs; + completion(cmd: string | undefined, description?: string, fn?: AsyncCompletionFunction): Yargs; completion(cmd: string, description?: string, fn?: SyncCompletionFunction): Yargs; diff --git a/yarn.lock b/yarn.lock index a80310831bd..d152e2ef320 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1013,14 +1013,14 @@ detect-newline@^1.0.3: get-stdin "^4.0.1" minimist "^1.1.0" -develar-typescript-json-schema@0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/develar-typescript-json-schema/-/develar-typescript-json-schema-0.11.0.tgz#d73580cae2fb0b8f9a7cee3d10aff6caae751cca" +develar-typescript-json-schema@0.13.3: + version "0.13.3" + resolved "https://registry.yarnpkg.com/develar-typescript-json-schema/-/develar-typescript-json-schema-0.13.3.tgz#c3accb60ebdcdf4ee711adbd6c194167debf5939" dependencies: - glob "~7.1.1" + glob "~7.1.2" json-stable-stringify "^1.0.1" - typescript "~2.1.5" - yargs "^7.0.2" + typescript "~2.3.0" + yargs "^8.0.1" diff@^3.2.0: version "3.2.0" @@ -1368,7 +1368,7 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.0, glob@^7.1.1, glob@~7.1.1: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.0, glob@^7.1.1, glob@~7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -3353,9 +3353,9 @@ typescript@next: version "2.5.0-dev.20170614" resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.5.0-dev.20170614.tgz#eb77ed212a5e49ebc8392ba0a95713ef87d9f6f1" -typescript@~2.1.5: - version "2.1.6" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.6.tgz#40c7e6e9e5da7961b7718b55505f9cac9487a607" +typescript@~2.3.0: + version "2.3.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.4.tgz#3d38321828231e434f287514959c37a82b629f42" typical@^2.4.2, typical@^2.6.0, typical@^2.6.1: version "2.6.1" @@ -3715,7 +3715,7 @@ yargs@^7.0.2: y18n "^3.2.1" yargs-parser "^5.0.0" -yargs@^8.0.2: +yargs@^8.0.1, yargs@^8.0.2: version "8.0.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360" dependencies: