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:
commit
805630d174
@ -2,7 +2,7 @@
|
|||||||
"name": "kontena-lens",
|
"name": "kontena-lens",
|
||||||
"productName": "Lens",
|
"productName": "Lens",
|
||||||
"description": "Lens - The Kubernetes IDE",
|
"description": "Lens - The Kubernetes IDE",
|
||||||
"version": "4.0.0-alpha.1",
|
"version": "4.0.0-alpha.2",
|
||||||
"main": "static/build/main.js",
|
"main": "static/build/main.js",
|
||||||
"copyright": "© 2020, Mirantis, Inc.",
|
"copyright": "© 2020, Mirantis, Inc.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@ -47,7 +47,9 @@ export class ExtensionManager {
|
|||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
logger.info("[EXTENSION-MANAGER] loading extensions from " + this.extensionPackagesRoot)
|
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"
|
// we need to copy in-tree extensions so that we can symlink them properly on "npm install"
|
||||||
await fs.remove(this.inTreeTargetPath)
|
await fs.remove(this.inTreeTargetPath)
|
||||||
await fs.ensureDir(this.inTreeTargetPath)
|
await fs.ensureDir(this.inTreeTargetPath)
|
||||||
@ -61,6 +63,7 @@ export class ExtensionManager {
|
|||||||
async getExtensionByManifest(manifestPath: string): Promise<InstalledExtension> {
|
async getExtensionByManifest(manifestPath: string): Promise<InstalledExtension> {
|
||||||
let manifestJson: ExtensionManifest;
|
let manifestJson: ExtensionManifest;
|
||||||
try {
|
try {
|
||||||
|
fs.accessSync(manifestPath, fs.constants.F_OK); // check manifest file for existence
|
||||||
manifestJson = __non_webpack_require__(manifestPath)
|
manifestJson = __non_webpack_require__(manifestPath)
|
||||||
this.packagesJson.dependencies[manifestJson.name] = path.dirname(manifestPath)
|
this.packagesJson.dependencies[manifestJson.name] = path.dirname(manifestPath)
|
||||||
|
|
||||||
@ -79,7 +82,7 @@ export class ExtensionManager {
|
|||||||
|
|
||||||
protected installPackages(): Promise<void> {
|
protected installPackages(): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
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(),
|
cwd: extensionPackagesRoot(),
|
||||||
silent: true
|
silent: true
|
||||||
})
|
})
|
||||||
@ -95,6 +98,7 @@ export class ExtensionManager {
|
|||||||
async loadExtensions() {
|
async loadExtensions() {
|
||||||
const bundledExtensions = await this.loadBundledExtensions()
|
const bundledExtensions = await this.loadBundledExtensions()
|
||||||
const localExtensions = await this.loadFromFolder(this.localFolderPath)
|
const localExtensions = await this.loadFromFolder(this.localFolderPath)
|
||||||
|
await this.installPackages()
|
||||||
const extensions = bundledExtensions.concat(localExtensions)
|
const extensions = bundledExtensions.concat(localExtensions)
|
||||||
return new Map(extensions.map(ext => [ext.id, ext]));
|
return new Map(extensions.map(ext => [ext.id, ext]));
|
||||||
}
|
}
|
||||||
@ -110,7 +114,6 @@ export class ExtensionManager {
|
|||||||
}
|
}
|
||||||
const absPath = path.resolve(folderPath, fileName);
|
const absPath = path.resolve(folderPath, fileName);
|
||||||
const manifestPath = path.resolve(absPath, "package.json");
|
const manifestPath = path.resolve(absPath, "package.json");
|
||||||
await fs.access(manifestPath, fs.constants.F_OK)
|
|
||||||
const ext = await this.getExtensionByManifest(manifestPath).catch(() => null)
|
const ext = await this.getExtensionByManifest(manifestPath).catch(() => null)
|
||||||
if (ext) {
|
if (ext) {
|
||||||
extensions.push(ext)
|
extensions.push(ext)
|
||||||
@ -118,7 +121,6 @@ export class ExtensionManager {
|
|||||||
}
|
}
|
||||||
logger.debug(`[EXTENSION-MANAGER]: ${extensions.length} extensions loaded`, { folderPath, extensions });
|
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 fs.writeFile(path.join(this.extensionPackagesRoot, "package.json"), JSON.stringify(this.packagesJson), {mode: 0o600})
|
||||||
await this.installPackages()
|
|
||||||
return extensions
|
return extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,8 +133,10 @@ export class ExtensionManager {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const absPath = path.resolve(folderPath, fileName);
|
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");
|
const manifestPath = path.resolve(absPath, "package.json");
|
||||||
await fs.access(manifestPath, fs.constants.F_OK)
|
|
||||||
const ext = await this.getExtensionByManifest(manifestPath).catch(() => null)
|
const ext = await this.getExtensionByManifest(manifestPath).catch(() => null)
|
||||||
if (ext) {
|
if (ext) {
|
||||||
extensions.push(ext)
|
extensions.push(ext)
|
||||||
@ -141,7 +145,6 @@ export class ExtensionManager {
|
|||||||
|
|
||||||
logger.debug(`[EXTENSION-MANAGER]: ${extensions.length} extensions loaded`, { folderPath, extensions });
|
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 fs.writeFile(path.join(this.extensionPackagesRoot, "package.json"), JSON.stringify(this.packagesJson), {mode: 0o600})
|
||||||
await this.installPackages()
|
|
||||||
|
|
||||||
return extensions;
|
return extensions;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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!
|
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
|
- Extension API
|
||||||
- Improved pod logs
|
- Improved pod logs
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user