@directus/update-check
Advanced tools
Comparing version 11.0.2 to 11.0.3
import boxen, {} from 'boxen'; | ||
import chalk from 'chalk'; | ||
import findCacheDirectory from 'find-cache-dir'; | ||
import { fetchBuilder, FileSystemCache } from 'node-fetch-cache'; | ||
import got from 'got'; | ||
import { gte, prerelease } from 'semver'; | ||
const cacheDirectory = findCacheDirectory({ name: 'directus' }); | ||
const fetch = fetchBuilder.withCache(new FileSystemCache({ ttl: 60 * 60, ...(cacheDirectory && { cacheDirectory }) })); | ||
import { getCache } from './cache.js'; | ||
const cache = await getCache(); | ||
export async function updateCheck(currentVersion) { | ||
let packageManifest = undefined; | ||
let packageManifest; | ||
try { | ||
const response = await fetch('https://registry.npmjs.org/directus', { | ||
packageManifest = await got('https://registry.npmjs.org/directus', { | ||
headers: { accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' }, | ||
}); | ||
if (!response.ok) { | ||
response.ejectFromCache(); | ||
return; | ||
} | ||
packageManifest = await response.json(); | ||
cache, | ||
retry: { | ||
limit: 0, | ||
}, | ||
timeout: { | ||
request: 8000, | ||
}, | ||
}).json(); | ||
} | ||
catch (error) { | ||
// Ignore | ||
// Any errors are intentionally ignored & update message simply not printed | ||
return; | ||
} | ||
@@ -23,0 +25,0 @@ if (!packageManifest) { |
{ | ||
"name": "@directus/update-check", | ||
"version": "11.0.2", | ||
"description": "Check if an update is available for a given package", | ||
"version": "11.0.3", | ||
"description": "Check if an update for Directus is available", | ||
"homepage": "https://directus.io", | ||
@@ -24,14 +24,18 @@ "repository": { | ||
"dependencies": { | ||
"boxen": "7.1.0", | ||
"chalk": "5.2.0", | ||
"find-cache-dir": "4.0.0", | ||
"node-fetch-cache": "3.1.3", | ||
"semver": "7.5.1" | ||
"boxen": "7.1.1", | ||
"chalk": "5.3.0", | ||
"filenamify": "6.0.0", | ||
"find-cache-dir": "5.0.0", | ||
"got": "13.0.0", | ||
"semver": "7.5.4" | ||
}, | ||
"devDependencies": { | ||
"@npm/types": "1.0.2", | ||
"@types/find-cache-dir": "3.2.1", | ||
"@types/node-fetch-cache": "3.0.0", | ||
"@types/semver": "7.5.0", | ||
"@types/node": "18.16.12", | ||
"@types/semver": "7.5.1", | ||
"@vitest/coverage-c8": "0.31.1", | ||
"keyv": "4.5.2", | ||
"strip-ansi": "7.1.0", | ||
"typescript": "5.0.4", | ||
"vitest": "0.31.1", | ||
"@directus/tsconfig": "1.0.0" | ||
@@ -41,4 +45,5 @@ }, | ||
"build": "tsc --project tsconfig.prod.json", | ||
"dev": "tsc --watch" | ||
"dev": "tsc --watch", | ||
"test": "vitest --watch=false" | ||
} | ||
} |
# `@directus/update-check` | ||
Check if an update is available for a given package | ||
Check if an update for Directus is available | ||
## Description | ||
This package is a utility to determine if there is an update available for a given package. | ||
This package is a utility to determine if there is an update available for Directus. | ||
@@ -9,0 +9,0 @@ For more information about Directus, visit the [official website](https://directus.io). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
6867
7
127
0
6
9
+ Addedfilenamify@6.0.0
+ Addedgot@13.0.0
+ Added@sindresorhus/is@5.6.0(transitive)
+ Added@szmarczak/http-timer@5.0.1(transitive)
+ Added@types/http-cache-semantics@4.0.4(transitive)
+ Addedboxen@7.1.1(transitive)
+ Addedcacheable-lookup@7.0.0(transitive)
+ Addedcacheable-request@10.2.14(transitive)
+ Addedchalk@5.3.0(transitive)
+ Addeddecompress-response@6.0.0(transitive)
+ Addeddefer-to-connect@2.0.1(transitive)
+ Addedfilename-reserved-regex@3.0.0(transitive)
+ Addedfilenamify@6.0.0(transitive)
+ Addedfind-cache-dir@5.0.0(transitive)
+ Addedform-data-encoder@2.1.4(transitive)
+ Addedget-stream@6.0.1(transitive)
+ Addedgot@13.0.0(transitive)
+ Addedhttp-cache-semantics@4.1.1(transitive)
+ Addedhttp2-wrapper@2.2.1(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedlowercase-keys@3.0.0(transitive)
+ Addedmimic-response@3.1.04.0.0(transitive)
+ Addednormalize-url@8.0.1(transitive)
+ Addedp-cancelable@3.0.0(transitive)
+ Addedquick-lru@5.1.1(transitive)
+ Addedresolve-alpn@1.2.1(transitive)
+ Addedresponselike@3.0.0(transitive)
+ Addedsemver@7.5.4(transitive)
- Removednode-fetch-cache@3.1.3
- Removed@gar/promisify@1.1.3(transitive)
- Removed@npmcli/fs@1.1.1(transitive)
- Removed@npmcli/move-file@1.1.2(transitive)
- Removedaggregate-error@3.1.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedboxen@7.1.0(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedcacache@15.3.0(transitive)
- Removedchalk@5.2.0(transitive)
- Removedchownr@2.0.0(transitive)
- Removedclean-stack@2.2.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedfind-cache-dir@4.0.0(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedimurmurhash@0.1.4(transitive)
- Removedindent-string@4.0.0(transitive)
- Removedinfer-owner@1.0.4(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedlocko@1.1.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminipass-collect@1.0.2(transitive)
- Removedminipass-flush@1.0.5(transitive)
- Removedminipass-pipeline@1.2.4(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removednode-fetch@2.6.11(transitive)
- Removednode-fetch-cache@3.1.3(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-map@4.0.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpromise-inflight@1.0.1(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedsemver@7.5.1(transitive)
- Removedssri@8.0.1(transitive)
- Removedtar@6.2.1(transitive)
- Removedtr46@0.0.3(transitive)
- Removedunique-filename@1.1.1(transitive)
- Removedunique-slug@2.0.2(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedboxen@7.1.1
Updatedchalk@5.3.0
Updatedfind-cache-dir@5.0.0
Updatedsemver@7.5.4