Browse Source

Add an example and testing/coverage info.

tags/0.1.1
Bauke 9 months ago
parent
commit
4b1e3ea710
Signed by: Bauke <me@bauke.xyz> GPG Key ID: C1C0F29952BCF558
2 changed files with 37 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +34
    -0
      README.md

+ 3
- 0
.gitignore View File

@@ -1,2 +1,5 @@
# Deno test coverage output.
.coverage

# VS Code settings.
.vscode/

+ 34
- 0
README.md View File

@@ -4,6 +4,40 @@ A very minimal `.env` parser for Deno.

Requires `--allow-read` and `--allow-env` permissions (for obvious reasons).

## Example

```ts
import dotenv from "https://deno.land/x/minimal_dotenv/minimal_dotenv.ts";

await dotenv();

// Optionally, you can specify the filename/full path:
// await dotenv(".env.different");

// With .env file containing MINIMAL_DOTENV="working" outputs:
// minimal_dotenv is working
console.log(`minimal_dotenv is ${Deno.env.get("MINIMAL_DOTENV")}`);
```

<details>
<summary>Testing & Coverage</summary>

To test and generate code coverage (requires
[LCOV](https://github.com/linux-test-project/lcov)'s `genhtml` to output HTML).

```sh
# Run the tests and emit coverage data.
deno test --allow-read --allow-env --coverage=.coverage
# Convert Deno's output coverage to LCOV.
deno coverage --lcov .coverage > .coverage/report.lcov
# Convert LCOV to HTML.
genhtml -o .coverage/html .coverage/report.lcov
# Open the coverage in your browser.
firefox .coverage/html/index.html
```

</details>

## License

Licensed with the [AGPL-3.0-or-later license](LICENSE).