-
Notifications
You must be signed in to change notification settings - Fork 5.6k
question: confusion about adding developer/dev dependencies #26865
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
Comments
I looked into the Deno source code, and it seems that the In my opinion, it would be beneficial if the Currently, there is no way to manage dev dependencies for packages installed using the Edit: There was note about the |
Hey. Thanks for the response! That's a lot of good info! |
@uncomfyhalomacro @devjume is there any plan to add dev dependencies to deno.json? |
As it stands, Deno doesn't have a need to separate the dependencies. If you're publishing to JSR, the only dependencies listed are the ones actually used in the code. If you fork a Deno repo and want to install all its dependencies listed in |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Let's please stay on topic here instead of going into a side rant. As @BlackAsLight mentioned, in Deno dependencies for production are figured out based on what your code uses. For example, if you have an entrypoint of Personally, I think Deno should have a way of representing dev dependencies in the deno.json. This would have several benefits:
That said, some people are extremely against this on the team, so it might be a hard sell. |
@dsherret agree, I think in Deno we should have a way to declarative define dependencies that need only during work exactly with source code of package - aka dev dependencies It would also be really cool to have some kind of built-in analyzer of problems with declaring dependencies and dev dependencies For example, so that some CLI tool would tell me that I specified a dependency as dev but it is actually used in the code that will be packaged |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
rather than devDependencies, i would suggest something more granular {
"tasks": {
"build": {
"command": "rollup -c",
"imports": {
"rollup": "npm:rollup@4",
"@unplugin/isolated-declarations": "jsr:@unplugin/isolated-decl@latest",
"@rollup/iife": "npm:rollup-plugin-iife@latest"
},
},
"test": {
"command": "playwright test",
"dependencies": ["build"],
"nodeModulesDir": "manual",
"imports": {
"playwright": "npm:playwright@1",
"@playwright/test": "npm:@playwright/test@1"
}
}
}
} for adding dependencies via cli deno add npm:rollup --task build,bundle |
Also I don't clearly understand how dependencies will work for For example in my library I have {
"imports": {
"react": "https://esm.sh/[email protected]"
}
} I want to use my library in other project In this project i have react from NPM: {
"imports": {
"react": "npm:[email protected]"
}
} How can I define react in my library for avoid install 2 copies of react from 2 sources? |
Why can't your library import |
@BlackAsLight Honestly, this is because I don't know how to add types to NPM-version of React I tried to find guides about how to properly add I asked here: And here: And here: But there is no asnwer at this time That's why I was going to replace react from npm to react from esm.sh |
I was also confused by |
On this topic it's easy to do this in deno.json e.g.:
However that's not really related to the OPs question about adding dev dependencies. I too found the documentation very lacking on this point when coming from node_modules. |
Agreed on this. I am currently using For example, @types/node isn't necessary in prod, but inflates the build size by 2 MB. I'd be happy to make this a separate issue since it deals with Deno compile. |
I am not quite sure how Deno knows if the dependencies I am adding is a dev dependency or not. Here is a reproduction.
deno init dev-dependency-test cd dev-dependency-test deno add --dev jsr:@denosaurs/argontwo
But there is no actual separation of which is a dev dependency in
deno.json
.And in
deno.lock
.In Node, there is a field called
devDependencies
which makes it easy to track which dependency is a dev dependency or not. Maybe this--dev
flag was supposed to declare a package as a dev dependency indeno.lock
. Was this overlooked or something that is still being worked on?The text was updated successfully, but these errors were encountered: