From 606e089a52e75c1927b73f19a62a598aaffb6f8f Mon Sep 17 00:00:00 2001 From: uiolee <22849383+uiolee@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:39:16 +0800 Subject: [PATCH 1/2] fix(extendDirs): support relative path --- lib/deployer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/deployer.js b/lib/deployer.js index 97740ce..749be4e 100644 --- a/lib/deployer.js +++ b/lib/deployer.js @@ -119,7 +119,7 @@ module.exports = function(args) { const mapFn = function(dir) { const opts = {}; const extendPath = pathFn.join(baseDir, dir); - const extendDist = pathFn.join(deployDir, dir); + const extendDist = pathFn.join(deployDir, pathFn.basename(dir)); if (typeof ignoreHidden === 'object') { opts.ignoreHidden = ignoreHidden[dir]; From 9d747347576a8a4cdb969f269655fb74090200bd Mon Sep 17 00:00:00 2001 From: uiolee <22849383+uiolee@users.noreply.github.com> Date: Mon, 8 Jul 2024 00:43:33 +0800 Subject: [PATCH 2/2] test case --- test/deployer.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/deployer.js b/test/deployer.js index 6c34935..d09f480 100644 --- a/test/deployer.js +++ b/test/deployer.js @@ -118,6 +118,30 @@ describe('deployer', () => { }); }); + it('extend dirs - relative path', () => { + const extendDirInput = '../extendAsset'; + const extendDir = pathFn.join(baseDir, extendDirInput); + const extendDirName = pathFn.basename(extendDir); + + return fs.writeFile(pathFn.join(extendDir, 'extR.txt'), 'relative') + .then(() => { + return deployer({ + repo: fakeRemote, + extend_dirs: extendDirInput, + silent: true + }); + }).then(() => { + return validate(); + }).then(() => { + const extTxtFile = pathFn.join(validateDir, extendDirName, 'extR.txt'); + + return fs.readFile(extTxtFile); + }).then(content => { + content.should.eql('relative'); + return fs.rmdir(extendDir); + }); + }); + it('multi deployment', () => { return deployer({ repo: {