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

Merge branch 'master' into topbar-home-icon-leads-to-welcome-page

This commit is contained in:
Alex Andreev 2022-09-12 11:44:48 +03:00 committed by GitHub
commit 7abb8de925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 29 deletions

View File

@ -429,7 +429,7 @@
"typed-emitter": "^1.4.0",
"typedoc": "0.23.14",
"typedoc-plugin-markdown": "^3.13.1",
"typescript": "^4.8.2",
"typescript": "^4.8.3",
"typescript-plugin-css-modules": "^3.4.0",
"webpack": "^5.74.0",
"webpack-cli": "^4.9.2",

View File

@ -363,7 +363,8 @@ export class ExtensionDiscovery {
const id = this.getInstalledManifestPath(manifest.name);
const isEnabled = this.dependencies.extensionsStore.isEnabled({ id, isBundled });
const extensionDir = path.dirname(manifestPath);
const npmPackage = path.join(extensionDir, `${manifest.name}-${manifest.version}.tgz`);
const packedName = manifest.name.replaceAll("@", "").replaceAll("/", "-");
const npmPackage = path.join(extensionDir, `${packedName}-${manifest.version}.tgz`);
const absolutePath = (isProduction && await this.dependencies.pathExists(npmPackage)) ? npmPackage : extensionDir;
const isCompatible = isBundled || this.dependencies.isCompatibleExtension(manifest);
@ -390,28 +391,11 @@ export class ExtensionDiscovery {
async ensureExtensions(): Promise<Map<LensExtensionId, InstalledExtension>> {
const bundledExtensions = await this.loadBundledExtensions();
await this.installBundledPackages(this.packageJsonPath, bundledExtensions);
const userExtensions = await this.loadFromFolder(this.localFolderPath, bundledExtensions.map((extension) => extension.manifest.name));
for (const extension of userExtensions) {
if (!(await this.dependencies.pathExists(extension.manifestPath))) {
try {
await this.dependencies.installExtension(extension.absolutePath);
} catch (error) {
const message = error instanceof Error
? error.message
: String(error || "unknown error");
const { name, version } = extension.manifest;
this.dependencies.logger.error(`${logModule}: failed to install user extension ${name}@${version}: ${message}`);
}
}
}
const extensions = bundledExtensions.concat(userExtensions);
await this.installBundledPackages(this.packageJsonPath, extensions);
return this.extensions = new Map(extensions.map(extension => [extension.id, extension]));
}
@ -420,10 +404,13 @@ export class ExtensionDiscovery {
*/
installBundledPackages(packageJsonPath: string, extensions: InstalledExtension[]): Promise<void> {
const dependencies = Object.fromEntries(
extensions.map(extension => [extension.manifest.name, extension.absolutePath]),
extensions.filter(extension => extension.isBundled).map(extension => [extension.manifest.name, extension.absolutePath]),
);
const optionalDependencies = Object.fromEntries(
extensions.filter(extension => !extension.isBundled).map(extension => [extension.manifest.name, extension.absolutePath]),
);
return this.dependencies.installExtensions(packageJsonPath, { dependencies });
return this.dependencies.installExtensions(packageJsonPath, { dependencies, optionalDependencies });
}
async loadBundledExtensions(): Promise<InstalledExtension[]> {

View File

@ -42,7 +42,7 @@ export class ExtensionInstaller {
});
logger.info(`${logModule} installing dependencies at ${this.dependencies.extensionPackageRootDirectory}`);
await this.npm(["install", "--no-audit", "--only=prod", "--prefer-offline", "--no-package-lock"]);
await this.npm(["install", "--audit=false", "--fund=false", "--only=prod", "--prefer-offline"]);
logger.info(`${logModule} dependencies installed at ${this.dependencies.extensionPackageRootDirectory}`);
} finally {
this.installLock.release();
@ -58,7 +58,7 @@ export class ExtensionInstaller {
try {
logger.info(`${logModule} installing package from ${name} to ${this.dependencies.extensionPackageRootDirectory}`);
await this.npm(["install", "--no-audit", "--only=prod", "--package-lock=false", "--prefer-offline", "--no-package-lock", name]);
await this.npm(["install", "--audit=false", "--fund=false", "--only=prod", "--prefer-offline", name]);
logger.info(`${logModule} package ${name} installed to ${this.dependencies.extensionPackageRootDirectory}`);
} finally {
this.installLock.release();

View File

@ -12639,10 +12639,10 @@ typescript-plugin-css-modules@^3.4.0:
stylus "^0.54.8"
tsconfig-paths "^3.9.0"
typescript@^4.8.2:
version "4.8.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790"
integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==
typescript@^4.8.3:
version "4.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.3.tgz#d59344522c4bc464a65a730ac695007fdb66dd88"
integrity sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==
typical@^4.0.0:
version "4.0.0"