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: acadevmy/dotenv2shell
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.0
Choose a base ref
...
head repository: acadevmy/dotenv2shell
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.1
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Jun 5, 2024

  1. fix: enforce DOTENV_KEY and cwd from process

    KernelPanic92 committed Jun 5, 2024
    Copy the full SHA
    f172e4a View commit details
  2. chore(release): 1.0.1 [skip ci]

    ## [1.0.1](v1.0.0...v1.0.1) (2024-06-05)
    
    ### Bug Fixes
    
    * enforce DOTENV_KEY and cwd from process ([f172e4a](f172e4a))
    semantic-release-bot committed Jun 5, 2024
    Copy the full SHA
    a152f45 View commit details
Showing with 16 additions and 8 deletions.
  1. +7 −0 CHANGELOG.md
  2. +1 −1 package.json
  3. +8 −7 src/index.ts
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.0.1](https://github.com/acadevmy/dotenv2shell/compare/v1.0.0...v1.0.1) (2024-06-05)


### Bug Fixes

* enforce DOTENV_KEY and cwd from process ([f172e4a](https://github.com/acadevmy/dotenv2shell/commit/f172e4a056a07b9066707308e6d56c37b4b3f4f5))

# 1.0.0 (2024-06-04)


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devmy/dotenv2shell",
"version": "1.0.0",
"version": "1.0.1",
"description": "A CLI lets you easily load environment variables from a `.env` file into your current shell session. It provides flexibility through various options and supports both zsh and bash.",
"main": "bin/index.mjs",
"bin": "bin/index.mjs",
15 changes: 8 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -42,16 +42,17 @@ const dotenvRun = env({
files: argv.files,
dotenv: {
override: argv.override,
DOTENV_KEY: argv.dotenv_key,
DOTENV_KEY: argv.dotenv_key ?? process.env['DOTENV_KEY'],
},
});

const exportStatements = Object.entries(dotenvRun.raw)
.map(([key, value]) => {
value = JSON.stringify(value).replaceAll(/\r\n|\r|\n/g, '\n');
const exportStatements =
Object.entries(dotenvRun.raw)
.map(([key, value]) => {
value = JSON.stringify(value).replaceAll(/\r\n|\r|\n/g, '\n');

return `export ${key}=${value}`;
})
.join('\n');
return `export ${key}=${value}`;
})
.join('\n') + '\n';

process.stdout.write(exportStatements);