MCPcopy Create free account
hub / github.com/adobe/react-spectrum / afterAllInstalled

Function afterAllInstalled

lib/yarn-plugin-rsp-duplicates.js:23–59  ·  view source on GitHub ↗
(project)

Source from the content-addressed store, hash-verified

21 default: {
22 hooks: {
23 afterAllInstalled(project) {
24 let packages = new Map();
25 let hasRSP = false;
26 for (const pkg of project.storedPackages.values()) {
27 if (
28 !structUtils.isVirtualLocator(pkg) &&
29 (pkg.scope === 'react-aria' ||
30 pkg.scope === 'react-spectrum' ||
31 pkg.scope === 'react-stately')
32 ) {
33 let key = `@${pkg.scope}/${pkg.name}`;
34 if (!packages.has(key)) {
35 packages.set(key, new Set([pkg.version]));
36 } else {
37 packages.get(key).add(pkg.version);
38 }
39 hasRSP ||= pkg.scope === 'react-spectrum';
40 }
41 }
42
43 let errors = [];
44 for (let [pkg, versions] of packages) {
45 if (versions.size > 1) {
46 errors.push(` ${pkg}: ${[...versions].join(', ')}`);
47 }
48 }
49
50 if (errors.length) {
51 errors.sort();
52 throw new ReportError(
53 MessageName.EXCEPTION,
54 `Found multiple installed versions of ${hasRSP ? 'React Spectrum' : 'React Aria'} packages: \n\n` +
55 errors.join('\n') +
56 '\n\n You may be able to fix this by running `yarn dedupe`.'
57 );
58 }
59 }
60 }
61 }
62 };

Callers

nothing calls this directly

Calls 5

pushMethod · 0.80
hasMethod · 0.65
addMethod · 0.65
sortMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected