From 7fc967b7d04b3a7a699c28df9f75b67ce08c37b7 Mon Sep 17 00:00:00 2001 From: Joshua David Date: Sun, 29 May 2022 12:04:25 +1000 Subject: [PATCH] feat: set default nmMode to hardlinks-local --- .yarn/versions/f73c4856.yml | 2 ++ CHANGELOG.md | 1 + packages/gatsby/static/configuration/yarnrc.json | 2 +- packages/plugin-nm/sources/NodeModulesLinker.ts | 2 +- packages/plugin-nm/sources/index.ts | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .yarn/versions/f73c4856.yml diff --git a/.yarn/versions/f73c4856.yml b/.yarn/versions/f73c4856.yml new file mode 100644 index 000000000000..95b4c2dfa319 --- /dev/null +++ b/.yarn/versions/f73c4856.yml @@ -0,0 +1,2 @@ +releases: + "@yarnpkg/plugin-nm": major diff --git a/CHANGELOG.md b/CHANGELOG.md index 21c7100e2c71..2a2bca11a177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Yarn now accepts sponsorships! Please give a look at our [OpenCollective](https: - Some legacy layers have been sunset: - Plugins cannot access the Clipanion 2 APIs anymore (upgrade to [Clipanion 3](https://github.com/arcanis/clipanion)) - Plugins cannot access the internal copy of Yup anymore (use [Typanion](https://github.com/arcanis/typanion) instead) +- Set `nmMode` to `hardlinks-local` by default. ### **API Changes** diff --git a/packages/gatsby/static/configuration/yarnrc.json b/packages/gatsby/static/configuration/yarnrc.json index ca98cc7b839c..4fecd10b4c24 100644 --- a/packages/gatsby/static/configuration/yarnrc.json +++ b/packages/gatsby/static/configuration/yarnrc.json @@ -407,7 +407,7 @@ "description": "If set to `hardlinks-local` Yarn will utilize hardlinks to reduce disk space consumption inside `node_modules` directories in a current project. With `hardlinks-global` Yarn will use global content addressable storage to reduce `node_modules` size across all the projects using this option.", "type": "string", "enum": ["classic", "hardlinks-local", "hardlinks-global"], - "default": "classic" + "default": "hardlinks-local" }, "nodeLinker": { "_package": "@yarnpkg/plugin-pnp", diff --git a/packages/plugin-nm/sources/NodeModulesLinker.ts b/packages/plugin-nm/sources/NodeModulesLinker.ts index f46bbd4888f2..3a15e10c7d42 100644 --- a/packages/plugin-nm/sources/NodeModulesLinker.ts +++ b/packages/plugin-nm/sources/NodeModulesLinker.ts @@ -473,7 +473,7 @@ async function findInstallState(project: Project, {unrollAliases = false}: {unro if (locatorState.__metadata.version > STATE_FILE_VERSION) return null; - const nmMode = locatorState.__metadata.nmMode || NodeModulesMode.CLASSIC; + const nmMode = locatorState.__metadata.nmMode || NodeModulesMode.HARDLINKS_LOCAL; const locatorMap: NodeModulesLocatorMap = new Map(); const binSymlinks: BinSymlinkMap = new Map(); diff --git a/packages/plugin-nm/sources/index.ts b/packages/plugin-nm/sources/index.ts index e149b73ad537..53f33c79b3fb 100644 --- a/packages/plugin-nm/sources/index.ts +++ b/packages/plugin-nm/sources/index.ts @@ -40,7 +40,7 @@ const plugin: Plugin = { NodeModulesMode.HARDLINKS_LOCAL, NodeModulesMode.HARDLINKS_GLOBAL, ], - default: NodeModulesMode.CLASSIC, + default: NodeModulesMode.HARDLINKS_LOCAL, }, nmSelfReferences: { description: `If set to 'false' the workspace will not be allowed to require itself and corresponding self-referencing symlink will not be created`,