mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Ignore ENOENT errors
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
d208fbb749
commit
64b53e606c
@ -7,7 +7,7 @@ import type { ReadOptions } from "fs-extra";
|
|||||||
import fse from "fs-extra";
|
import fse from "fs-extra";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NOTE: Add corrisponding a corrisponding override of this injecable in `src/test-utils/override-fs-with-fakes.ts`
|
* NOTE: Add corresponding override of this injectable in `src/test-utils/override-fs-with-fakes.ts`
|
||||||
*/
|
*/
|
||||||
const fsInjectable = getInjectable({
|
const fsInjectable = getInjectable({
|
||||||
id: "fs",
|
id: "fs",
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import joinPathsInjectable from "../../common/path/join-paths.injectable";
|
|||||||
import type { PackageJson } from "../common-api";
|
import type { PackageJson } from "../common-api";
|
||||||
import writeJsonFileInjectable from "../../common/fs/write-json-file.injectable";
|
import writeJsonFileInjectable from "../../common/fs/write-json-file.injectable";
|
||||||
import { once } from "lodash";
|
import { once } from "lodash";
|
||||||
|
import { isErrnoException } from "../../common/utils";
|
||||||
|
|
||||||
const baseNpmInstallArgs = [
|
const baseNpmInstallArgs = [
|
||||||
"install",
|
"install",
|
||||||
@ -65,11 +66,19 @@ const installExtensionInjectable = getInjectable({
|
|||||||
const packageJsonPath = joinPaths(extensionPackageRootDirectory, "package.json");
|
const packageJsonPath = joinPaths(extensionPackageRootDirectory, "package.json");
|
||||||
|
|
||||||
const fixupPackageJson = once(async () => {
|
const fixupPackageJson = once(async () => {
|
||||||
const packageJson = await readJsonFile(packageJsonPath) as PackageJson;
|
try {
|
||||||
|
const packageJson = await readJsonFile(packageJsonPath) as PackageJson;
|
||||||
|
|
||||||
delete packageJson.dependencies;
|
delete packageJson.dependencies;
|
||||||
|
|
||||||
await writeJsonFile(packageJsonPath, packageJson);
|
await writeJsonFile(packageJsonPath, packageJson);
|
||||||
|
} catch (error) {
|
||||||
|
if (isErrnoException(error) && error.code === "ENOENT") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const installLock = new AwaitLock();
|
const installLock = new AwaitLock();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user