Include bundled extensions in package.json (#6715)

* bundle extensions to asar

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* make build fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2022-12-13 13:24:46 +02:00
1 parent 146cae0b1c
commit 012944d562
12 files changed
+55 -108

No files matched your search

@@ -5,10 +5,7 @@
import AwaitLock from "await-lock";
import child_process from "child_process";
import fs from "fs-extra";
import path from "path";
import logger from "../../main/logger";
import type { PackageJson } from "type-fest";
const logModule = "[EXTENSION-INSTALLER]";
@@ -38,27 +35,6 @@ export class ExtensionInstaller {
return __non_webpack_require__.resolve("npm");
}
/**
* Write package.json to the file system and execute npm install for it.
*/
installPackages = async (packageJsonPath: string, packagesJson: PackageJson): Promise<void> => {
// Mutual exclusion to install packages in sequence
await this.installLock.acquireAsync();
try {
// Write the package.json which will be installed in .installDependencies()
await fs.writeFile(path.join(packageJsonPath), JSON.stringify(packagesJson, null, 2), {
mode: 0o600,
});
logger.info(`${logModule} installing dependencies at ${this.dependencies.extensionPackageRootDirectory}`);
await this.npm(...baseNpmInstallArgs);
logger.info(`${logModule} dependencies installed at ${this.dependencies.extensionPackageRootDirectory}`);
} finally {
this.installLock.release();
}
};
/**
* Install single package using npm
*/
@@ -1,13 +0,0 @@
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import extensionInstallerInjectable from "../extension-installer.injectable";
const installExtensionsInjectable = getInjectable({
id: "install-extensions",
instantiate: (di) => di.inject(extensionInstallerInjectable).installPackages,
});
export default installExtensionsInjectable;