mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
isValid -> isCompatible
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
e59a640c25
commit
244db85c9a
@ -93,7 +93,7 @@ describe("ExtensionDiscovery", () => {
|
||||
id: path.normalize("node_modules/my-extension/package.json"),
|
||||
isBundled: false,
|
||||
isEnabled: false,
|
||||
isValid: false,
|
||||
isCompatible: false,
|
||||
manifest: {
|
||||
name: "my-extension",
|
||||
},
|
||||
|
||||
@ -39,7 +39,7 @@ describe("lens extension", () => {
|
||||
manifestPath: "/this/is/fake/package.json",
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isValid: true
|
||||
isCompatible: true
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ export interface InstalledExtension {
|
||||
// Absolute to the symlinked package.json file
|
||||
readonly manifestPath: string;
|
||||
readonly isBundled: boolean; // defined in project root's package.json
|
||||
readonly isValid: boolean;
|
||||
readonly isCompatible: boolean;
|
||||
isEnabled: boolean;
|
||||
}
|
||||
|
||||
@ -359,10 +359,10 @@ export class ExtensionDiscovery extends Singleton {
|
||||
const extensionDir = path.dirname(manifestPath);
|
||||
const npmPackage = path.join(extensionDir, `${manifest.name}-${manifest.version}.tgz`);
|
||||
const absolutePath = (isProduction && await fse.pathExists(npmPackage)) ? npmPackage : extensionDir;
|
||||
let isValid = false;
|
||||
let isCompatible = false;
|
||||
|
||||
if (manifest.engines?.lens) {
|
||||
isValid = semver.satisfies(appSemVer, manifest.engines.lens);
|
||||
isCompatible = semver.satisfies(appSemVer, manifest.engines.lens);
|
||||
}
|
||||
|
||||
return {
|
||||
@ -372,7 +372,7 @@ export class ExtensionDiscovery extends Singleton {
|
||||
manifest,
|
||||
isBundled,
|
||||
isEnabled,
|
||||
isValid
|
||||
isCompatible
|
||||
};
|
||||
} catch (error) {
|
||||
if (error.code === "ENOTDIR") {
|
||||
|
||||
@ -299,7 +299,7 @@ export class ExtensionLoader extends Singleton {
|
||||
for (const [extId, extension] of installedExtensions) {
|
||||
const alreadyInit = this.instances.has(extId);
|
||||
|
||||
if (extension.isValid && extension.isEnabled && !alreadyInit) {
|
||||
if (extension.isCompatible && extension.isEnabled && !alreadyInit) {
|
||||
try {
|
||||
const LensExtensionClass = this.requireExtension(extension);
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ describe("getPageUrl", () => {
|
||||
manifestPath: "/this/is/fake/package.json",
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isValid: true
|
||||
isCompatible: true
|
||||
});
|
||||
globalPageRegistry.add({
|
||||
id: "page-with-params",
|
||||
@ -109,7 +109,7 @@ describe("globalPageRegistry", () => {
|
||||
manifestPath: "/this/is/fake/package.json",
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isValid: true
|
||||
isCompatible: true
|
||||
});
|
||||
globalPageRegistry.add([
|
||||
{
|
||||
|
||||
@ -87,7 +87,7 @@ describe("protocol router tests", () => {
|
||||
},
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isValid: true,
|
||||
isCompatible: true,
|
||||
absolutePath: "/foo/bar",
|
||||
});
|
||||
const lpr = LensProtocolRouterMain.getInstance();
|
||||
@ -165,7 +165,7 @@ describe("protocol router tests", () => {
|
||||
},
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isValid: true,
|
||||
isCompatible: true,
|
||||
absolutePath: "/foo/bar",
|
||||
});
|
||||
|
||||
@ -206,7 +206,7 @@ describe("protocol router tests", () => {
|
||||
},
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isValid: true,
|
||||
isCompatible: true,
|
||||
absolutePath: "/foo/bar",
|
||||
});
|
||||
|
||||
@ -231,7 +231,7 @@ describe("protocol router tests", () => {
|
||||
},
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isValid: true,
|
||||
isCompatible: true,
|
||||
absolutePath: "/foo/bar",
|
||||
});
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ describe("Extensions", () => {
|
||||
manifestPath: "/symlinked/path/package.json",
|
||||
isBundled: false,
|
||||
isEnabled: true,
|
||||
isValid: true
|
||||
isCompatible: true
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ interface Props {
|
||||
}
|
||||
|
||||
function getStatus(extension: InstalledExtension) {
|
||||
if (!extension.isValid) {
|
||||
if (!extension.isCompatible) {
|
||||
return "Incompatible";
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ export const InstalledExtensions = observer(({ extensions, uninstall, enable, di
|
||||
const data = useMemo(
|
||||
() => {
|
||||
return extensions.map(extension => {
|
||||
const { id, isEnabled, isValid, manifest } = extension;
|
||||
const { id, isEnabled, isCompatible, manifest } = extension;
|
||||
const { name, description, version } = manifest;
|
||||
const isUninstalling = ExtensionInstallationStateStore.isExtensionUninstalling(id);
|
||||
|
||||
@ -106,13 +106,13 @@ export const InstalledExtensions = observer(({ extensions, uninstall, enable, di
|
||||
),
|
||||
version,
|
||||
status: (
|
||||
<div className={cssNames({[styles.enabled]: isEnabled, [styles.invalid]: !isValid})}>
|
||||
<div className={cssNames({[styles.enabled]: isEnabled, [styles.invalid]: !isCompatible})}>
|
||||
{getStatus(extension)}
|
||||
</div>
|
||||
),
|
||||
actions: (
|
||||
<MenuActions usePortal toolbar={false}>
|
||||
{ isValid && (
|
||||
{ isCompatible && (
|
||||
<>
|
||||
{isEnabled ? (
|
||||
<MenuItem
|
||||
|
||||
Loading…
Reference in New Issue
Block a user