From cf80948fff0111202c82bab6dd56b161667dc2d2 Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Mon, 19 Sep 2022 21:47:49 -0400 Subject: [PATCH 1/2] Sync retainStagingFolder, stagingFolderPath with options. --- src/RokuDeploy.spec.ts | 4 ++-- src/RokuDeploy.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/RokuDeploy.spec.ts b/src/RokuDeploy.spec.ts index 14c218d..d9267e2 100644 --- a/src/RokuDeploy.spec.ts +++ b/src/RokuDeploy.spec.ts @@ -2906,7 +2906,7 @@ describe('index', () => { ).to.eql(s`${cwd}/staging-dir`); expect( rokuDeploy.getOptions({ stagingFolderPath: 'staging-folder-path' }).stagingFolderPath - ).to.be.undefined; + ).to.eql(s`${cwd}/staging-dir`); }); it('supports deprecated retainStagingFolder option', () => { @@ -2921,7 +2921,7 @@ describe('index', () => { ).to.be.false; expect( rokuDeploy.getOptions({ retainStagingFolder: true, retainStagingDir: false }).retainStagingFolder - ).to.be.undefined; + ).to.be.false; }); it('calling with no parameters works', () => { diff --git a/src/RokuDeploy.ts b/src/RokuDeploy.ts index e6d5a60..545581a 100644 --- a/src/RokuDeploy.ts +++ b/src/RokuDeploy.ts @@ -863,10 +863,10 @@ export class RokuDeploy { finalOptions.rootDir = path.resolve(process.cwd(), finalOptions.rootDir); finalOptions.outDir = path.resolve(process.cwd(), finalOptions.outDir); finalOptions.retainStagingDir = (finalOptions.retainStagingDir !== undefined) ? finalOptions.retainStagingDir : finalOptions.retainStagingFolder; - delete finalOptions.retainStagingFolder; + //sync the new option with the old one (for back-compat) + finalOptions.retainStagingFolder = finalOptions.retainStagingDir; let stagingDir = finalOptions.stagingDir || finalOptions.stagingFolderPath; - delete finalOptions.stagingFolderPath; //stagingDir if (stagingDir) { @@ -877,6 +877,8 @@ export class RokuDeploy { util.standardizePath(`${finalOptions.outDir}/.roku-deploy-staging`) ); } + //sync the new option with the old one (for back-compat) + finalOptions.stagingFolderPath = finalOptions.stagingDir; return finalOptions; } From 7877712956ec2c2896762b9e0d68675ae390489e Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Mon, 19 Sep 2022 21:49:16 -0400 Subject: [PATCH 2/2] Fix broken test --- src/RokuDeploy.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RokuDeploy.spec.ts b/src/RokuDeploy.spec.ts index d9267e2..b6c757e 100644 --- a/src/RokuDeploy.spec.ts +++ b/src/RokuDeploy.spec.ts @@ -2906,7 +2906,7 @@ describe('index', () => { ).to.eql(s`${cwd}/staging-dir`); expect( rokuDeploy.getOptions({ stagingFolderPath: 'staging-folder-path' }).stagingFolderPath - ).to.eql(s`${cwd}/staging-dir`); + ).to.eql(s`${cwd}/staging-folder-path`); }); it('supports deprecated retainStagingFolder option', () => {