From 0dd55e86b61a9fdefa78e3939c930e2208cae478 Mon Sep 17 00:00:00 2001 From: = Date: Wed, 11 May 2022 17:15:01 -0300 Subject: [PATCH 1/2] feat: fix example usage --- README.md | 3 +++ src/index.mjs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 465c120..790e2b8 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@ Or sev --help ``` +### Error +You can pass --error or -e to throw an error if some key is missing in .env + ### Output example ![output image](/src/resources/screenshot.png "output example") diff --git a/src/index.mjs b/src/index.mjs index e0a7046..d16e628 100755 --- a/src/index.mjs +++ b/src/index.mjs @@ -9,7 +9,7 @@ async function main() { const { log } = console; const options = yargs - .usage('Usage: envy-verify --example <.env.example> --env <.env>') + .usage('Usage: simple-env-verify --example <.env.example> --env <.env>') .option('example', { alias: 'ex', describe: 'Your .env example file', From 4dff3894ec30dbc69e834f20fb533487ed18ab02 Mon Sep 17 00:00:00 2001 From: Gustavo Bonfim Date: Mon, 16 May 2022 11:07:58 -0300 Subject: [PATCH 2/2] feat: skip empty line on read file (#4) --- .env.example | 1 + package.json | 5 ++++- src/utils/readEnv.mjs | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 91bc5b4..ffb7fb4 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ APP_PORT= + API_BASE_URL= API_TOKEN= diff --git a/package.json b/package.json index 442c4b3..d9a01c9 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,13 @@ { "name": "simple-env-verify", - "version": "1.0.1", + "version": "1.0.2", "main": "src/index.mjs", "author": "Gustavo Bonfim", "license": "MIT", "keywords": ["env", "verify", "env-verify"], + "scripts": { + "dev": "node src/index.mjs --env .env --example .env.example" + }, "repository": { "type": "git", "url": "https://github.com/GustavoBonfimS/simple-env-verify" diff --git a/src/utils/readEnv.mjs b/src/utils/readEnv.mjs index 7ea88fd..c9af563 100644 --- a/src/utils/readEnv.mjs +++ b/src/utils/readEnv.mjs @@ -2,7 +2,9 @@ import LineByLine from 'line-by-line'; function readEnv(filePath) { return new Promise((resolve, reject) => { - const lr = new LineByLine(filePath); + const lr = new LineByLine(filePath, { + skipEmptyLines: true, + }); const envObj = {};