@dotenvx/dotenvx 1.73.0 → 1.74.1

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,25 @@
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.73.0...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.74.1...main)
6
+
7
+ ## [1.74.1](https://github.com/dotenvx/dotenvx/compare/v1.74.0...v1.74.1) (2026-06-18)
8
+
9
+ ### Added
10
+
11
+ * Add README for `@dotenvx/next-env` ([#843](https://github.com/dotenvx/dotenvx/pull/843))
12
+
13
+ ## [1.74.0](https://github.com/dotenvx/dotenvx/compare/v1.73.1...v1.74.0) (2026-06-18)
14
+
15
+ ### Added
16
+
17
+ * Additionally publish [`@dotenvx/next-env`](https://www.npmjs.com/package/@dotenvx/next-env) override ([#841](https://github.com/dotenvx/dotenvx/pull/841))
18
+
19
+ ## [1.73.1](https://github.com/dotenvx/dotenvx/compare/v1.73.0...v1.73.1) (2026-06-16)
20
+
21
+ ### Changed
22
+
23
+ * Give update available notification only for armor commands ([#840](https://github.com/dotenvx/dotenvx/pull/840))
6
24
 
7
25
  ## [1.73.0](https://github.com/dotenvx/dotenvx/compare/v1.72.0...v1.73.0) (2026-06-16)
8
26
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.73.0",
2
+ "version": "1.74.1",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a secure dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -18,7 +18,6 @@ async function login () {
18
18
  logger.debug(`options: ${JSON.stringify(options)}`)
19
19
 
20
20
  const sesh = new Session()
21
- await sesh.notifyUpdate()
22
21
  const hostname = options.hostname || sesh.hostname()
23
22
  let cleanupOpenKeyListener = () => {}
24
23
 
@@ -1,5 +1,5 @@
1
- const Session = require('./../../db/session')
2
1
  const executeDynamic = require('./../../lib/helpers/executeDynamic')
2
+ const Session = require('./../../db/session')
3
3
 
4
4
  function configureArmorCommand (armor) {
5
5
  armor
package/src/db/session.js CHANGED
@@ -5,15 +5,46 @@ const dotenv = require('dotenv')
5
5
  const envPaths = require('env-paths')
6
6
 
7
7
  const jsonToEnv = require('./../lib/helpers/jsonToEnv')
8
+ const packageJson = require('./../lib/helpers/packageJson')
9
+ const { http } = require('./../lib/helpers/http')
8
10
  const { logger } = require('./../shared/logger')
9
11
 
12
+ const HOURS_24 = 60 * 60 * 24 * 1000
13
+ const VERSION_URL = 'https://dotenvx.sh/VERSION'
14
+
10
15
  const ARMOR = {
11
16
  HOSTNAME: 'DOTENVX_ARMOR_HOSTNAME',
12
17
  USER: 'DOTENVX_ARMOR_USER',
13
18
  USERNAME: 'DOTENVX_ARMOR_USERNAME',
14
- TOKEN: 'DOTENVX_ARMOR_TOKEN',
15
- VERSION: 'DOTENVX_ARMOR_VERSION',
16
- VERSION_LAST_CHECK: 'DOTENVX_ARMOR_VERSION_LAST_CHECK'
19
+ TOKEN: 'DOTENVX_ARMOR_TOKEN'
20
+ }
21
+
22
+ const DOTENVX = {
23
+ VERSION: 'DOTENVX_VERSION',
24
+ VERSION_LAST_CHECK: 'DOTENVX_VERSION_LAST_CHECK'
25
+ }
26
+
27
+ function normalizeVersion (version) {
28
+ return String(version || '').trim().replace(/^v/, '')
29
+ }
30
+
31
+ function parseVersion (version) {
32
+ return normalizeVersion(version).split('.').map(part => Number.parseInt(part, 10) || 0)
33
+ }
34
+
35
+ function versionGreaterThan (left, right) {
36
+ const leftParts = parseVersion(left)
37
+ const rightParts = parseVersion(right)
38
+
39
+ for (let i = 0; i < Math.max(leftParts.length, rightParts.length); i++) {
40
+ const leftPart = leftParts[i] || 0
41
+ const rightPart = rightParts[i] || 0
42
+
43
+ if (leftPart > rightPart) return true
44
+ if (leftPart < rightPart) return false
45
+ }
46
+
47
+ return false
17
48
  }
18
49
 
19
50
  class Session {
@@ -88,6 +119,13 @@ class Session {
88
119
  return store.get(ARMOR[key])
89
120
  }
90
121
 
122
+ readDotenvxSetting (key) {
123
+ const store = this.openStore()
124
+ if (!store) return undefined
125
+
126
+ return store.get(DOTENVX[key])
127
+ }
128
+
91
129
  hostname () {
92
130
  return this.readSetting('HOSTNAME') || 'https://armor.dotenvx.com'
93
131
  }
@@ -121,8 +159,41 @@ class Session {
121
159
  }
122
160
  }
123
161
 
162
+ //
163
+ // Notify Update
164
+ //
124
165
  async notifyUpdate () {
125
- // native login keeps this lightweight; sidecar commands still handle full update messaging
166
+ try {
167
+ const store = this.openStore()
168
+ if (!store) return
169
+
170
+ logger.debug('checking if update available')
171
+
172
+ const lastCheck = Number(this.readDotenvxSetting('VERSION_LAST_CHECK') || 0)
173
+ const now = Date.now()
174
+
175
+ if ((lastCheck + HOURS_24) >= now) return
176
+
177
+ let remote = packageJson.version
178
+
179
+ try {
180
+ logger.debug('fetching latest available dotenvx version')
181
+ const response = await http(VERSION_URL)
182
+ remote = normalizeVersion(await response.body.text())
183
+ logger.debug(`latest dotenvx version: ${remote}`)
184
+ store.set(DOTENVX.VERSION, remote)
185
+ } catch (error) {
186
+ logger.debug(error.message)
187
+ }
188
+
189
+ store.set(DOTENVX.VERSION_LAST_CHECK, now)
190
+
191
+ if (versionGreaterThan(remote, packageJson.version)) {
192
+ console.error('⛆ update available [npm install @dotenvx/dotenvx@latest]')
193
+ }
194
+ } catch (error) {
195
+ logger.debug(error.message)
196
+ }
126
197
  }
127
198
 
128
199
  //
@@ -199,8 +270,8 @@ class Session {
199
270
  store.delete(ARMOR.USERNAME)
200
271
  store.delete(ARMOR.TOKEN)
201
272
  store.delete(ARMOR.HOSTNAME)
202
- store.delete(ARMOR.VERSION)
203
- store.delete(ARMOR.VERSION_LAST_CHECK)
273
+ store.delete(DOTENVX.VERSION)
274
+ store.delete(DOTENVX.VERSION_LAST_CHECK)
204
275
  return true
205
276
  }
206
277
  }
@@ -17,6 +17,7 @@ class LoginPoll {
17
17
 
18
18
  if (data.access_token) {
19
19
  sesh.login(this.hostname, data.id, data.username, data.access_token)
20
+ await sesh.notifyUpdate()
20
21
  return data
21
22
  }
22
23