New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dotenvx/dotenvx

Package Overview
Dependencies
Maintainers
0
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dotenvx/dotenvx - npm Package Compare versions

Comparing version 1.11.5 to 1.12.0

6

CHANGELOG.md

@@ -5,4 +5,8 @@ # Changelog

## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.11.5...main)
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.12.0...main)
## 1.12.0
* add `dotenvx get --format shell` option ([#363](https://github.com/dotenvx/dotenvx/pull/363))
## 1.11.5

@@ -9,0 +13,0 @@

2

package.json
{
"version": "1.11.5",
"version": "1.12.0",
"name": "@dotenvx/dotenvx",

@@ -4,0 +4,0 @@ "description": "a better dotenv–from the creator of `dotenv`",

@@ -1045,2 +1045,27 @@ [![dotenvx](https://dotenvx.com/better-banner.png)](https://dotenvx.com)

</details>
* <details><summary>`get --format shell`</summary><br>
Return a shell formatted response of all key/value pairs in a `.env` file.
```sh
$ echo "HELLO=World\n" > .env
$ echo "KEY=value\n" >> .env
$ dotenvx get --format shell
HELLO="World" KEY="value"
```
This can be useful when combined with `env` on the command line.
```
$ env $(dotenvx get format --shell) your-command
```
or with `export`.
```
$ export $(dotenvx get format --shell) your-command
```
</details>
* <details><summary>`get --all`</summary><br>

@@ -1047,0 +1072,0 @@

@@ -23,17 +23,29 @@ const { logger } = require('./../../shared/logger')

const value = main.get(key, envs, options.overload, process.env.DOTENV_KEY, options.all)
const results = main.get(key, envs, options.overload, process.env.DOTENV_KEY, options.all)
if (typeof value === 'object' && value !== null) {
let space = 0
if (options.prettyPrint) {
space = 2
if (typeof results === 'object' && results !== null) {
// inline shell format - env $(dotenvx get --format shell) your-command
if (options.format === 'shell') {
let inline = ''
for (const [key, value] of Object.entries(results)) {
inline += `${key}="${value}" `
}
inline = inline.trim()
process.stdout.write(inline)
// json format
} else {
let space = 0
if (options.prettyPrint) {
space = 2
}
process.stdout.write(JSON.stringify(results, null, space))
}
process.stdout.write(JSON.stringify(value, null, space))
} else {
if (value === undefined) {
if (results === undefined) {
process.stdout.write('')
process.exit(1)
} else {
process.stdout.write(value)
process.stdout.write(results)
}

@@ -40,0 +52,0 @@ }

@@ -78,2 +78,3 @@ #!/usr/bin/env node

.option('-pp, --pretty-print', 'pretty print output')
.option('--format <type>', 'format of the output (json, shell)', 'json')
.action(function (...args) {

@@ -80,0 +81,0 @@ this.envs = envs

@@ -17,8 +17,2 @@ const fs = require('fs')

// Check if the file is entirely US-ASCII (0x00 - 0x7F), which is valid UTF-8
for (let i = 0; i < buffer.length; i++) {
if (buffer[i] > 0x7F) {
break
}
}
/* c8 ignore stop */

@@ -25,0 +19,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc