@dotenvx/dotenvx-ops 0.29.1 → 0.29.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,13 @@
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-ops/compare/v0.29.1...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.29.2...main)
6
+
7
+ ## [0.29.2](https://github.com/dotenvx/dotenvx-ops/compare/v0.29.1...v0.29.2) (2026-01-07)
8
+
9
+ ### Changed
10
+
11
+ * Write `.env.x` file as part of smooth onboarding
6
12
 
7
13
  ## [0.29.1](https://github.com/dotenvx/dotenvx-ops/compare/v0.29.0...v0.29.1) (2026-01-07)
8
14
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.29.1",
2
+ "version": "0.29.2",
3
3
  "name": "@dotenvx/dotenvx-ops",
4
4
  "description": "production grade dotenvx–with operational primitives",
5
5
  "author": "@motdotla",
@@ -1,4 +1,6 @@
1
+ const fs = require('fs')
1
2
  const open = require('open')
3
+
2
4
  const { logger } = require('@dotenvx/dotenvx')
3
5
 
4
6
  const { createSpinner } = require('./../../lib/helpers/createSpinner')
@@ -6,6 +8,7 @@ const clipboardy = require('./../../lib/helpers/clipboardy')
6
8
  const confirm = require('./../../lib/helpers/confirm')
7
9
  const formatCode = require('./../../lib/helpers/formatCode')
8
10
  const truncate = require('./../../lib/helpers/truncate')
11
+ const sha256File = require('./../../lib/helpers/sha256File')
9
12
 
10
13
  const LoggedIn = require('./../../lib/services/loggedIn')
11
14
  const Login = require('./../../lib/services/login')
@@ -55,14 +58,15 @@ async function backup () {
55
58
 
56
59
  const {
57
60
  projectUsernameName,
58
- files
61
+ projectEnvXSrc,
62
+ projectEnvXFileNeedsWrite
59
63
  } = await new Backup(hostname, options.org).run()
60
- logger.debug(`files: ${JSON.stringify(files)}`)
61
64
 
62
- // write output files
63
- // for (const file of files) {
64
- // // const { filepath, src, sha } = file
65
- // }
65
+ // write .env.x
66
+ if (projectEnvXFileNeedsWrite) {
67
+ logger.debug(`writing .env.x`)
68
+ fs.writeFileSync('.env.x', projectEnvXSrc, 'utf8')
69
+ }
66
70
 
67
71
  spinner.stop()
68
72
 
@@ -1,21 +1,16 @@
1
1
  const fs = require('fs')
2
- const crypto = require('crypto')
3
2
 
4
3
  const { logger } = require('@dotenvx/dotenvx')
5
4
 
6
5
  const { createSpinner } = require('./../../lib/helpers/createSpinner')
7
6
  const pluralize = require('./../../lib/helpers/pluralize')
7
+ const sha256File = require('./../../lib/helpers/sha256File')
8
8
 
9
9
  const Sync = require('./../../lib/services/sync')
10
10
  const SyncConflict = require('./../../lib/services/syncConflict')
11
11
 
12
12
  const spinner = createSpinner('syncing')
13
13
 
14
- function sha256File (filepath) {
15
- const buf = fs.readFileSync(filepath)
16
- return crypto.createHash('sha256').update(buf).digest('hex')
17
- }
18
-
19
14
  async function sync () {
20
15
  // debug opts
21
16
  const options = this.opts()
@@ -0,0 +1,9 @@
1
+ const fs = require('fs')
2
+ const crypto = require('crypto')
3
+
4
+ function sha256File (word, count) {
5
+ const buf = fs.readFileSync(filepath)
6
+ return crypto.createHash('sha256').update(buf).digest('hex')
7
+ }
8
+
9
+ module.exports = sha256File
@@ -26,6 +26,7 @@ class Backup {
26
26
  const token = sesh.token()
27
27
  const devicePublicKey = sesh.devicePublicKey()
28
28
  let _org = this.org
29
+ let projectEnvXFileNeedsWrite = false
29
30
 
30
31
  // required
31
32
  const files = this._files()
@@ -40,6 +41,8 @@ class Backup {
40
41
 
41
42
  // missing .env.x file
42
43
  if (!_dotenvxProjectId) {
44
+ projectEnvXFileNeedsWrite = true // for writing
45
+
43
46
  // set org
44
47
  if (!_org) {
45
48
  const choices = accountJson.organizations.map(o => ({
@@ -76,6 +79,8 @@ class Backup {
76
79
  id: data.id,
77
80
  dotenvxProjectId: data.dotenvx_project_id,
78
81
  projectUsernameName: data.project_username_name,
82
+ projectEnvXSrc: data.project_env_x_src,
83
+ projectEnvXFileNeedsWrite,
79
84
  files: data.files
80
85
  }
81
86
  }