Skip to content

Commit

Permalink
Merge branch 'master' into feat-multiline
Browse files Browse the repository at this point in the history
  • Loading branch information
andreialecu committed Jul 30, 2021
2 parents ac20ff8 + 27dfd3f commit 9b1d338
Show file tree
Hide file tree
Showing 13 changed files with 708 additions and 255 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -7,9 +7,9 @@ os:
- windows

node_js:
- "8"
- "10"
- "12"
- "14"

cache: npm

Expand Down
71 changes: 63 additions & 8 deletions CHANGELOG.md
Expand Up @@ -2,24 +2,79 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [10.0.0](https://github.com/motdotla/dotenv/compare/v9.0.2...v10.0.0) (2021-05-20)

### Added

- Add generic support to parse function
- Allow for import "dotenv/config.js"
- Add support to resolve home directory in path via ~

## [9.0.2](https://github.com/motdotla/dotenv/compare/v9.0.1...v9.0.2) (2021-05-10)

### Changed

- Support windows newlines with debug mode

## [9.0.1](https://github.com/motdotla/dotenv/compare/v9.0.0...v9.0.1) (2021-05-08)

### Changed

- Updates to README

## [9.0.0](https://github.com/motdotla/dotenv/compare/v8.6.0...v9.0.0) (2021-05-05)

### Changed

- _Breaking:_ drop support for Node v8

## [8.6.0](https://github.com/motdotla/dotenv/compare/v8.5.1...v8.6.0) (2021-05-05)

### Added

- define package.json in exports

## [8.5.1](https://github.com/motdotla/dotenv/compare/v8.5.0...v8.5.1) (2021-05-05)

### Changed

- updated dev dependencies via npm audit

## [8.5.0](https://github.com/motdotla/dotenv/compare/v8.4.0...v8.5.0) (2021-05-05)

### Added

- allow for `import "dotenv/config"`

## [8.4.0](https://github.com/motdotla/dotenv/compare/v8.3.0...v8.4.0) (2021-05-05)

### Changed

- point to exact types file to work with VS Code

## [8.3.0](https://github.com/motdotla/dotenv/compare/v8.2.0...v8.3.0) (2021-05-05)

### Changed

- _Breaking:_ drop support for Node v8 (mistake to be released as minor bump. later bumped to 9.0.0. see above.)

## [8.2.0](https://github.com/motdotla/dotenv/compare/v8.1.0...v8.2.0) (2019-10-16)

## [8.1.0](https://github.com/motdotla/dotenv/compare/v7.0.0...v8.1.0) (2019-08-18)
### Added

- TypeScript types

### ⚠ BREAKING CHANGES
## [8.1.0](https://github.com/motdotla/dotenv/compare/v8.0.0...v8.1.0) (2019-08-18)

* dropping Node v6 support because end-of-life
### Changed

* Drop support for Node v6 (#392) ([2e9636a](https://github.com/motdotla/dotenv/commit/2e9636a)), closes [#392](https://github.com/motdotla/dotenv/issues/392)
- _Breaking:_ drop support for Node v6 ([#392](https://github.com/motdotla/dotenv/issues/392))

# [8.0.0](https://github.com/motdotla/dotenv/compare/v7.0.0...v8.0.0) (2019-05-02)

- Drop support for Node v6 (#392) ([2e9636a](https://github.com/motdotla/dotenv/commit/2e9636a)), closes [#392](https://github.com/motdotla/dotenv/issues/392)

### BREAKING CHANGES
### Changed

- dropping Node v6 support because end-of-life
- _Breaking:_ drop support for Node v6 ([#302](https://github.com/motdotla/dotenv/issues/392))

## [7.0.0] - 2019-03-12

Expand Down
9 changes: 9 additions & 0 deletions README.md
@@ -1,3 +1,11 @@
<p align="center">
<strong>Announcement 📣</strong><br/>From the makers that brought you Dotenv, introducing <a href="https://sync.dotenv.org">Dotenv Sync</a>.<br/>Sync your .env files between machines, environments, and team members.<br/><a href="https://sync.dotenv.org">Join the early access list. 🕶</a>
</p>

<p align="center">
Also, we'd love to hear from you. <a href="https://join.slack.com/t/dotenv-org/shared_invite/zt-qsgpi6lu-qMsyASflKWQpa0Q651ceeg">Join the community on slack</a>, hang out with other cool devs, and talk tech.
</p>

# dotenv

<img src="https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.png" alt="dotenv" align="right" />
Expand All @@ -11,6 +19,7 @@ Dotenv is a zero-dependency module that loads environment variables from a `.env
[![Coverage Status](https://img.shields.io/coveralls/motdotla/dotenv/master.svg?style=flat-square)](https://coveralls.io/github/motdotla/dotenv?branch=coverall-intergration)
[![LICENSE](https://img.shields.io/github/license/motdotla/dotenv.svg)](LICENSE)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Rate on Openbase](https://badges.openbase.com/js/rating/dotenv.svg)](https://openbase.com/js/dotenv)

## Install

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -3,9 +3,9 @@
# Test against these versions of Node.js.
environment:
matrix:
- nodejs_version: "8"
- nodejs_version: "10"
- nodejs_version: "12"
- nodejs_version: "14"

# Install scripts. (runs after repo cloning)
install:
Expand Down
9 changes: 7 additions & 2 deletions lib/main.js
Expand Up @@ -23,6 +23,7 @@ type DotenvConfigOutput = {

const fs = require('fs')
const path = require('path')
const os = require('os')

function log (message /*: string */) {
console.log(`[dotenv][DEBUG] ${message}`)
Expand All @@ -31,7 +32,7 @@ function log (message /*: string */) {
const NEWLINE = '\n'
const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*(.*)?\s*$/
const RE_NEWLINES = /\\n/g
const NEWLINES_MATCH = /\n|\r|\r\n/
const NEWLINES_MATCH = /\r\n|\n|\r/

// Parses src into an Object
function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ {
Expand Down Expand Up @@ -96,6 +97,10 @@ function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */)
return obj
}

function resolveHome (envPath) {
return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
}

// Populates process.env from .env file
function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ {
let dotenvPath = path.resolve(process.cwd(), '.env')
Expand All @@ -105,7 +110,7 @@ function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */

if (options) {
if (options.path != null) {
dotenvPath = options.path
dotenvPath = resolveHome(options.path)
}
if (options.encoding != null) {
encoding = options.encoding
Expand Down

0 comments on commit 9b1d338

Please sign in to comment.