@dotenvx/dotenvx 1.73.0 → 1.73.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 +7 -1
- package/package.json +1 -1
- package/src/cli/actions/login.js +0 -1
- package/src/cli/commands/armor.js +1 -1
- package/src/db/session.js +77 -6
- package/src/lib/services/loginPoll.js +1 -0
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/compare/v1.73.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.73.1...main)
|
|
6
|
+
|
|
7
|
+
## [1.73.1](https://github.com/dotenvx/dotenvx/compare/v1.73.0...v1.73.1) (2026-06-16)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Give update available notification only for armor commands ([#840](https://github.com/dotenvx/dotenvx/pull/840))
|
|
6
12
|
|
|
7
13
|
## [1.73.0](https://github.com/dotenvx/dotenvx/compare/v1.72.0...v1.73.0) (2026-06-16)
|
|
8
14
|
|
package/package.json
CHANGED
package/src/cli/actions/login.js
CHANGED
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
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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(
|
|
203
|
-
store.delete(
|
|
273
|
+
store.delete(DOTENVX.VERSION)
|
|
274
|
+
store.delete(DOTENVX.VERSION_LAST_CHECK)
|
|
204
275
|
return true
|
|
205
276
|
}
|
|
206
277
|
}
|