Skip to content

Commit

Permalink
Update specUtils.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 authored Jan 8, 2024
1 parent 56537a5 commit 129024b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions sources/specUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function loadSpec(initialCwd: string): Promise<LoadSpecResult> {
manifestPath: string;
} | null = null;

let file: FileHandle;
let content: string;

while (nextCwd !== currCwd && (!selection || !selection.data.packageManager)) {
currCwd = nextCwd;
Expand All @@ -101,15 +101,12 @@ export async function loadSpec(initialCwd: string): Promise<LoadSpecResult> {

const manifestPath = path.join(currCwd, `package.json`);
try {
file = await fs.promises.open(manifestPath, `r`);
content = await fs.promises.readFile(manifestPath, `utf8`);
} catch (err) {
if ((err as NodeError)?.code === `ENOENT`) continue;
throw err;
}

const content = await file.readFile(`utf8`);
await file.close();

let data;
try {
data = JSON.parse(content);
Expand Down

0 comments on commit 129024b

Please sign in to comment.