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

Merge branch 'master' into extensions-list-page

This commit is contained in:
Alex Andreev 2020-10-29 12:50:11 +03:00
commit 805630d174
3 changed files with 11 additions and 8 deletions

View File

@ -2,7 +2,7 @@
"name": "kontena-lens",
"productName": "Lens",
"description": "Lens - The Kubernetes IDE",
"version": "4.0.0-alpha.1",
"version": "4.0.0-alpha.2",
"main": "static/build/main.js",
"copyright": "© 2020, Mirantis, Inc.",
"license": "MIT",

View File

@ -47,7 +47,9 @@ export class ExtensionManager {
async load() {
logger.info("[EXTENSION-MANAGER] loading extensions from " + this.extensionPackagesRoot)
if (this.inTreeFolderPath !== this.inTreeTargetPath) {
try {
await fs.access(this.inTreeFolderPath, fs.constants.W_OK)
} catch {
// we need to copy in-tree extensions so that we can symlink them properly on "npm install"
await fs.remove(this.inTreeTargetPath)
await fs.ensureDir(this.inTreeTargetPath)
@ -61,6 +63,7 @@ export class ExtensionManager {
async getExtensionByManifest(manifestPath: string): Promise<InstalledExtension> {
let manifestJson: ExtensionManifest;
try {
fs.accessSync(manifestPath, fs.constants.F_OK); // check manifest file for existence
manifestJson = __non_webpack_require__(manifestPath)
this.packagesJson.dependencies[manifestJson.name] = path.dirname(manifestPath)
@ -79,7 +82,7 @@ export class ExtensionManager {
protected installPackages(): Promise<void> {
return new Promise((resolve, reject) => {
const child = child_process.fork(this.npmPath, ["install", "--silent"], {
const child = child_process.fork(this.npmPath, ["install", "--silent", "--no-audit", "--only=prod", "--prefer-offline"], {
cwd: extensionPackagesRoot(),
silent: true
})
@ -95,6 +98,7 @@ export class ExtensionManager {
async loadExtensions() {
const bundledExtensions = await this.loadBundledExtensions()
const localExtensions = await this.loadFromFolder(this.localFolderPath)
await this.installPackages()
const extensions = bundledExtensions.concat(localExtensions)
return new Map(extensions.map(ext => [ext.id, ext]));
}
@ -110,7 +114,6 @@ export class ExtensionManager {
}
const absPath = path.resolve(folderPath, fileName);
const manifestPath = path.resolve(absPath, "package.json");
await fs.access(manifestPath, fs.constants.F_OK)
const ext = await this.getExtensionByManifest(manifestPath).catch(() => null)
if (ext) {
extensions.push(ext)
@ -118,7 +121,6 @@ export class ExtensionManager {
}
logger.debug(`[EXTENSION-MANAGER]: ${extensions.length} extensions loaded`, { folderPath, extensions });
await fs.writeFile(path.join(this.extensionPackagesRoot, "package.json"), JSON.stringify(this.packagesJson), {mode: 0o600})
await this.installPackages()
return extensions
}
@ -131,8 +133,10 @@ export class ExtensionManager {
continue
}
const absPath = path.resolve(folderPath, fileName);
if (!fs.existsSync(absPath) || !fs.lstatSync(absPath).isDirectory()) { // skip non-directories
continue;
}
const manifestPath = path.resolve(absPath, "package.json");
await fs.access(manifestPath, fs.constants.F_OK)
const ext = await this.getExtensionByManifest(manifestPath).catch(() => null)
if (ext) {
extensions.push(ext)
@ -141,7 +145,6 @@ export class ExtensionManager {
logger.debug(`[EXTENSION-MANAGER]: ${extensions.length} extensions loaded`, { folderPath, extensions });
await fs.writeFile(path.join(this.extensionPackagesRoot, "package.json"), JSON.stringify(this.packagesJson), {mode: 0o600})
await this.installPackages()
return extensions;
}

View File

@ -2,7 +2,7 @@
Here you can find description of changes we've built into each release. While we try our best to make each upgrade automatic and as smooth as possible, there may be some cases where you might need to do something to ensure the application works smoothly. So please read through the release highlights!
## 4.0.0-alpha.1 (current version)
## 4.0.0-alpha.2 (current version)
- Extension API
- Improved pod logs