Skip to content

Commit 50508b2

Browse files
arcanisBYK
authored andcommitted
Fix: Reimplement part of the integrity check for workspaces (#4122)
**Summary** Fixes #3863. The integrity file doesn't currently support workspaces, which leads to #3863 (removing a workspace node_modules folder and running yarn doesn't do anything, because Yarn incorrectly assumes that everything is already done). This PR rewrites a good chunk of the integrity logic to support and fix this behavior. **Test plan** New and already existing automated tests.
1 parent f513948 commit 50508b2

File tree

4 files changed

+187
-93
lines changed

4 files changed

+187
-93
lines changed

src/cli/commands/install.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ export class Install {
352352
if (!patterns.length && !match.integrityFileMissing) {
353353
this.reporter.success(this.reporter.lang('nothingToInstall'));
354354
await this.createEmptyManifestFolders();
355-
await this.saveLockfileAndIntegrity(patterns);
355+
await this.saveLockfileAndIntegrity(patterns, workspaceLayout);
356356
return true;
357357
}
358358

@@ -675,7 +675,7 @@ export class Install {
675675
patterns,
676676
lockfileBasedOnResolver,
677677
this.flags,
678-
this.resolver.usedRegistries,
678+
workspaceLayout,
679679
this.scripts.getArtifacts(),
680680
);
681681

src/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export const CONFIG_DIRECTORY = getDirectory('config');
5959
export const LINK_REGISTRY_DIRECTORY = path.join(CONFIG_DIRECTORY, 'link');
6060
export const GLOBAL_MODULE_DIRECTORY = path.join(CONFIG_DIRECTORY, 'global');
6161

62+
export const NODE_MODULES_FOLDER = 'node_modules';
63+
6264
export const POSIX_GLOBAL_PREFIX = '/usr/local';
6365
export const FALLBACK_GLOBAL_PREFIX = path.join(userHome, '.yarn');
6466

0 commit comments

Comments
 (0)