Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: motdotla/dotenv
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v8.0.0
Choose a base ref
...
head repository: motdotla/dotenv
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v8.1.0
Choose a head ref
  • 4 commits
  • 9 files changed
  • 3 contributors

Commits on May 2, 2019

  1. chore(release): 8.0.0

    maxbeatty committed May 2, 2019

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    eba176b View commit details

Commits on Aug 15, 2019

  1. Parse \r and \r\n line endings (#414)

    * replace all EOLs to standard Unix EOL
    
    * Tests all three types of EOL
    AlexanderGranhof authored and maxbeatty committed Aug 15, 2019
    2

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    52fe318 View commit details

Commits on Aug 18, 2019

  1. Upgrade dependencies (#416)

    * chore: upgrade dependencies
    
    * chore: enable Node 12 on AppVeyor
    
    * chore: trust windows on travis
    maxbeatty authored Aug 18, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e4aa64d View commit details
  2. chore(release): 8.1.0

    maxbeatty committed Aug 18, 2019
    2

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    349ff7b View commit details
Showing with 4,843 additions and 4,978 deletions.
  1. +1 −1 .flowconfig
  2. +0 −3 .travis.yml
  3. +36 −11 CHANGELOG.md
  4. +1 −1 README.md
  5. +1 −0 appveyor.yml
  6. +3 −2 lib/main.js
  7. +4,781 −4,951 package-lock.json
  8. +8 −8 package.json
  9. +12 −1 tests/test-parse.js
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
@@ -20,4 +20,4 @@ untyped-import
untyped-type-import

[version]
^0.92.1
^0.105.2
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -9,14 +9,11 @@ os:
node_js:
- "8"
- "10"
- "11"
- "12"

cache: npm

matrix:
fast_finish: true
allow_failures:
- os: windows

after_success: if [[ "$TRAVIS_OS_NAME" != 'windows' ]]; then npm run flow; fi
47 changes: 36 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
# Changelog

## [Unreleased]
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.

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


### ⚠ BREAKING CHANGES

* dropping Node v6 support because end-of-life

* Drop support for Node v6 (#392) ([2e9636a](https://github.com/motdotla/dotenv/commit/2e9636a)), closes [#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

- dropping Node v6 support because end-of-life

## [7.0.0] - 2019-03-12

@@ -30,7 +45,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- *Breaking:* drop support for Node v4 ([#304](https://github.com/motdotla/dotenv/pull/304))
- _Breaking:_ drop support for Node v4 ([#304](https://github.com/motdotla/dotenv/pull/304))

## [5.0.0] - 2018-01-29

@@ -42,27 +57,26 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- *Breaking*: default `path` is now `path.resolve(process.cwd(), '.env')`
- *Breaking*: does not write over keys already in `process.env` if the key has a falsy value
- _Breaking_: default `path` is now `path.resolve(process.cwd(), '.env')`
- _Breaking_: does not write over keys already in `process.env` if the key has a falsy value
- using `const` and `let` instead of `var`

### Removed

- Testing against Node v7


## [4.0.0] - 2016-12-23

### Changed

- Return Object with parsed content or error instead of false ([#165](https://github.com/motdotla/dotenv/pull/165)).


### Removed

- `verbose` option removed in favor of returning result.


## [3.0.0] - 2016-12-20

### Added

- `verbose` option will log any error messages. Off by default.
@@ -83,38 +97,49 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- `silent` option removed in favor of `verbose`

## [2.0.0] - 2016-01-20

### Added

- CHANGELOG to ["make it easier for users and contributors to see precisely what notable changes have been made between each release"](http://keepachangelog.com/). Linked to from README
- LICENSE to be more explicit about what was defined in `package.json`. Linked to from README
- Testing nodejs v4 on travis-ci
- added examples of how to use dotenv in different ways
- return parsed object on success rather than boolean true

### Changed

- README has shorter description not referencing ruby gem since we don't have or want feature parity

### Removed

- Variable expansion and escaping so environment variables are encouraged to be fully orthogonal

## [1.2.0] - 2015-06-20

### Added

- Preload hook to require dotenv without including it in your code

### Changed

- clarified license to be "BSD-2-Clause" in `package.json`

### Fixed

- retain spaces in string vars

## [1.1.0] - 2015-03-31

### Added

- Silent option to silence `console.log` when `.env` missing

## [1.0.0] - 2015-03-13

### Removed

- support for multiple `.env` files. should always use one `.env` file for the current environment

[Unreleased]: https://github.com/motdotla/dotenv/compare/v7.0.0...HEAD
[7.0.0]: https://github.com/motdotla/dotenv/compare/v6.2.0...v7.0.0
[6.2.0]: https://github.com/motdotla/dotenv/compare/v6.1.0...v6.2.0
[6.1.0]: https://github.com/motdotla/dotenv/compare/v6.0.0...v6.1.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -200,7 +200,7 @@ If you want to override `process.env` you can do something like this:
const fs = require('fs')
const dotenv = require('dotenv')
const envConfig = dotenv.parse(fs.readFileSync('.env.override'))
for (let k in envConfig) {
for (const k in envConfig) {
process.env[k] = envConfig[k]
}
```
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ environment:
matrix:
- nodejs_version: "8"
- nodejs_version: "10"
- nodejs_version: "12"

# Install scripts. (runs after repo cloning)
install:
5 changes: 3 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -31,14 +31,15 @@ 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/

// Parses src into an Object
function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ {
const debug = Boolean(options && options.debug)
const obj = {}

// convert Buffers before splitting into lines and processing
src.toString().split(NEWLINE).forEach(function (line, idx) {
src.toString().split(NEWLINES_MATCH).forEach(function (line, idx) {
// matching "KEY' and 'VAL' in 'KEY=VAL'
const keyValueArr = line.match(RE_INI_KEY_VAL)
// matched?
@@ -95,7 +96,7 @@ function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */
const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug })

Object.keys(parsed).forEach(function (key) {
if (!process.env.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
process.env[key] = parsed[key]
} else if (debug) {
log(`"${key}" is already defined in \`process.env\` and will not be overwritten`)
Loading