From bd74d436c7579107c65aaec2505e68ad83422325 Mon Sep 17 00:00:00 2001 From: Alexey Igrychev Date: Thu, 18 Mar 2021 12:13:58 +0000 Subject: [PATCH] Output envs loaded by the dotenv instead of printing a source file content --- build/index.js | 11 ++--------- cleanup/index.js | 11 ++--------- converge/index.js | 11 ++--------- dismiss/index.js | 11 ++--------- install/index.js | 11 ++--------- run/index.js | 11 ++--------- src/manager.ts | 12 ++---------- 7 files changed, 14 insertions(+), 64 deletions(-) diff --git a/build/index.js b/build/index.js index 799bccb..c8094cb 100644 --- a/build/index.js +++ b/build/index.js @@ -43843,15 +43843,8 @@ class Manager { const tmpFile = tmp.fileSync(); const tmpFilePath = tmpFile.name; yield this.Exec(['ci-env', 'github', '--as-env-file', '-o', tmpFilePath]); - dotenv.config({ path: tmpFilePath }); - fs.readFile(tmpFilePath, null, function (err, contents) { - if (err) { - console.error(err); - } - else { - console.log(contents.toString()); - } - }); + const res = dotenv.config({ path: tmpFilePath }); + console.log(res.parsed); tmpFile.removeCallback(); }); } diff --git a/cleanup/index.js b/cleanup/index.js index f7318fd..211c417 100644 --- a/cleanup/index.js +++ b/cleanup/index.js @@ -43843,15 +43843,8 @@ class Manager { const tmpFile = tmp.fileSync(); const tmpFilePath = tmpFile.name; yield this.Exec(['ci-env', 'github', '--as-env-file', '-o', tmpFilePath]); - dotenv.config({ path: tmpFilePath }); - fs.readFile(tmpFilePath, null, function (err, contents) { - if (err) { - console.error(err); - } - else { - console.log(contents.toString()); - } - }); + const res = dotenv.config({ path: tmpFilePath }); + console.log(res.parsed); tmpFile.removeCallback(); }); } diff --git a/converge/index.js b/converge/index.js index 69c0ee3..cc7d0ce 100644 --- a/converge/index.js +++ b/converge/index.js @@ -43844,15 +43844,8 @@ class Manager { const tmpFile = tmp.fileSync(); const tmpFilePath = tmpFile.name; yield this.Exec(['ci-env', 'github', '--as-env-file', '-o', tmpFilePath]); - dotenv.config({ path: tmpFilePath }); - fs.readFile(tmpFilePath, null, function (err, contents) { - if (err) { - console.error(err); - } - else { - console.log(contents.toString()); - } - }); + const res = dotenv.config({ path: tmpFilePath }); + console.log(res.parsed); tmpFile.removeCallback(); }); } diff --git a/dismiss/index.js b/dismiss/index.js index 1520d4c..a269664 100644 --- a/dismiss/index.js +++ b/dismiss/index.js @@ -43844,15 +43844,8 @@ class Manager { const tmpFile = tmp.fileSync(); const tmpFilePath = tmpFile.name; yield this.Exec(['ci-env', 'github', '--as-env-file', '-o', tmpFilePath]); - dotenv.config({ path: tmpFilePath }); - fs.readFile(tmpFilePath, null, function (err, contents) { - if (err) { - console.error(err); - } - else { - console.log(contents.toString()); - } - }); + const res = dotenv.config({ path: tmpFilePath }); + console.log(res.parsed); tmpFile.removeCallback(); }); } diff --git a/install/index.js b/install/index.js index a0647b8..bff94ee 100644 --- a/install/index.js +++ b/install/index.js @@ -43962,15 +43962,8 @@ class Manager { const tmpFile = tmp.fileSync(); const tmpFilePath = tmpFile.name; yield this.Exec(['ci-env', 'github', '--as-env-file', '-o', tmpFilePath]); - dotenv.config({ path: tmpFilePath }); - fs.readFile(tmpFilePath, null, function (err, contents) { - if (err) { - console.error(err); - } - else { - console.log(contents.toString()); - } - }); + const res = dotenv.config({ path: tmpFilePath }); + console.log(res.parsed); tmpFile.removeCallback(); }); } diff --git a/run/index.js b/run/index.js index 745197c..c757f35 100644 --- a/run/index.js +++ b/run/index.js @@ -43916,15 +43916,8 @@ class Manager { const tmpFile = tmp.fileSync(); const tmpFilePath = tmpFile.name; yield this.Exec(['ci-env', 'github', '--as-env-file', '-o', tmpFilePath]); - dotenv.config({ path: tmpFilePath }); - fs.readFile(tmpFilePath, null, function (err, contents) { - if (err) { - console.error(err); - } - else { - console.log(contents.toString()); - } - }); + const res = dotenv.config({ path: tmpFilePath }); + console.log(res.parsed); tmpFile.removeCallback(); }); } diff --git a/src/manager.ts b/src/manager.ts index 8131ad8..de03cc9 100644 --- a/src/manager.ts +++ b/src/manager.ts @@ -62,16 +62,8 @@ export class Manager { const tmpFile = tmp.fileSync() const tmpFilePath = tmpFile.name await this.Exec(['ci-env', 'github', '--as-env-file', '-o', tmpFilePath]) - dotenv.config({path: tmpFilePath}) - - fs.readFile(tmpFilePath, null, function(err, contents) { - if (err) { - console.error(err) - } else { - console.log(contents.toString()) - } - }) - + const res = dotenv.config({path: tmpFilePath}) + console.log(res.parsed) tmpFile.removeCallback() }