Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncu crashes when root package.json contains workspaces β†’ packages #1214

Closed
3 tasks done
kachkaev opened this issue Nov 7, 2022 · 2 comments
Closed
3 tasks done
Labels

Comments

@kachkaev
Copy link

kachkaev commented Nov 7, 2022

πŸ‘‹ @raineorshine!

  • I have searched for similar issues
  • I am using the latest version of npm-check-updates (16.3.16)
  • I am using node >= 14.14

Steps to Reproduce

.ncurc:

n/a

Dependencies:

{
  "workspaces": {
    "packages": ["packages/*"],
    "nohoist": ["**/react-native", "**/react-native/**"]
  }
}

Source: https://classic.yarnpkg.com/blog/2018/02/15/nohoist/

Steps:

  1. Run ncu --workspaces

Current Behavior

ncu crashes

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:162:11)
    at Object.join (node:path:1172:7)
    at /Users/ak/.nvm/versions/node/v16.18.0/lib/node_modules/npm-check-updates/build/src/index.js:249:50
    at Array.map (<anonymous>)
    at runUpgrades (/Users/ak/.nvm/versions/node/v16.18.0/lib/node_modules/npm-check-updates/build/src/index.js:249:18) {
  code: 'ERR_INVALID_ARG_TYPE'

Expected Behavior

ncu works for workspaces β†’ packages β†’Β [] as for workspaces β†’ []

{
  "workspaces":  ["packages/*"]
}

Relevant code

const workspaces = (typeof pkgData === 'string' ? (JSON.parse(pkgData) as PackageFile) : (pkgData as PackageFile))
.workspaces

const workspaces = (typeof pkgData === 'string' ? (JSON.parse(pkgData) as PackageFile) : (pkgData as PackageFile))
.workspaces

@raineorshine
Copy link
Owner

Thanks for reporting!

Fixed and published in v16.3.17.

@kachkaev
Copy link
Author

kachkaev commented Nov 8, 2022

Big thanks @raineorshine! I just upgraded npm-check-updates to 16.3.17 and --workspaces worked πŸ”₯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants