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
189
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.14.0 to 1.14.1

8

CHANGELOG.md

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

## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.14.0...main)
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.14.1...main)
## 1.14.1
### Changed
* run precommit hook only on staged files ([#380](https://github.com/dotenvx/dotenvx/pull/380))
## 1.14.0

@@ -9,0 +15,0 @@

2

package.json
{
"version": "1.14.0",
"version": "1.14.1",
"name": "@dotenvx/dotenvx",

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

@@ -10,2 +10,3 @@ /* istanbul ignore file */

const InstallPrecommitHook = require('./../helpers/installPrecommitHook')
const childProcess = require('child_process')
const MISSING_GITIGNORE = '.env.keys' // by default only ignore .env.keys. all other .env* files COULD be included - as long as they are encrypted

@@ -48,19 +49,22 @@

dotenvFiles.forEach(file => {
// check if that file is being ignored
if (ig.ignores(file)) {
if (file === '.env.example' || file === '.env.vault') {
const warning = new Error(`${file} (currently ignored but should not be)`)
warning.help = `? add !${file} to .gitignore with [echo "!${file}" >> .gitignore]`
warnings.push(warning)
}
} else {
if (file !== '.env.example' && file !== '.env.vault') {
const src = fs.readFileSync(file).toString()
const encrypted = isFullyEncrypted(src)
// check if file is going to be commited
if (this._isFileToBeCommitted(file)) {
// check if that file is being ignored
if (ig.ignores(file)) {
if (file === '.env.example' || file === '.env.vault') {
const warning = new Error(`${file} (currently ignored but should not be)`)
warning.help = `? add !${file} to .gitignore with [echo "!${file}" >> .gitignore]`
warnings.push(warning)
}
} else {
if (file !== '.env.example' && file !== '.env.vault') {
const src = fs.readFileSync(file).toString()
const encrypted = isFullyEncrypted(src)
// if contents are encrypted don't raise an error
if (!encrypted) {
const error = new Error(`${file} not encrypted (or not gitignored)`)
error.help = `? encrypt it with [dotenvx encrypt -f ${file}] or add ${file} to .gitignore with [echo ".env*" >> .gitignore]`
throw error
// if contents are encrypted don't raise an error
if (!encrypted) {
const error = new Error(`${file} not encrypted (or not gitignored)`)
error.help = `? encrypt it with [dotenvx encrypt -f ${file}] or add ${file} to .gitignore with [echo ".env*" >> .gitignore]`
throw error
}
}

@@ -82,2 +86,14 @@ }

_isFileToBeCommitted (filePath) {
try {
const output = childProcess.execSync('git diff --cached --name-only').toString()
const files = output.split('\n')
return files.includes(filePath)
} catch (error) {
// consider file to be committed if there is an error (not using git)
return true
}
}
_installPrecommitHook () {

@@ -84,0 +100,0 @@ return new InstallPrecommitHook().run()

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