mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-03 06:50:26 +00:00
flock npm.add (#20557)
This commit is contained in:
parent
c526caae7b
commit
8a8f7b3e90
1 changed files with 2 additions and 3 deletions
|
|
@ -2,7 +2,6 @@ import semver from "semver"
|
||||||
import z from "zod"
|
import z from "zod"
|
||||||
import { NamedError } from "@opencode-ai/util/error"
|
import { NamedError } from "@opencode-ai/util/error"
|
||||||
import { Global } from "../global"
|
import { Global } from "../global"
|
||||||
import { Lock } from "../util/lock"
|
|
||||||
import { Log } from "../util/log"
|
import { Log } from "../util/log"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { readdir, rm } from "fs/promises"
|
import { readdir, rm } from "fs/promises"
|
||||||
|
|
@ -57,11 +56,11 @@ export namespace Npm {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function add(pkg: string) {
|
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", {
|
log.info("installing package", {
|
||||||
pkg,
|
pkg,
|
||||||
})
|
})
|
||||||
const dir = directory(pkg)
|
|
||||||
|
|
||||||
const arborist = new Arborist({
|
const arborist = new Arborist({
|
||||||
path: dir,
|
path: dir,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue