mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Check for package.json availability
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
089f4ae99e
commit
59c41af103
@ -61,6 +61,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)
|
||||||
|
|
||||||
@ -110,7 +111,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)
|
||||||
@ -131,11 +131,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()) {
|
if (!fs.existsSync(absPath) || !fs.lstatSync(absPath).isDirectory()) { // skip non-directories
|
||||||
continue;
|
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)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user