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
2
Versions
188
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.21.1 to 1.22.0

12

CHANGELOG.md

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

## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.21.1...main)
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.22.0...main)
## 1.22.0
### Added
* add `--pattern` argument to `ext gitignore` (`dotenvx ext gitignore --pattern .env.keys`) ([#430](https://github.com/dotenvx/dotenvx/pull/430))
### Changed
* clarify next steps after first time encrypting ([#430](https://github.com/dotenvx/dotenvx/pull/430))
## 1.21.1

@@ -9,0 +19,0 @@

2

package.json
{
"version": "1.21.1",
"version": "1.22.0",
"name": "@dotenvx/dotenvx",

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

@@ -1225,4 +1225,4 @@ [![dotenvx](https://dotenvx.com/better-banner.png)](https://dotenvx.com)

✔ key added to .env.keys (DOTENV_PRIVATE_KEY)
ℹ add .env.keys to .gitignore: [echo ".env.keys" >> .gitignore]
ℹ run [DOTENV_PRIVATE_KEY='122...0b8' dotenvx run -- yourcommand] to test decryption locally
⮕ next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys
⮕ next run [DOTENV_PRIVATE_KEY='122...0b8' dotenvx run -- yourcommand] to test decryption locally
```

@@ -1242,4 +1242,4 @@

✔ key added to .env.keys (DOTENV_PRIVATE_KEY_PRODUCTION)
ℹ add .env.keys to .gitignore: [echo ".env.keys" >> .gitignore]
ℹ run [DOTENV_PRIVATE_KEY_PRODUCTION='bff..bc4' dotenvx run -- yourcommand] to test decryption locally
⮕ next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys
⮕ next run [DOTENV_PRIVATE_KEY='bff...bc4' dotenvx run -- yourcommand] to test decryption locally
```

@@ -1246,0 +1246,0 @@

@@ -67,6 +67,6 @@ const fsx = require('./../../lib/helpers/fsx')

if (!isIgnoringDotenvKeys()) {
logger.help2('ℹ add .env.keys to .gitignore: [echo ".env.keys" >> .gitignore]')
logger.help('⮕ next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys')
}
logger.help2(`ℹ run [${processedEnv.privateKeyName}='${processedEnv.privateKey}' dotenvx run -- yourcommand] to test decryption locally`)
logger.help(`⮕ next run [${processedEnv.privateKeyName}='${processedEnv.privateKey}' dotenvx run -- yourcommand] to test decryption locally`)
}

@@ -73,0 +73,0 @@ }

const fsx = require('./../../../lib/helpers/fsx')
const FORMATS = ['.env*', '!.env.vault']
const DEFAULT_PATTERNS = ['.env*']
const { logger } = require('./../../../shared/logger')
class Generic {
constructor (filename, touchFile = false) {
constructor (filename, patterns = DEFAULT_PATTERNS, touchFile = false) {
this.filename = filename
this.formats = FORMATS
this.patterns = patterns
this.touchFile = touchFile

@@ -18,6 +18,5 @@ }

run () {
const changedPatterns = []
if (!fsx.existsSync(this.filename)) {
if (this.touchFile === true) {
logger.info(`creating ${this.filename}`)
if (this.touchFile === true && this.patterns.length > 0) {
fsx.writeFileX(this.filename, '')

@@ -30,9 +29,15 @@ } else {

const lines = fsx.readFileX(this.filename).split(/\r?\n/)
this.formats.forEach(format => {
if (!lines.includes(format.trim())) {
logger.info(`appending ${format} to ${this.filename}`)
this.patterns.forEach(pattern => {
if (!lines.includes(pattern.trim())) {
this.append(pattern)
this.append(format)
changedPatterns.push(pattern.trim())
}
})
if (changedPatterns.length > 0) {
logger.success(`✔ ignored ${this.patterns} (${this.filename})`)
} else {
logger.info(`no changes (${this.filename})`)
}
}

@@ -42,5 +47,9 @@ }

class Git {
constructor (patterns = DEFAULT_PATTERNS) {
this.patterns = patterns
}
run () {
logger.verbose('appending to .gitignore')
new Generic('.gitignore', true).run()
logger.verbose('add to .gitignore')
new Generic('.gitignore', this.patterns, true).run()
}

@@ -50,5 +59,9 @@ }

class Docker {
constructor (patterns = DEFAULT_PATTERNS) {
this.patterns = patterns
}
run () {
logger.verbose('appending to .dockerignore (if existing)')
new Generic('.dockerignore').run()
logger.verbose('add to .dockerignore (if exists)')
new Generic('.dockerignore', this.patterns).run()
}

@@ -58,5 +71,9 @@ }

class Npm {
constructor (patterns = DEFAULT_PATTERNS) {
this.patterns = patterns
}
run () {
logger.verbose('appending to .npmignore (if existing)')
new Generic('.npmignore').run()
logger.verbose('add to .npmignore (if existing)')
new Generic('.npmignore', this.patterns).run()
}

@@ -66,5 +83,9 @@ }

class Vercel {
constructor (patterns = DEFAULT_PATTERNS) {
this.patterns = patterns
}
run () {
logger.verbose('appending to .vercelignore (if existing)')
new Generic('.vercelignore').run()
logger.verbose('add to .vercelignore (if existing)')
new Generic('.vercelignore', this.patterns).run()
}

@@ -77,8 +98,8 @@ }

new Git().run()
new Docker().run()
new Npm().run()
new Vercel().run()
const patterns = options.pattern
logger.success('done')
new Git(patterns).run()
new Docker(patterns).run()
new Npm(patterns).run()
new Vercel(patterns).run()
}

@@ -85,0 +106,0 @@

@@ -71,6 +71,6 @@ const fsx = require('./../../lib/helpers/fsx')

if (!isIgnoringDotenvKeys()) {
logger.help2('ℹ add .env.keys to .gitignore: [echo ".env.keys" >> .gitignore]')
logger.help('⮕ next run [dotenvx ext gitignore --pattern .env.keys] to gitignore .env.keys')
}
logger.help2(`ℹ run [${processedEnv.privateKeyName}='${processedEnv.privateKey}' dotenvx get ${key}] to test decryption locally`)
logger.help(`⮕ next run [${processedEnv.privateKeyName}='${processedEnv.privateKey}' dotenvx get ${key}] to test decryption locally`)
}

@@ -77,0 +77,0 @@ }

@@ -43,2 +43,3 @@ const { Command } = require('commander')

.addHelpText('after', examples.gitignore)
.option('--pattern <patterns...>', 'pattern(s) to gitignore', ['.env*'])
.action(require('./../actions/ext/gitignore'))

@@ -45,0 +46,0 @@

@@ -66,2 +66,3 @@ const run = function () {

$ dotenvx ext gitignore
$ dotenvx ext gitignore --pattern .env.keys
\`\`\`

@@ -73,3 +74,3 @@

$ dotenvx ext gitignore
done
✔ ignored .env* (.gitignore)
\`\`\`

@@ -76,0 +77,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