From b8278a98020f187578d886090ff56bddf9754f68 Mon Sep 17 00:00:00 2001 From: jthegedus Date: Tue, 11 May 2021 09:01:41 +1000 Subject: [PATCH 1/2] fix: resolve dirname for firebasejon config --- src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index dabd4a8..b513f05 100644 --- a/src/utils.js +++ b/src/utils.js @@ -108,7 +108,7 @@ function parseFirebaseConfiguration({hostingSite, sourceRewriteMatch, firebaseJs region: rewriteConfig.run?.region || 'us-central1' } : false, publicDir: path.join(path.dirname(firebaseJson), hostingConfig.public), - firebaseJsonDir: firebaseJson + firebaseJsonDir: path.dirname(firebaseJson) }; } From 3f035e6d1134cc3e0493861ee7fa4942dc4dfdb9 Mon Sep 17 00:00:00 2001 From: jthegedus Date: Tue, 11 May 2021 09:13:16 +1000 Subject: [PATCH 2/2] fix: update test cases for firebaseJsonDir --- tests/index.test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/index.test.js b/tests/index.test.js index db0c765..97c3848 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -9,7 +9,7 @@ test( t => { const config = {hostingSite: undefined, sourceRewriteMatch: '**', firebaseJson: fileURLToPath(new URL('./fixtures/successes/cf_site.json', import.meta.url))}; const result = parseFirebaseConfiguration(config); - const expectedResult = {functions: {name: 'some_func', source: path.join(path.dirname(config.firebaseJson), 'functions')}, cloudRun: false, publicDir: path.join(path.dirname(config.firebaseJson), 'app'), firebaseJsonDir: config.firebaseJson}; + const expectedResult = {functions: {name: 'some_func', source: path.join(path.dirname(config.firebaseJson), 'functions')}, cloudRun: false, publicDir: path.join(path.dirname(config.firebaseJson), 'app'), firebaseJsonDir: path.dirname(config.firebaseJson)}; t.deepEqual(result, expectedResult); } @@ -20,7 +20,7 @@ test( t => { const config = {hostingSite: 'app', sourceRewriteMatch: '**', firebaseJson: fileURLToPath(new URL('./fixtures/successes/cf_sites.json', import.meta.url))}; const result = parseFirebaseConfiguration(config); - const expectedResult = {functions: {name: 'some_func', source: path.join(path.dirname(config.firebaseJson), 'functions')}, cloudRun: false, publicDir: path.join(path.dirname(config.firebaseJson), 'app'), firebaseJsonDir: config.firebaseJson}; + const expectedResult = {functions: {name: 'some_func', source: path.join(path.dirname(config.firebaseJson), 'functions')}, cloudRun: false, publicDir: path.join(path.dirname(config.firebaseJson), 'app'), firebaseJsonDir: path.dirname(config.firebaseJson)}; t.deepEqual(result, expectedResult); } @@ -31,7 +31,7 @@ test( t => { const config = {hostingSite: undefined, sourceRewriteMatch: '**', firebaseJson: fileURLToPath(new URL('./fixtures/successes/cr_site.json', import.meta.url))}; const result = parseFirebaseConfiguration(config); - const expectedResult = {functions: false, cloudRun: {serviceId: 'some-service', region: 'us-central1'}, publicDir: path.join(path.dirname(config.firebaseJson), 'app'), firebaseJsonDir: config.firebaseJson}; + const expectedResult = {functions: false, cloudRun: {serviceId: 'some-service', region: 'us-central1'}, publicDir: path.join(path.dirname(config.firebaseJson), 'app'), firebaseJsonDir: path.dirname(config.firebaseJson)}; t.deepEqual(result, expectedResult); } @@ -42,7 +42,7 @@ test( t => { const config = {hostingSite: 'app', sourceRewriteMatch: '**', firebaseJson: fileURLToPath(new URL('./fixtures/successes/cr_sites.json', import.meta.url))}; const result = parseFirebaseConfiguration(config); - const expectedResult = {functions: false, cloudRun: {serviceId: 'some-service', region: 'us-central1'}, publicDir: path.join(path.dirname(config.firebaseJson), 'app'), firebaseJsonDir: config.firebaseJson}; + const expectedResult = {functions: false, cloudRun: {serviceId: 'some-service', region: 'us-central1'}, publicDir: path.join(path.dirname(config.firebaseJson), 'app'), firebaseJsonDir: path.dirname(config.firebaseJson)}; t.deepEqual(result, expectedResult); }