flock npm.add (#20557)

pull/14307/head
Sebastian 2026-04-02 02:21:26 +02:00 committed by GitHub
parent c526caae7b
commit 8a8f7b3e90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 3 deletions

View File

@ -2,7 +2,6 @@ import semver from "semver"
import z from "zod"
import { NamedError } from "@opencode-ai/util/error"
import { Global } from "../global"
import { Lock } from "../util/lock"
import { Log } from "../util/log"
import path from "path"
import { readdir, rm } from "fs/promises"
@ -57,11 +56,11 @@ export namespace Npm {
}
export async function add(pkg: string) {
using _ = await Lock.write(`npm-install:${pkg}`)
const dir = directory(pkg)
await using _ = await Flock.acquire(`npm-install:${Filesystem.resolve(dir)}`)
log.info("installing package", {
pkg,
})
const dir = directory(pkg)
const arborist = new Arborist({
path: dir,