nfarina/run

Check for `workspaces.packages`

mikehobi opened this issue · 2 comments

Wanted to test out this package and it was failing:

file:///usr/local/lib/node_modules/fast-run/src/Package.js:94
        for (const workspace of this.packageJson.workspaces ?? []) {
                                                 ^

TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
    at Package.findWorkspacePackage (file:///usr/local/lib/node_modules/fast-run/src/Package.js:94:50)
    at cli (file:///usr/local/lib/node_modules/fast-run/src/cli.js:25:42)

My package.json has workspaces configured as such:

  "workspaces": {
    "packages": [
      "packages/*",
      "apps/*"
    ],
    "nohoist": [
      ...
    ]
  },

And fails because this line is trying to iterate the object:

https://github.com/nfarina/run/blob/main/src/Package.ts#L131

Ah thanks so much for reporting! I should have checked the spec for workspaces. Will fix…

Fixed and deployed, thanks again!