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

Workspace option doesn't seem to work #1304

Closed
3 tasks done
marinsokol5 opened this issue Jun 23, 2023 · 4 comments
Closed
3 tasks done

Workspace option doesn't seem to work #1304

marinsokol5 opened this issue Jun 23, 2023 · 4 comments
Labels

Comments

@marinsokol5
Copy link

marinsokol5 commented Jun 23, 2023

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

Description

Hey, thanks for taking time to do this package, it's really useful!! 😊
I seem to have some problems with using it though in NPM workspaces, I tried reading through the README and through your pitch for the new API in #896 (comment) but I can't make it work.

Steps to Reproduce

npm 8.19.2
node v16.17.0
npm-check-updates 16.10.12

Steps:

  • Use npm workspaces, we can use https://github.com/Quramy/npm-ts-workspaces-example an an example, so let's git clone git@github.com:Quramy/npm-ts-workspaces-example.git && cd npm-ts-workspaces-example && npm install
  • npx npm-check-updates@16.10.12 -w @quramy/x-cli (you can also install it globally and run it, both will not work)

Current Behavior

  • command just exits

Expected Behavior

  • command should write which packages from that workspace package could be updated

Notes

  • option -ws works fine, like npm exec npm-check-updates@16.10.12 -- -ws
  • I also noticed that the --peer option works incorrectly for the workspaces as it fails to find packages installed in the local node_modules folder of a particular workspace subpackage. Like the way node_modules resolution in workspaces works is:
.
├── node_modules/ (storing majority of packages for this NPM workspaces monorepo)
├── package-lock.json
├── package.json
├── packages
│   ├── package-A
│   │   ├── node_modules/ (storing some of the packages for package-A which are specific to it)
│   │   ├── package.json
│   └── package-B
│   │   ├── node_modules/ (storing some of the packages for package-B which are specific to it)
│   |   ├── package.json

Currently it just tries to find them in the root node_modules folder but it doesn't check Package-A and Package-B node_modules .

@raineorshine
Copy link
Owner

raineorshine commented Jun 23, 2023

You should specify the package folder name rather than the full package name:

ncu -w x-cli

However, I see no reason why we should not also allow the package name. Sorry for the confusion.

  • I also noticed that the --peer option works incorrectly for the workspaces as it fails to find packages installed in the local node_modules folder of a particular workspace subpackage. Like the way node_modules resolution in workspaces works is:

This sounds like a bug. I'm not as familiar with the --peer option since it was written by a different contributor, but please open a separate issue with this information and hopefully someone will look into it.

@marinsokol5
Copy link
Author

You should specify the package folder name rather than the full package name.

Nice, this works!!
Yeah it's fine, it's just it might be better to document this as usual workspaces command do work with the name from the package.json.

@raineorshine
Copy link
Owner

Yes, I agree. I think the behavior may even be a regression from #1217. I think it is ignoring entire workspaces instead of ignore local dependencies on workspaces.

@raineorshine
Copy link
Owner

You should be able to do ncu -w "@quramy/x-cli" now.

Published in v16.10.13

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