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