diff --git a/package.json b/package.json index ba35509ca81bf..9cf24176443b1 100644 --- a/package.json +++ b/package.json @@ -1190,7 +1190,6 @@ "email-addresses": "^5.0.0", "eventsource-parser": "^3.0.0", "execa": "^5.1.1", - "expiry-js": "0.1.7", "exponential-backoff": "^3.1.1", "expr-eval": "^2.0.2", "extract-zip": "^2.0.1", diff --git a/renovate.json b/renovate.json index 2d11674325f1f..c4a8f49af9dc0 100644 --- a/renovate.json +++ b/renovate.json @@ -2796,25 +2796,6 @@ "minimumReleaseAge": "7 days", "enabled": true }, - { - "groupName": "expiry-js", - "matchDepNames": [ - "expiry-js" - ], - "reviewers": [ - "team:kibana-operations" - ], - "matchBaseBranches": [ - "main" - ], - "labels": [ - "Team:Operations", - "backport:all-open", - "release_note:skip" - ], - "minimumReleaseAge": "7 days", - "enabled": true - }, { "groupName": "globby", "matchDepNames": [ diff --git a/src/cli_plugin/install/settings.js b/src/cli_plugin/install/settings.js index 161f442669b65..782f737077d83 100644 --- a/src/cli_plugin/install/settings.js +++ b/src/cli_plugin/install/settings.js @@ -8,7 +8,6 @@ */ import { resolve } from 'path'; -import expiry from 'expiry-js'; import { fromRoot } from '@kbn/repo-info'; function generateUrls({ version, plugin }) { @@ -19,16 +18,37 @@ function generateUrls({ version, plugin }) { } export function parseMilliseconds(val) { - let result; - - try { - const timeVal = expiry(val); - result = timeVal.asMilliseconds(); - } catch (ex) { - result = 0; + if (typeof val === 'number') return val; + if (typeof val !== 'string') return 0; + const regex = /^(\d+)(ms|milliseconds?|s|seconds?|m|minutes?|h|hours?|d|days?)?$/; + const match = val.trim().match(regex); + if (!match) return 0; + const num = parseInt(match[1], 10); + const unit = match[2] || 'ms'; + switch (unit) { + case 'ms': + case 'millisecond': + case 'milliseconds': + return num; + case 's': + case 'second': + case 'seconds': + return num * 1000; + case 'm': + case 'minute': + case 'minutes': + return num * 60 * 1000; + case 'h': + case 'hour': + case 'hours': + return num * 60 * 60 * 1000; + case 'd': + case 'day': + case 'days': + return num * 24 * 60 * 60 * 1000; + default: + return num; } - - return result; } export function parse(command, options, kbnPackage) { diff --git a/yarn.lock b/yarn.lock index 8b1cc9e1c7a5a..6992a13c94402 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19325,11 +19325,6 @@ expect@^29.0.0, expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" -expiry-js@0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/expiry-js/-/expiry-js-0.1.7.tgz#76be8c05e572bf936df40c1766448d0b3b2f555f" - integrity sha1-dr6MBeVyv5Nt9AwXZkSNCzsvVV8= - exponential-backoff@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/exponential-backoff/-/exponential-backoff-3.1.1.tgz#64ac7526fe341ab18a39016cd22c787d01e00bf6"