Skip to content

Commit

Permalink
feat: update pnpm to v9 (#8901)
Browse files Browse the repository at this point in the history
## Proposed Changes

-
-
-
  • Loading branch information
zkochan authored May 21, 2024
1 parent 06d3e30 commit ac9a748
Show file tree
Hide file tree
Showing 6 changed files with 1,259 additions and 1,203 deletions.
2,397 changes: 1,221 additions & 1,176 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions scopes/dependencies/pnpm/get-virtual-store-dir-max-length.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function getVirtualStoreDirMaxLength() {
return process.platform === 'win32' ? 60 : 120;
}
6 changes: 4 additions & 2 deletions scopes/dependencies/pnpm/lynx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { Logger } from '@teambit/logger';
import toNerfDart from 'nerf-dart';
import { pnpmErrorToBitError } from './pnpm-error-to-bit-error';
import { readConfig } from './read-config';
import { getVirtualStoreDirMaxLength } from './get-virtual-store-dir-max-length';

const installsRunning: Record<string, Promise<any>> = {};
const cafsLocker = new Map<string, number>();
Expand Down Expand Up @@ -82,6 +83,7 @@ async function createStoreController(
fetchRetryMaxtimeout: options.networkConfig.fetchRetryMaxtimeout,
fetchRetryMintimeout: options.networkConfig.fetchRetryMintimeout,
fetchTimeout: options.networkConfig.fetchTimeout,
virtualStoreDirMaxLength: getVirtualStoreDirMaxLength(),
};
// We should avoid the recreation of store.
// The store holds cache that makes subsequent resolutions faster.
Expand Down Expand Up @@ -163,6 +165,7 @@ export async function getPeerDependencyIssues(
overrides: opts.overrides,
workspacePackages,
registries: registriesMap,
virtualStoreDirMaxLength: getVirtualStoreDirMaxLength(),
});
}

