electron-builder-util
Advanced tools
Comparing version 18.6.0 to 18.7.0
@@ -102,7 +102,11 @@ declare module "electron-builder-util/out/log" { | ||
export function copyFile(src: string, dest: string, isEnsureDir?: boolean): Promise<any> | ||
/** | ||
* Hard links is used if supported and allowed. | ||
* File permission is fixed — allow execute for all if owner can, allow read for all if owner can. | ||
* | ||
* ensureDir is not called, dest parent dir must exists | ||
*/ | ||
export function copyFile(src: string, dest: string, stats?: Stats | null, isUseHardLink?: boolean): Promise<any> | ||
export function copyOrLinkFile(src: string, dest: string, stats?: Stats | null, isUseHardLink?: boolean): Promise<any> | ||
@@ -109,0 +113,0 @@ export class FileCopier { |
@@ -116,4 +116,11 @@ "use strict"; | ||
exports.copyFile = copyFile; | ||
exports.copyOrLinkFile = copyOrLinkFile; | ||
exports.copyDir = copyDir; | ||
var _fcopyPreBundled; | ||
function _load_fcopyPreBundled() { | ||
return _fcopyPreBundled = _interopRequireDefault(require("fcopy-pre-bundled")); | ||
} | ||
var _fsExtraP; | ||
@@ -156,7 +163,14 @@ | ||
const _isUseHardLink = process.platform != "win32" && process.env.USE_HARD_LINKS !== "false" && ((_isCi || _load_isCi()).default || process.env.USE_HARD_LINKS === "true"); | ||
function copyFile(src, dest) { | ||
let isEnsureDir = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
return (isEnsureDir ? (0, (_fsExtraP || _load_fsExtraP()).ensureDir)(_path.dirname(dest)) : (_bluebirdLst2 || _load_bluebirdLst2()).default.resolve()).then(() => copyOrLinkFile(src, dest, null, false)); | ||
} | ||
/** | ||
* Hard links is used if supported and allowed. | ||
* File permission is fixed — allow execute for all if owner can, allow read for all if owner can. | ||
* | ||
* ensureDir is not called, dest parent dir must exists | ||
*/ | ||
function copyFile(src, dest, stats) { | ||
function copyOrLinkFile(src, dest, stats) { | ||
let isUseHardLink = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _isUseHardLink; | ||
@@ -191,10 +205,3 @@ | ||
return new (_bluebirdLst2 || _load_bluebirdLst2()).default(function (resolve, reject) { | ||
const readStream = (0, (_fsExtraP || _load_fsExtraP()).createReadStream)(src); | ||
const writeStream = (0, (_fsExtraP || _load_fsExtraP()).createWriteStream)(dest, stats == null ? undefined : { mode: stats.mode }); | ||
readStream.on("error", reject); | ||
writeStream.on("error", reject); | ||
writeStream.on("open", function () { | ||
readStream.pipe(writeStream); | ||
}); | ||
writeStream.once("close", resolve); | ||
(0, (_fcopyPreBundled || _load_fcopyPreBundled()).default)(src, dest, stats == null ? undefined : { mode: stats.mode }, error => error == null ? resolve() : reject(error)); | ||
}); | ||
@@ -225,3 +232,3 @@ } | ||
} | ||
yield copyFile(src, dest, stat, !_this.isUseHardLink || _this.isUseHardLinkFunction == null ? _this.isUseHardLink : _this.isUseHardLinkFunction(dest)); | ||
yield copyOrLinkFile(src, dest, stat, !_this.isUseHardLink || _this.isUseHardLinkFunction == null ? _this.isUseHardLink : _this.isUseHardLinkFunction(dest)); | ||
} catch (e) { | ||
@@ -235,3 +242,3 @@ // files are copied concurrently, so, we must not check here currentIsUseHardLink — our code can be executed after that other handler will set currentIsUseHardLink to false | ||
} | ||
yield copyFile(src, dest, stat, false); | ||
yield copyOrLinkFile(src, dest, stat, false); | ||
} else { | ||
@@ -262,3 +269,3 @@ throw e; | ||
if (!createdSourceDirs.has(parent)) { | ||
yield (0, (_fsExtraP || _load_fsExtraP()).mkdirs)(parent.replace(src, destination)); | ||
yield (0, (_fsExtraP || _load_fsExtraP()).ensureDir)(parent.replace(src, destination)); | ||
createdSourceDirs.add(parent); | ||
@@ -274,3 +281,3 @@ } | ||
return function (_x7, _x8, _x9) { | ||
return function (_x8, _x9, _x10) { | ||
return _ref4.apply(this, arguments); | ||
@@ -277,0 +284,0 @@ }; |
{ | ||
"name": "electron-builder-util", | ||
"version": "18.6.0", | ||
"version": "18.7.0", | ||
"main": "out/util.js", | ||
@@ -15,2 +15,3 @@ "author": "Vladimir Krivosheev", | ||
"fs-extra-p": "^4.3.0", | ||
"fcopy-pre-bundled": "^0.1.2", | ||
"is-ci": "^1.0.10", | ||
@@ -22,3 +23,3 @@ "stat-mode": "^0.2.2", | ||
"node-emoji": "^1.5.1", | ||
"electron-builder-http": "~18.6.0", | ||
"electron-builder-http": "~18.7.0", | ||
"source-map-support": "^0.4.15", | ||
@@ -25,0 +26,0 @@ "7zip-bin": "^2.1.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114761
1221
13
+ Addedfcopy-pre-bundled@^0.1.2
+ Addedelectron-builder-http@18.7.0(transitive)
+ Addedfcopy-pre-bundled@0.1.2(transitive)
- Removedelectron-builder-http@18.6.0(transitive)