1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Pass updateChecker for LensExtension instances

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-01-25 13:45:11 +03:00
parent e69b8375c5
commit f8476cff0b
4 changed files with 6 additions and 5 deletions

View File

@ -50,7 +50,7 @@
"bundledKubectlVersion": "1.21.2", "bundledKubectlVersion": "1.21.2",
"bundledHelmVersion": "3.6.3", "bundledHelmVersion": "3.6.3",
"sentryDsn": "", "sentryDsn": "",
"extensionUpdateUrl": "https://lens-binaries.s3-eu-west-1.amazonaws.com/extensions/versions.json" "extensionUpdateUrl": "https://lens-binaries.s3-eu-west-1.amazonaws.com/extensions"
}, },
"engines": { "engines": {
"node": ">=14 <15" "node": ">=14 <15"

View File

@ -26,7 +26,7 @@ export class BundledVersionChecker implements LensExtensionLatestVersionChecker
return null; return null;
} }
const json = await this.getJson(extensionUpdateUrl); const json = await this.getJson(`${extensionUpdateUrl}/versions.json`);
if (!json || json.error || !json[manifest.name]) { if (!json || json.error || !json[manifest.name]) {
logger.info(`[BUNDLED-EXTENSIONS-UPDATER]: No version found for ${manifest.name}.`); logger.info(`[BUNDLED-EXTENSIONS-UPDATER]: No version found for ${manifest.name}.`);

View File

@ -8,11 +8,12 @@ import {
LensExtensionDependencies, LensExtensionDependencies,
setLensExtensionDependencies, setLensExtensionDependencies,
} from "../../lens-extension-set-dependencies"; } from "../../lens-extension-set-dependencies";
import type { LensExtensionUpdateChecker } from "../../lens-extension-update-checker";
export const createExtensionInstance = export const createExtensionInstance =
(dependencies: LensExtensionDependencies) => (dependencies: LensExtensionDependencies) =>
(ExtensionClass: LensExtensionConstructor, extension: InstalledExtension) => { (ExtensionClass: LensExtensionConstructor, extension: InstalledExtension, updateChecker?: LensExtensionUpdateChecker) => {
const instance = new ExtensionClass(extension); const instance = new ExtensionClass(extension, updateChecker);
instance[setLensExtensionDependencies](dependencies); instance[setLensExtensionDependencies](dependencies);

View File

@ -124,7 +124,7 @@ export class LensExtension {
public async checkForUpdate() { public async checkForUpdate() {
return this.updateChecker?.run(this.manifest); return this.updateChecker?.run(this.manifest, this.isBundled);
} }
protected onActivate(): Promise<void> | void { protected onActivate(): Promise<void> | void {