From 92196aa393d969e451018f77d106e9500ecfbf9b Mon Sep 17 00:00:00 2001 From: Benjamin Weggersen Date: Thu, 21 Mar 2019 16:21:55 +0100 Subject: [PATCH 1/2] Add support for symlinks --- src/npm/hash-and-cache.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/npm/hash-and-cache.js b/src/npm/hash-and-cache.js index 9247c31..528c840 100644 --- a/src/npm/hash-and-cache.js +++ b/src/npm/hash-and-cache.js @@ -65,6 +65,7 @@ module.exports = async function (options) { file: tarPath, strict: true, gzip: true, + noDirRecurse: true, cwd: options.outputPath } @@ -96,7 +97,9 @@ var generateHash = function (sourcePath, sourceFiles, sourceIgnore, hashSuffix, }); hashAlgorithm.update(hashSuffix); - hashAlgorithm.update(execCommand); + if (execCommand) { + hashAlgorithm.update(execCommand); + } var hash = hashAlgorithm.digest('hex'); @@ -116,7 +119,7 @@ var getFileList = function (workingDirectory, globs, ignoreGlob) { var globOptions = { cwd: workingDirectory, dot: true, - nodir: true, + nodir: false, ignore: ignoreGlob } @@ -240,6 +243,7 @@ var extractCache = function (targetPath, hash) { sync: true, file: tarPath, strict: true, + preservePaths: true, cwd: targetPath } From 6856cc3315afb6a07cbf7729efae3d1173c03ee8 Mon Sep 17 00:00:00 2001 From: Benjamin Weggersen Date: Thu, 21 Mar 2019 16:23:55 +0100 Subject: [PATCH 2/2] Add support for symlinks (VSTS) --- src/vsts/buildAndReleaseTask/hash-and-cache.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vsts/buildAndReleaseTask/hash-and-cache.js b/src/vsts/buildAndReleaseTask/hash-and-cache.js index 9247c31..528c840 100644 --- a/src/vsts/buildAndReleaseTask/hash-and-cache.js +++ b/src/vsts/buildAndReleaseTask/hash-and-cache.js @@ -65,6 +65,7 @@ module.exports = async function (options) { file: tarPath, strict: true, gzip: true, + noDirRecurse: true, cwd: options.outputPath } @@ -96,7 +97,9 @@ var generateHash = function (sourcePath, sourceFiles, sourceIgnore, hashSuffix, }); hashAlgorithm.update(hashSuffix); - hashAlgorithm.update(execCommand); + if (execCommand) { + hashAlgorithm.update(execCommand); + } var hash = hashAlgorithm.digest('hex'); @@ -116,7 +119,7 @@ var getFileList = function (workingDirectory, globs, ignoreGlob) { var globOptions = { cwd: workingDirectory, dot: true, - nodir: true, + nodir: false, ignore: ignoreGlob } @@ -240,6 +243,7 @@ var extractCache = function (targetPath, hash) { sync: true, file: tarPath, strict: true, + preservePaths: true, cwd: targetPath }