mxcl
mxcl10mo ago

how to avoid deprecation warnings in compiled binaries

$ pkgx --version
warning: Use of deprecated "Deno.stderr.rid" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.
warning: Use of deprecated "Deno.isatty()" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.
warning: Use of deprecated "Deno.stdin.rid" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.
pkgx 1.1.6
$ pkgx --version
warning: Use of deprecated "Deno.stderr.rid" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.
warning: Use of deprecated "Deno.isatty()" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.
warning: Use of deprecated "Deno.stdin.rid" API. This API will be removed in Deno 2. Run again with DENO_VERBOSE_WARNINGS=1 to get more details.
pkgx 1.1.6
What I don’t get is that when I compile it locally I don’t get these warnings. Only in the CI/CD produced binaries. Which means I didn’t see this, but all my users did.
6 Replies
mxcl
mxclOP10mo ago
Note, that I have fixed the deprecation warnings and intend to release a point release. I am just trying to ensure that in the future I don’t deliver my users a bunch of warnings they don't care about
Deno AI Helper
Deno AI Helper10mo ago
To avoid deprecation warnings in compiled binaries, you should ensure that your code does not use any deprecated APIs. The warnings you're seeing (Deno.stderr.rid, Deno.isatty(), and Deno.stdin.rid) indicate that these APIs are deprecated and will be removed in Deno 2. Here are some steps you can take to address the deprecation warnings: 1. Update Your Code: Replace the deprecated APIs with their recommended alternatives. For example, instead of using Deno.stderr.rid, you can use the new Deno.stderr as a WritableStream. Similarly, replace Deno.isatty() with the new API if available. 2. Ensure Consistent Deno Versions: Make sure that the Deno version used in your local development environment is the same as the one used in your CI/CD pipeline. This will help you catch deprecation warnings early. 3. Run with Verbose Warnings: To get more details about the deprecation warnings, you can run your code with the DENO_VERBOSE_WARNINGS=1 environment variable set. This might provide additional information on what needs to be changed. 4. Check Release Notes: Refer to the Deno release notes for the version you are using to see if there are any breaking changes or deprecations that affect your code. The documentation mentions that Deno.File has been renamed to Deno.FsFile in Deno 1.19, for example, so you should check for similar notes regarding the APIs you are using. 5. Compile with the Latest Deno Version: Before compiling your code, make sure you are using the latest stable version of Deno. This ensures that you have all the latest features and deprecation notices. 6. Test Binaries Before Release: Test the compiled binaries in an environment similar to your users' to catch any warnings or issues that might not appear in your
Deno AI Helper
Deno AI Helper10mo ago
development environment. If you've updated your code and are still seeing these warnings in the CI/CD pipeline but not locally, it's possible that the Deno version in the CI/CD environment is different from your local version, or there might be some environment-specific differences causing these warnings to show up. Ensure that the Deno version is consistent across environments and that you're testing the binaries in a clean environment that mimics your users' setups as closely as possible. Remember, it's important to address these warnings before Deno 2 is released, as the deprecated APIs will be removed, potentially breaking your application if it still relies on them. 🦕
mxcl
mxclOP10mo ago
I cannot remove all the deprecated API usages. I need to use the dnt tool to publish to npm which does not yet support all the deprecated APIs basically you are saying using deno means we cannot avoid announcing to the user about deprecated APIs in a compiled binary Additionally we absolutely there is no way we can see to not use some of the deprecated APIs, eg. the unstable API for flock which we use has not been updated, it still requires a rid for now we will pin to 1.39
Ayo Reis
Ayo Reis10mo ago
I think there is something like --quiet, not sure, check the docs.
Leokuma
Leokuma10mo ago
deno compile --quiet main.ts
deno compile --quiet main.ts