babakfp
babakfpโ€ข2mo ago

How to prevent `deno add` from adding `^` to package version?

Hi ๐Ÿ‘‹ Is there a one time option like PNPM? So I can set it once for all and not have to deal with it every time. I don't understand why every package manager adds that character. You may install a different version of a package without knowing it and introduce bugs into your project because some packages may have breaking changes in their minor version updates.
2 Replies
Deno AI Helper
Deno AI Helperโ€ข2mo ago
Hello! ๐Ÿ‘‹ I wasn't able to find the answer to your question in the official Deno documentation. As of my last update, Deno does not have a built-in package manager like npm or pnpm that uses a package.json file or similar to manage dependencies with version prefixes like ^. Instead, Deno imports modules directly by URL, and the version is specified as part of the URL. This means that Deno's dependency management is based on explicit versioning, and it doesn't automatically update or change the version of a module unless you manually update the import URL. If you're referring to a third-party tool or a specific command within Deno that I'm not aware of, please note that my advice is not based on the Deno documentation, and you should double-check the accuracy of the advice given. For managing dependencies in Deno, you typically specify the exact version of the module in the import statement, like so:
import { example } from "https://deno.land/x/module@1.0.0/mod.ts";
import { example } from "https://deno.land/x/module@1.0.0/mod.ts";
By doing this, you ensure that you're always importing the same version of the module, thus avoiding the issue of unintentionally upgrading to a version with breaking changes. If you're using a deps.ts file to manage your dependencies (which is a common pattern in Deno), you would also specify the exact versions of your modules there, and you would need to manually update them as needed. If you're using a specific tool or command that is adding a ^ to your package versions, please provide more context or check the tool's documentation for configuration options to handle versioning according to your preferences.
ร“scar
ร“scarโ€ข2mo ago
You might be interested in https://github.com/oscarotero/nudd (I'm the maintainer). It supports packages from deno.land, jsdelivr, jsr and npm. And it doesn't add ^ to package version. - nudd add react (install react from npm) - nudd add @std/path (install std/path from jsr) - You can update them with nudd update.