Skip to content

Commit 1ee712e

Browse files
committed
core: fix early return when node_modules is missing during package install
1 parent 55315bd commit 1ee712e

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

packages/opencode/src/npm/index.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,17 @@ export const layer = Layer.effect(
150150
if (!canWrite) return
151151

152152
const add = input?.add.map((pkg) => [pkg.name, pkg.version].filter(Boolean).join("@")) ?? []
153-
yield* Effect.gen(function* () {
154-
const nodeModulesExists = yield* afs.existsSafe(path.join(dir, "node_modules"))
155-
if (!nodeModulesExists) {
156-
yield* reify({ add, dir })
157-
return
158-
}
159-
}).pipe(Effect.withSpan("Npm.checkNodeModules"))
153+
if (
154+
yield* Effect.gen(function* () {
155+
const nodeModulesExists = yield* afs.existsSafe(path.join(dir, "node_modules"))
156+
if (!nodeModulesExists) {
157+
yield* reify({ add, dir })
158+
return true
159+
}
160+
return false
161+
}).pipe(Effect.withSpan("Npm.checkNodeModules"))
162+
)
163+
return
160164

161165
yield* Effect.gen(function* () {
162166
const pkg = yield* afs.readJson(path.join(dir, "package.json")).pipe(Effect.orElseSucceed(() => ({})))

0 commit comments

Comments
 (0)