Skip to content

Commit

Permalink
chore(plugin-pnpm): use NodeLinker enum
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Oct 24, 2023
1 parent ad8e7b5 commit cee4fd1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/plugin-pnpm/sources/PnpmLinker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Descriptor, FetchResult, formatUtils, Installer, InstallPackageExtraApi, Linker, LinkOptions, LinkType, Locator, LocatorHash, Manifest, MessageName, MinimalLinkOptions, Package, Project, miscUtils, structUtils, WindowsLinkType} from '@yarnpkg/core';
import {Filename, PortablePath, setupCopyIndex, ppath, xfs, DirentNoPath} from '@yarnpkg/fslib';
import {jsInstallUtils} from '@yarnpkg/plugin-pnp';
import {NodeLinker, jsInstallUtils} from '@yarnpkg/plugin-pnp';
import {UsageError} from 'clipanion';

export type PnpmCustomData = {
Expand Down Expand Up @@ -76,7 +76,7 @@ export class PnpmLinker implements Linker {
}

private isEnabled(opts: MinimalLinkOptions) {
return opts.project.configuration.get(`nodeLinker`) === `pnpm`;
return opts.project.configuration.get(`nodeLinker`) === NodeLinker.PNPM;
}
}

Expand Down Expand Up @@ -170,7 +170,7 @@ class PnpmInstaller implements Installer {
}

async attachInternalDependencies(locator: Locator, dependencies: Array<[Descriptor, Locator]>) {
if (this.opts.project.configuration.get(`nodeLinker`) !== `pnpm`)
if (this.opts.project.configuration.get(`nodeLinker`) !== NodeLinker.PNPM)
return;

// We don't install those packages at all, because they can't be used anyway
Expand Down Expand Up @@ -264,7 +264,7 @@ class PnpmInstaller implements Installer {
async finalizeInstall() {
const storeLocation = getStoreLocation(this.opts.project);

if (this.opts.project.configuration.get(`nodeLinker`) !== `pnpm`) {
if (this.opts.project.configuration.get(`nodeLinker`) !== NodeLinker.PNPM) {
await xfs.removePromise(storeLocation);
} else {
let extraneous: Set<Filename>;
Expand Down Expand Up @@ -295,7 +295,7 @@ class PnpmInstaller implements Installer {
await this.asyncActions.wait();

await removeIfEmpty(storeLocation);
if (this.opts.project.configuration.get(`nodeLinker`) !== `node-modules`)
if (this.opts.project.configuration.get(`nodeLinker`) !== NodeLinker.NODE_MODULES)
await removeIfEmpty(getNodeModulesLocation(this.opts.project));

return {
Expand Down

0 comments on commit cee4fd1

Please sign in to comment.