Expand Down Expand Up @@ -206,7 +209,6 @@ export async function install(
| 'nodeVersion'
| 'engineStrict'
| 'excludeLinksFromLockfile'
| 'peerDependencyRules'
| 'neverBuiltDependencies'
| 'ignorePackageManifest'
| 'hoistWorkspacePackages'
Expand Down Expand Up @@ -267,7 +269,6 @@ export async function install(
confirmModulesPurge: false,
storeDir: storeController.dir,
dedupePeerDependents: true,
dedupeInjectedDeps: options.dedupeInjectedDeps,
dir: rootDir,
storeController: storeController.ctrl,
workspacePackages,
Expand Down Expand Up @@ -296,6 +297,7 @@ export async function install(
depth: options.updateAll ? Infinity : 0,
disableRelinkLocalDirDeps: true,
hoistPattern,
virtualStoreDirMaxLength: getVirtualStoreDirMaxLength(),
};

let dependenciesChanged = false;
Expand Down
6 changes: 5 additions & 1 deletion scopes/dependencies/pnpm/pnpm-prune-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path';
import { difference } from 'lodash';
import { readCurrentLockfile } from '@pnpm/lockfile-file';
import { depPathToFilename } from '@pnpm/dependency-path';
import { getVirtualStoreDirMaxLength } from './get-virtual-store-dir-max-length';

/**
* Reads the private lockfile at node_modules/.pnpm/lock.yaml
Expand All @@ -13,7 +14,10 @@ export async function pnpmPruneModules(rootDir: string): Promise<void> {
const pkgDirs = await readPackageDirsFromVirtualStore(virtualStoreDir);
if (pkgDirs.length === 0) return;
const lockfile = await readCurrentLockfile(virtualStoreDir, { ignoreIncompatible: false });
const dirsShouldBePresent = Object.keys(lockfile?.packages ?? {}).map(depPathToFilename);
const virtualStoreDirMaxLength = getVirtualStoreDirMaxLength();
const dirsShouldBePresent = Object.keys(lockfile?.packages ?? {}).map((depPath) =>
depPathToFilename(depPath, virtualStoreDirMaxLength)
);
await Promise.all(difference(pkgDirs, dirsShouldBePresent).map((dir) => fs.remove(path.join(virtualStoreDir, dir))));
}

Expand Down
6 changes: 4 additions & 2 deletions scopes/dependencies/pnpm/pnpm.package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { join } from 'path';
import { readConfig } from './read-config';
import { pnpmPruneModules } from './pnpm-prune-modules';
import type { RebuildFn } from './lynx';
import { getVirtualStoreDirMaxLength } from './get-virtual-store-dir-max-length';

export class PnpmPackageManager implements PackageManager {
readonly name = 'pnpm';
Expand Down Expand Up @@ -103,14 +104,14 @@ export class PnpmPackageManager implements PackageManager {
nodeVersion: installOptions.nodeVersion ?? config.nodeVersion,
includeOptionalDeps: installOptions.includeOptionalDeps,
ignorePackageManifest: installOptions.ignorePackageManifest,
dedupeInjectedDeps: installOptions.dedupeInjectedDeps,
dedupeInjectedDeps: installOptions.dedupeInjectedDeps ?? false,
dryRun: installOptions.dryRun,
overrides: installOptions.overrides,
hoistPattern: installOptions.hoistPatterns ?? config.hoistPattern,
publicHoistPattern: config.shamefullyHoist
? ['*']
: ['@eslint/plugin-*', '*eslint-plugin*', '@prettier/plugin-*', '*prettier-plugin-*'],
hoistWorkspacePackages: installOptions.hoistWorkspacePackages,
hoistWorkspacePackages: installOptions.hoistWorkspacePackages ?? false,
hoistInjectedDependencies: installOptions.hoistInjectedDependencies,
packageImportMethod: installOptions.packageImportMethod ?? config.packageImportMethod,
preferOffline: installOptions.preferOffline,
Expand Down Expand Up @@ -313,6 +314,7 @@ export class PnpmPackageManager implements PackageManager {
default: 'https://registry.npmjs.org',
},
search,
virtualStoreDirMaxLength: getVirtualStoreDirMaxLength(),
})
).map(([projectPath, builtDependenciesHierarchy]) => {
pkgNamesToComponentIds(builtDependenciesHierarchy, { cache, getPkgLocation });
Expand Down
44 changes: 22 additions & 22 deletions workspace.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,32 @@
"@mdx-js/react": "1.6.22",
"@monaco-editor/react": "4.4.6",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
"@pnpm/client": "10.0.48",
"@pnpm/client": "11.0.6",
"@pnpm/colorize-semver-diff": "1.0.1",
"@pnpm/config": "20.4.3",
"@pnpm/core": "13.5.1",
"@pnpm/default-reporter": "12.5.0",
"@pnpm/dependency-path": "2.1.8",
"@pnpm/error": "5.0.3",
"@pnpm/fetch": "7.0.7",
"@pnpm/list": "^9.1.12",
"@pnpm/lockfile-file": "8.1.8",
"@pnpm/config": "21.2.2",
"@pnpm/core": "14.1.4",
"@pnpm/default-reporter": "13.1.1",
"@pnpm/dependency-path": "5.0.0",
"@pnpm/error": "6.0.1",
"@pnpm/fetch": "8.0.1",
"@pnpm/list": "^10.1.3",
"@pnpm/lockfile-file": "9.0.6",
"@pnpm/logger": "5.0.0",
"@pnpm/modules-yaml": "12.1.7",
"@pnpm/network.ca-file": "2.0.1",
"@pnpm/package-store": "19.0.17",
"@pnpm/parse-overrides": "4.0.3",
"@pnpm/pick-registry-for-package": "5.0.6",
"@pnpm/plugin-commands-publishing": "7.5.6",
"@pnpm/plugin-commands-rebuild": "10.0.21",
"@pnpm/modules-yaml": "13.1.1",
"@pnpm/network.ca-file": "3.0.0",
"@pnpm/package-store": "20.1.2",
"@pnpm/parse-overrides": "5.0.1",
"@pnpm/pick-registry-for-package": "6.0.1",
"@pnpm/plugin-commands-publishing": "8.1.4",
"@pnpm/plugin-commands-rebuild": "11.1.4",
"@pnpm/registry-mock": "3.4.0",
"@pnpm/reviewing.dependencies-hierarchy": "^2.1.11",
"@pnpm/reviewing.dependencies-hierarchy": "^3.1.3",
"@pnpm/semver-diff": "1.1.0",
"@pnpm/sort-packages": "5.0.9",
"@pnpm/store-connection-manager": "7.0.28",
"@pnpm/types": "9.4.2",
"@pnpm/worker": "0.3.15",
"@pnpm/workspace.pkgs-graph": "2.0.15",
"@pnpm/sort-packages": "6.0.2",
"@pnpm/store-connection-manager": "8.1.4",
"@pnpm/types": "10.1.0",
"@pnpm/worker": "1.0.2",
"@pnpm/workspace.pkgs-graph": "3.0.4",
"@prerenderer/prerenderer": "^1.2.0",
"@prerenderer/renderer-jsdom": "^1.1.2",
"@prerenderer/webpack-plugin": "^5.2.0",
Expand Down

0 comments on commit ac9a748

Please sign in to comment.