core: fix early return when node_modules is missing during package install
This commit is contained in:
@@ -150,13 +150,17 @@ export const layer = Layer.effect(
|
|||||||
if (!canWrite) return
|
if (!canWrite) return
|
||||||
|
|
||||||
const add = input?.add.map((pkg) => [pkg.name, pkg.version].filter(Boolean).join("@")) ?? []
|
const add = input?.add.map((pkg) => [pkg.name, pkg.version].filter(Boolean).join("@")) ?? []
|
||||||
yield* Effect.gen(function* () {
|
if (
|
||||||
const nodeModulesExists = yield* afs.existsSafe(path.join(dir, "node_modules"))
|
yield* Effect.gen(function* () {
|
||||||
if (!nodeModulesExists) {
|
const nodeModulesExists = yield* afs.existsSafe(path.join(dir, "node_modules"))
|
||||||
yield* reify({ add, dir })
|
if (!nodeModulesExists) {
|
||||||
return
|
yield* reify({ add, dir })
|
||||||
}
|
return true
|
||||||
}).pipe(Effect.withSpan("Npm.checkNodeModules"))
|
}
|
||||||
|
return false
|
||||||
|
}).pipe(Effect.withSpan("Npm.checkNodeModules"))
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
yield* Effect.gen(function* () {
|
yield* Effect.gen(function* () {
|
||||||
const pkg = yield* afs.readJson(path.join(dir, "package.json")).pipe(Effect.orElseSucceed(() => ({})))
|
const pkg = yield* afs.readJson(path.join(dir, "package.json")).pipe(Effect.orElseSucceed(() => ({})))
|
||||||
|
|||||||
Reference in New Issue
Block a user