@dotenvx/dotenvx 0.33.0 → 0.34.0

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/README.md CHANGED
@@ -84,6 +84,32 @@ More examples
84
84
 
85
85
  </details>
86
86
 
87
+ * <details><summary>Deno 🦕</summary><br>
88
+
89
+ ```sh
90
+ $ echo "HELLO=World" > .env
91
+ $ echo "console.log('Hello ' + Deno.env.get('HELLO'))" > index.ts
92
+
93
+ $ deno run --allow-env index.ts
94
+ Hello undefined
95
+
96
+ $ dotenvx run -- deno run --allow-env index.ts
97
+ Hello World
98
+ ```
99
+
100
+ * <details><summary>Bun 🥟</summary><br>
101
+
102
+ ```sh
103
+ $ echo "HELLO=Test" > .env.test
104
+ $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
105
+
106
+ $ bun index.js
107
+ Hello undefined
108
+
109
+ $ dotenvx run -f .env.test -- bun index.js
110
+ Hello Test
111
+ ```
112
+
87
113
  * <details><summary>Python 🐍</summary><br>
88
114
 
89
115
  ```sh
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.33.0",
2
+ "version": "0.34.0",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -12,6 +12,7 @@ const gitUrl = require('./../../../lib/helpers/gitUrl')
12
12
  const gitRoot = require('./../../../lib/helpers/gitRoot')
13
13
  const extractUsernameName = require('./../../../lib/helpers/extractUsernameName')
14
14
  const sleep = require('./../../../lib/helpers/sleep')
15
+ const forgivingDirectory = require('./../../../lib/helpers/forgivingDirectory')
15
16
 
16
17
  const spinner = createSpinner('pushing')
17
18
 
@@ -23,6 +24,8 @@ async function push (directory) {
23
24
  spinner.start()
24
25
  await sleep(500) // better dx
25
26
 
27
+ directory = forgivingDirectory(directory)
28
+
26
29
  // debug args
27
30
  logger.debug(`directory: ${directory}`)
28
31
 
@@ -0,0 +1,11 @@
1
+ const path = require('path')
2
+
3
+ function forgivingDirectory (pathString) {
4
+ if (pathString.endsWith('.env.keys')) {
5
+ return path.dirname(pathString)
6
+ }
7
+
8
+ return pathString
9
+ }
10
+
11
+ module.exports = forgivingDirectory
@@ -4,7 +4,7 @@ function inject (processEnv = {}, parsed = {}, overload = false) {
4
4
 
5
5
  // set processEnv
6
6
  for (const key of Object.keys(parsed)) {
7
- if (processEnv[key]) {
7
+ if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
8
8
  if (overload === true) {
9
9
  processEnv[key] = parsed[key]
10
10
 
@@ -51,7 +51,7 @@ class Genexample {
51
51
  const exampleFilename = '.env.example'
52
52
  const exampleFilepath = path.resolve(this.directory, exampleFilename)
53
53
  if (!fs.existsSync(exampleFilepath)) {
54
- envExampleFile += `# ${exampleFilename}\n`
54
+ envExampleFile += `# ${exampleFilename} - generated with dotenvx\n`
55
55
  } else {
56
56
  envExampleFile = fs.readFileSync(exampleFilepath, ENCODING)
57
57
  }