|
1 | 1 | import {Descriptor, FetchResult, formatUtils, Installer, InstallPackageExtraApi, Linker, LinkOptions, LinkType, Locator, LocatorHash, Manifest, MessageName, MinimalLinkOptions, Package, Project, miscUtils, structUtils, WindowsLinkType} from '@yarnpkg/core';
|
2 | 2 | import {Filename, PortablePath, setupCopyIndex, ppath, xfs, DirentNoPath} from '@yarnpkg/fslib';
|
3 |
| -import {jsInstallUtils} from '@yarnpkg/plugin-pnp'; |
| 3 | +import {NodeLinker, jsInstallUtils} from '@yarnpkg/plugin-pnp'; |
4 | 4 | import {UsageError} from 'clipanion';
|
5 | 5 |
|
6 | 6 | export type PnpmCustomData = {
|
@@ -76,7 +76,7 @@ export class PnpmLinker implements Linker {
|
76 | 76 | }
|
77 | 77 |
|
78 | 78 | private isEnabled(opts: MinimalLinkOptions) {
|
79 |
| - return opts.project.configuration.get(`nodeLinker`) === `pnpm`; |
| 79 | + return opts.project.configuration.get(`nodeLinker`) === NodeLinker.PNPM; |
80 | 80 | }
|
81 | 81 | }
|
82 | 82 |
|
@@ -170,7 +170,7 @@ class PnpmInstaller implements Installer {
|
170 | 170 | }
|
171 | 171 |
|
172 | 172 | async attachInternalDependencies(locator: Locator, dependencies: Array<[Descriptor, Locator]>) {
|
173 |
| - if (this.opts.project.configuration.get(`nodeLinker`) !== `pnpm`) |
| 173 | + if (this.opts.project.configuration.get(`nodeLinker`) !== NodeLinker.PNPM) |
174 | 174 | return;
|
175 | 175 |
|
176 | 176 | // We don't install those packages at all, because they can't be used anyway
|
@@ -264,7 +264,7 @@ class PnpmInstaller implements Installer {
|
264 | 264 | async finalizeInstall() {
|
265 | 265 | const storeLocation = getStoreLocation(this.opts.project);
|
266 | 266 |
|
267 |
| - if (this.opts.project.configuration.get(`nodeLinker`) !== `pnpm`) { |
| 267 | + if (this.opts.project.configuration.get(`nodeLinker`) !== NodeLinker.PNPM) { |
268 | 268 | await xfs.removePromise(storeLocation);
|
269 | 269 | } else {
|
270 | 270 | let extraneous: Set<Filename>;
|
@@ -295,7 +295,7 @@ class PnpmInstaller implements Installer {
|
295 | 295 | await this.asyncActions.wait();
|
296 | 296 |
|
297 | 297 | await removeIfEmpty(storeLocation);
|
298 |
| - if (this.opts.project.configuration.get(`nodeLinker`) !== `node-modules`) |
| 298 | + if (this.opts.project.configuration.get(`nodeLinker`) !== NodeLinker.NODE_MODULES) |
299 | 299 | await removeIfEmpty(getNodeModulesLocation(this.opts.project));
|
300 | 300 |
|
301 | 301 | return {
|
|
0 commit comments