summaryrefslogtreecommitdiffhomepage
path: root/packages/shared
diff options
context:
space:
mode:
Diffstat (limited to 'packages/shared')
-rw-r--r--packages/shared/src/npm.ts8
-rw-r--r--packages/shared/src/util/effect-flock.ts2
2 files changed, 6 insertions, 4 deletions
diff --git a/packages/shared/src/npm.ts b/packages/shared/src/npm.ts
index 994ec04da..8bd0cc468 100644
--- a/packages/shared/src/npm.ts
+++ b/packages/shared/src/npm.ts
@@ -5,7 +5,7 @@ import { Effect, Schema, Context, Layer, Option, FileSystem } from "effect"
import { NodeFileSystem } from "@effect/platform-node"
import { AppFileSystem } from "./filesystem"
import { Global } from "./global"
-import { Flock } from "./util/flock"
+import { EffectFlock } from "./util/effect-flock"
export namespace Npm {
export class InstallFailedError extends Schema.TaggedErrorClass<InstallFailedError>()("NpmInstallFailedError", {
@@ -62,6 +62,7 @@ export namespace Npm {
const afs = yield* AppFileSystem.Service
const global = yield* Global.Service
const fs = yield* FileSystem.FileSystem
+ const flock = yield* EffectFlock.Service
const directory = (pkg: string) => path.join(global.cache, "packages", sanitize(pkg))
const outdated = Effect.fn("Npm.outdated")(function* (pkg: string, cachedVersion: string) {
@@ -92,7 +93,7 @@ export namespace Npm {
const add = Effect.fn("Npm.add")(function* (pkg: string) {
const dir = directory(pkg)
- yield* Flock.effect(`npm-install:${dir}`)
+ yield* flock.acquire(`npm-install:${dir}`)
const arborist = new Arborist({
path: dir,
@@ -133,7 +134,7 @@ export namespace Npm {
}, Effect.scoped)
const install = Effect.fn("Npm.install")(function* (dir: string) {
- yield* Flock.effect(`npm-install:${dir}`)
+ yield* flock.acquire(`npm-install:${dir}`)
const reify = Effect.fnUntraced(function* () {
const arb = new Arborist({
@@ -240,6 +241,7 @@ export namespace Npm {
)
export const defaultLayer = layer.pipe(
+ Layer.provide(EffectFlock.layer),
Layer.provide(AppFileSystem.layer),
Layer.provide(Global.layer),
Layer.provide(NodeFileSystem.layer),
diff --git a/packages/shared/src/util/effect-flock.ts b/packages/shared/src/util/effect-flock.ts
index d728c0ef1..3e00afc9e 100644
--- a/packages/shared/src/util/effect-flock.ts
+++ b/packages/shared/src/util/effect-flock.ts
@@ -274,5 +274,5 @@ export namespace EffectFlock {
}),
)
- export const live = layer.pipe(Layer.provide(AppFileSystem.defaultLayer))
+ export const defaultLayer = layer.pipe(Layer.provide(AppFileSystem.defaultLayer), Layer.provide(Global.layer))
}