From a6957f739e300810060040c15d17a743af21f562 Mon Sep 17 00:00:00 2001 From: Hector Ayala Date: Mon, 16 Dec 2024 14:13:16 -0400 Subject: [PATCH] Fix explanation for migrating to Deno 2 for nodeModulesDir (#1274) Co-authored-by: Jo Franchetti --- runtime/reference/migration_guide.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/runtime/reference/migration_guide.md b/runtime/reference/migration_guide.md index 9973aa8a5..5f3e9dc8c 100644 --- a/runtime/reference/migration_guide.md +++ b/runtime/reference/migration_guide.md @@ -117,19 +117,33 @@ Deno 1.x and Deno 2. - `nodeModulesDir` Using a boolean value for the `nodeModulesDir` and `--node-modules-dir` config -options has been deprecated in favor of multiple directory behavior options. If -you previously used `false,` use `none`. If previously using `true` or had no -value set up, use `auto`. - -See -[Node modules directory](https://docs.deno.com/runtime/fundamentals/configuration/#node-modules-directory) -for reference. +options has been deprecated in favor of selecting from multiple behavior +options. For this reason, the default value when the option is not set has +changed. ```diff - "nodeModulesDir": false | true + "nodeModulesDir": "none" | "auto" | "manual" + +- Default value without package.json: false (corresponding to "none") ++ Default value without package.json: "none" + +- Default value with package.json: true (corresponding to "auto") ++ Default value with package.json: "manual" ``` +If your project does not contain a `package.json` file, the default behavior +will remain unchanged. + +If your project contains a `package.json` file and you do not specify the +`nodeModulesDir` option, you must set it to `auto` to keep the default Deno 1.x +auto-installing behavior. The new default in Deno 2 is `manual`, which expects +the user to keep this directory up to date manually. + +See +[Node modules directory](https://docs.deno.com/runtime/fundamentals/configuration/#node-modules-directory) +for reference. + ## CLI changes - `deno bundle`