MCPcopy
hub / github.com/dotenvx/dotenvx / notifyUpdate

Method notifyUpdate

src/db/session.js:165–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

163 // Notify Update
164 //
165 async notifyUpdate () {
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 }
197 }
198
199 //
200 // armor status helpers

Callers 8

pollMethod · 0.95
moveFunction · 0.95
upFunction · 0.95
pullFunction · 0.95
downFunction · 0.95
pushFunction · 0.95
configureArmorCommandFunction · 0.95
session.test.jsFile · 0.80

Calls 6

openStoreMethod · 0.95
readDotenvxSettingMethod · 0.95
httpFunction · 0.85
normalizeVersionFunction · 0.85
versionGreaterThanFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected