-
Notifications
You must be signed in to change notification settings - Fork 109
Remove unnecessary dependencies #2614
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
Conversation
76eebbc to
b668436
Compare
This comment was marked as resolved.
This comment was marked as resolved.
b668436 to
5ca44c1
Compare
|
For the app package it should make not difference if you put the dependencies into dev- or dependencies. But for the @nextcloud/text package that would make a difference. |
Well, I'd say since they are runtime deps, they should be in Line 18 in 96f0cdd
|
|
Well, according to the components used in the text/src/components/RichTextReader.vue Lines 28 to 30 in 96f0cdd
text/src/extensions/RichText.js Lines 23 to 46 in 96f0cdd
text/src/components/BaseReader.vue Lines 28 to 29 in 96f0cdd
|
| }, | ||
| "engines": { | ||
| "node": "^14.0.0", | ||
| "npm": "^7.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just remove it?
It not affects the host's npm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is what we requires at Nextcloud.
Min npm7 and node14. We move alltogether when npm7 got out and communicated about it already
My understanding is that if they are not used at all vite will not package them. But if they are in dependencies apps that use |
| "cypress-file-upload": "^5.0.8", | ||
| "debounce": "^1.2.1", | ||
| "escape-html": "^1.0.3", | ||
| "eslint": "^8.18.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a peer dependency of @nextcloud/eslint. My understanding is that peerDependencies of dependencies should be added as devDependencies to ensure they are installed and keep track of their versions even though npm will auto install peer dependencies nowadays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is not a good idea, as that might lead to version conflicts, while npm will ensure the correct version is installed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a peer dependency of
@nextcloud/eslint. My understanding is that peerDependencies of dependencies should be added as devDependencies to ensure they are installed and keep track of their versions even though npm will auto install peer dependencies nowadays.
It's the other way, we made sure each config dependency handle their required versions themselves.
All the other apps are doing it that way, it actually helped us a lot to reduce noise and ensure further compatibilities
|
So far my thinking was this:
The goal of 1. and 2. is to depend only on the things the package actually requires. If we forget something here it will be bundled with the package and the package will still work - but it will grow in size. I was thinking about adding a CI check for that as it would be hard to notice otherwise. About 3. I was mostly following what i heard from @vinicius73 and thinking this makes conflicts explicit and defines a working set of dependencies. I'm fine with fully relying on npm magic here. I think we should pick one strategy and stick to it - maybe even document it and standardize it? |
We have alt least 2 problems.
From the perspective of an application, every dependency matters. Those dependencies can be declared as We can choose between |
Node 14 bundles npm 6, I guess 7 is used because of it's huge improvements(?). In 10 months node 14 will be EOL and the current LTS is node 16 bundling npm 8. |
This is already standardized at Nextcloud with those global packages.We did a lot of work over the last year and a half to go that direction. |
No, this is not an issue Lines 91 to 94 in 96f0cdd
You just have to be compliant about what your app requires |
|
Okay... so removing the peer dependencies of our dependencies for package.json seems to be the agreed upon way to go within Nextcloud. I'm fine with that. And that will fix the issue this PR is addressing, right? I think dependencies that are not runtime dependencies of the package should stay in devDependencies and not become dependencies. There's a number of them where it's hard to make a clear decision. I moved everything into devDependencies that is not imported by the package - as that was an easy criterion to apply. But one could obviously argue that a package that exposes a vue component depends on vue. I'm okay with moving on with this PR but i'd probably move for example |
The dependency might be installed yes, but it will not be part of the final bundle of the app then |
Signed-off-by: John Molakvoæ <[email protected]> Signed-off-by: nextcloud-command <[email protected]>
Signed-off-by: John Molakvoæ <[email protected]>
2b01935 to
49ddee6
Compare
They are not needed as they are automatically handled by npm7 and the associated configs packages
Closes #2612
cc @susnux
Btw, you seems to have a lot of dependencies in dev that should be in the
dependenciessection ? Please double-check, they might be here because of the secondary vite building package, 🤷