JamieMason/syncpack

fix(output): show useful message when a dependency type is not found

Opened this issue · 2 comments

Description

I run syncpack list on my Yarn monorepo. There's something is not good on my package.json or Syncpack.

Logs

node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

TypeError: Cannot read properties of undefined (reading 'read')
    at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-package-json-files/package-json-file.js:20:81
    at Array.map (<anonymous>)
    at PackageJsonFile.getInstances (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-package-json-files/package-json-file.js:20:49)
    at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-instances/index.js:9:305
    at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1303:243
    at body (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/core.js:444:17)
    at FiberRuntime.While (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1021:14)
    at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1068:31
    at Object.context (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/tracer.js:73:17)
    at FiberRuntime.runLoop (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1063:28) {
  name: '(FiberFailure) TypeError',
  [Symbol(effect/Runtime/FiberFailure)]: Symbol(effect/Runtime/FiberFailure),
  [Symbol(effect/Runtime/FiberFailure/Cause)]: {
    _tag: 'Die',
    defect: TypeError: Cannot read properties of undefined (reading 'read')
        at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-package-json-files/package-json-file.js:20:81
        at Array.map (<anonymous>)
        at PackageJsonFile.getInstances (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-package-json-files/package-json-file.js:20:49)
        at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/dist/get-instances/index.js:9:305
        at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1303:243
        at body (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/core.js:444:17)
        at FiberRuntime.While (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1021:14)
        at file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1068:31
        at Object.context (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/tracer.js:73:17)
        at FiberRuntime.runLoop (file:///Users/guillem/programacio/codi/cites/xiroi/xiroi/node_modules/syncpack/node_modules/effect/dist/esm/internal/fiberRuntime.js:1063:28)
  }
}

Suggested Solution

Point where is the error.

Help Needed

I add you, @JamieMason, to my private monorepo to check it.

hey @guillempuchem, it's a small typo of peers -> peer

/** @type {import("syncpack").RcFile} */
export default {
-	dependencyTypes: ['dev', 'prod', 'overrides', 'peers', 'resolutions'],
+	dependencyTypes: ['dev', 'prod', 'overrides', 'peer', 'resolutions'],

I'll leave this open for this to be handled properly with a useful message, thanks.

Thanks Jamie!
This will be a good improvement.