@supacortex/cli 0.1.1 → 0.1.3
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/dist/index.js +10 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -344,10 +344,19 @@ var registerUpdateCommand = (program2, version) => {
|
|
|
344
344
|
// src/lib/update-notifier.ts
|
|
345
345
|
var NPM_REGISTRY_URL2 = "https://registry.npmjs.org/@supacortex/cli/latest";
|
|
346
346
|
var CHECK_INTERVAL = 24 * 60 * 60 * 1e3;
|
|
347
|
+
var isNewer = (latest, current) => {
|
|
348
|
+
const l = latest.split(".").map(Number);
|
|
349
|
+
const c = current.split(".").map(Number);
|
|
350
|
+
for (let i = 0; i < 3; i++) {
|
|
351
|
+
if (l[i] > c[i]) return true;
|
|
352
|
+
if (l[i] < c[i]) return false;
|
|
353
|
+
}
|
|
354
|
+
return false;
|
|
355
|
+
};
|
|
347
356
|
var checkForUpdates = (currentVersion) => {
|
|
348
357
|
const config = getConfig();
|
|
349
358
|
const now = Date.now();
|
|
350
|
-
if (config.latestVersion && config.latestVersion
|
|
359
|
+
if (config.latestVersion && isNewer(config.latestVersion, currentVersion)) {
|
|
351
360
|
process.on("exit", () => {
|
|
352
361
|
console.log();
|
|
353
362
|
console.log(` Update available: ${currentVersion} \u2192 ${config.latestVersion}`);
|