Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(plugin-nm): handle supportedArchitectures #4343

Merged
merged 1 commit into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .yarn/versions/cb320125.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/plugin-nm": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The following changes only affect people writing Yarn plugins:
- applies hoisting algorithm on aliased dependencies
- reinstalls modules that have their directories removed from node_modules by the user
- improves portal hoisting
- supports `supportedArchitectures`

### Bugfixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1722,4 +1722,31 @@ describe(`Node_Modules`, () => {
});
}),
);

it(`should support supportedArchitectures`,
makeTemporaryEnv(
{
dependencies: {
native: `1.0.0`,
},
},
async ({path, run}) => {
await xfs.writeJsonPromise(ppath.join(path, Filename.rc), {
larixer marked this conversation as resolved.
Show resolved Hide resolved
nodeLinker: `node-modules`,
supportedArchitectures: {
os: [`foo`],
cpu: [`x64`, `x86`],
},
});

await expect(run(`install`)).resolves.toMatchObject({code: 0});

await expect(xfs.readdirPromise(ppath.join(path, Filename.nodeModules))).resolves.toEqual([
`.yarn-state.yml`,
`native`,
`native-foo-x64`,
`native-foo-x86`,
]);
}),
);
});
2 changes: 1 addition & 1 deletion packages/plugin-nm/sources/NodeModulesLinker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class NodeModulesInstaller implements Installer {
}

// We don't link the package at all if it's for an unsupported platform
if (!jsInstallUtils.checkManifestCompatibility(pkg))
if (!structUtils.isPackageCompatible(pkg, this.opts.project.configuration.getSupportedArchitectures()))
return {packageLocation: null, buildDirective: null};

const packageDependencies = new Map<string, string | [string, string] | null>();
Expand Down