@dotenvx/dotenvx 1.10.0 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  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.
4
4
 
5
- ## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.10.0...main)
5
+ ## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.10.2...main)
6
+
7
+ ## 1.10.2
8
+
9
+ ### Changed
10
+
11
+ * default `config` to empty `[]` array so that `DOTENV_KEY_${environment}` looks up correctly ([#352](https://github.com/dotenvx/dotenvx/pull/352))
12
+
13
+ ## 1.10.1
14
+
15
+ ### Changed
16
+
17
+ * check subfolders on `dotenvx ext precommit` hook ([#350](https://github.com/dotenvx/dotenvx/pull/350))
6
18
 
7
19
  ## 1.10.0
8
20
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.10.0",
2
+ "version": "1.10.2",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -37,7 +37,6 @@
37
37
  "funding": "https://dotenvx.com",
38
38
  "dependencies": {
39
39
  "commander": "^11.1.0",
40
- "diff": "^5.2.0",
41
40
  "dotenv": "^16.4.5",
42
41
  "eciesjs": "^0.4.6",
43
42
  "fdir": "^6.2.0",
@@ -1,7 +1,7 @@
1
1
  const resolveHome = require('./resolveHome')
2
2
 
3
3
  function dotenvOptionPaths (options) {
4
- let optionPaths = ['.env']
4
+ let optionPaths = []
5
5
 
6
6
  if (options && options.path) {
7
7
  if (!Array.isArray(options.path)) {
package/src/lib/main.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { URL } from 'url';
2
- import type { Change } from 'diff';
3
2
 
4
3
  export interface DotenvParseOutput {
5
4
  [name: string]: string;
@@ -66,7 +65,7 @@ export interface DotenvConfigOptions {
66
65
  DOTENV_KEY?: string;
67
66
 
68
67
  /**
69
- * Do not warn for missing .env files
68
+ * Load a .env convention (available conventions: 'nextjs')
70
69
  */
71
70
  convention?: string;
72
71
 
@@ -235,28 +234,6 @@ export function set(
235
234
  encrypt?: boolean
236
235
  ): EncryptOutput;
237
236
 
238
- type StatusRow = {
239
- filename: string;
240
- filepath: string;
241
- environment: string;
242
- raw: string;
243
- decrypted: any;
244
- differences: Change[];
245
- };
246
-
247
- export type StatusOutput = {
248
- changes: StatusRow[];
249
- nochanges: StatusRow[];
250
- untracked: StatusRow[];
251
- };
252
-
253
- /**
254
- * Check the differences between the .env file and the decrypted values
255
- *
256
- * @param directory - current working directory
257
- */
258
- export function status(directory: string): StatusOutput;
259
-
260
237
  export type GenExampleOutput = {
261
238
  envExampleFile: string;
262
239
  envFile: string | string[];
package/src/lib/main.js CHANGED
@@ -13,6 +13,7 @@ const Decrypt = require('./services/decrypt')
13
13
  const Genexample = require('./services/genexample')
14
14
 
15
15
  // helpers
16
+ const conventions = require('./helpers/conventions')
16
17
  const dotenvOptionPaths = require('./helpers/dotenvOptionPaths')
17
18
  const { setLogLevel } = require('../shared/logger')
18
19
 
@@ -41,7 +42,18 @@ const config = function (options = {}) {
41
42
  const optionPaths = dotenvOptionPaths(options) // [ '.env' ]
42
43
 
43
44
  try {
44
- const envs = []
45
+ let envs = []
46
+ // handle shorthand conventions - like --convention=nextjs
47
+ if (options.convention) {
48
+ envs = conventions(options.convention).concat(envs)
49
+ }
50
+
51
+ if (process.env.DOTENV_KEY) {
52
+ logger.warn('DEPRECATION NOTICE: Setting DOTENV_KEY with .env.vault is deprecated.')
53
+ logger.warn('DEPRECATION NOTICE: Run [dotenvx ext vault migrate] for instructions on converting your .env.vault file to encrypted .env files (using public key encryption algorithm secp256k1)')
54
+ logger.warn('DEPRECATION NOTICE: Read more at [https://github.com/dotenvx/dotenvx/blob/main/CHANGELOG.md#0380]')
55
+ }
56
+
45
57
  for (const optionPath of optionPaths) {
46
58
  // if DOTENV_KEY is set then assume we are checking envVaultFile
47
59
  if (DOTENV_KEY) {
@@ -2,6 +2,8 @@
2
2
  const fs = require('fs')
3
3
  const ignore = require('ignore')
4
4
 
5
+ const Ls = require('../services/ls')
6
+
5
7
  const pluralize = require('./../helpers/pluralize')
6
8
  const isFullyEncrypted = require('./../helpers/isFullyEncrypted')
7
9
  const InstallPrecommitHook = require('./../helpers/installPrecommitHook')
@@ -38,8 +40,8 @@ class Precommit {
38
40
 
39
41
  // 2. check .env* files against .gitignore file
40
42
  const ig = ignore().add(gitignore)
41
- const files = fs.readdirSync(process.cwd())
42
- const dotenvFiles = files.filter(file => file.match(/^\.env(\..+)?$/))
43
+ const lsService = new Ls(process.cwd())
44
+ const dotenvFiles = lsService.run()
43
45
  dotenvFiles.forEach(file => {
44
46
  // check if that file is being ignored
45
47
  if (ig.ignores(file)) {