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

feat: update pnpm to v10 #9389

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions e2e/harmony/deps-graph.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import { generateRandomStr } from '@teambit/toolbox.string.random';
import { DEPS_GRAPH } from '@teambit/harmony.modules.feature-toggle';
import { addDistTag } from '@pnpm/registry-mock';
import { type LockfileFileV9 } from '@pnpm/lockfile.types';
import { type LockfileFile } from '@pnpm/lockfile.types';
import path from 'path';
import chai, { expect } from 'chai';
import stripAnsi from 'strip-ansi';
Expand Down Expand Up @@ -158,7 +158,7 @@ chai.use(require('chai-fs'));
});
describe('sign component and use dependency graph to generate a lockfile', () => {
let signOutput: string;
let lockfile: LockfileFileV9;
let lockfile: LockfileFile;
let signRemote;
before(async () => {
helper.command.export();
Expand Down
3,932 changes: 1,724 additions & 2,208 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import path from 'path';
import { DependenciesGraph } from '@teambit/scope.objects';
import { type LockfileFileV9 } from '@pnpm/lockfile.types';
import { type LockfileFile } from '@pnpm/lockfile.types';
import { convertLockfileToGraph, convertGraphToLockfile } from './lockfile-deps-graph-converter';
import { expect } from 'chai';

describe('convertLockfileToGraph simple case', () => {
const lockfile: LockfileFileV9 = {
const lockfile: LockfileFile = {
importers: {
'.': {},
'node_modules/.bit_roots/env': {
Expand Down
16 changes: 8 additions & 8 deletions scopes/dependencies/pnpm/lockfile-deps-graph-converter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type ProjectManifest } from '@pnpm/types';
import { type LockfileFileV9, type InlineSpecifiersResolvedDependencies } from '@pnpm/lockfile.types';
import { type LockfileFile, type LockfileFileProjectResolvedDependencies } from '@pnpm/lockfile.types';
import * as dp from '@pnpm/dependency-path';
import { pick, partition } from 'lodash';
import {
Expand All @@ -13,7 +13,7 @@ import { type CalcDepsGraphOptions, type ComponentIdByPkgName } from '@teambit/d
import { getLockfileImporterId } from '@pnpm/lockfile.fs';

function convertLockfileToGraphFromCapsule(
lockfile: LockfileFileV9,
lockfile: LockfileFile,
{
componentRelativeDir,
componentIdByPkgName,
Expand All @@ -32,7 +32,7 @@ function convertLockfileToGraphFromCapsule(
}

function importerDepsToNeighbours(
importerDependencies: InlineSpecifiersResolvedDependencies,
importerDependencies: LockfileFileProjectResolvedDependencies,
lifecycle: 'dev' | 'runtime',
optional: boolean
): DependencyNeighbour[] {
Expand All @@ -45,7 +45,7 @@ function importerDepsToNeighbours(
}

export function convertLockfileToGraph(
lockfile: LockfileFileV9,
lockfile: LockfileFile,
{ pkgName, componentRootDir, componentRelativeDir, componentIdByPkgName }: Omit<CalcDepsGraphOptions, 'rootDir'>
): DependenciesGraph {
if (componentRootDir == null || pkgName == null) {
Expand Down Expand Up @@ -75,7 +75,7 @@ export function convertLockfileToGraph(
}

function _convertLockfileToGraph(
lockfile: LockfileFileV9,
lockfile: LockfileFile,
{
componentIdByPkgName,
directDependencies,
Expand All @@ -92,7 +92,7 @@ function _convertLockfileToGraph(
}

function buildEdges(
lockfile: LockfileFileV9,
lockfile: LockfileFile,
{ directDependencies }: { directDependencies: DependencyNeighbour[] }
): DependencyEdge[] {
const edges: DependencyEdge[] = [];
Expand Down Expand Up @@ -142,7 +142,7 @@ function extractDependenciesFromSnapshot(snapshot: any): DependencyNeighbour[] {
}

function buildPackages(
lockfile: LockfileFileV9,
lockfile: LockfileFile,
{ componentIdByPkgName }: { componentIdByPkgName: ComponentIdByPkgName }
): PackagesMap {
const packages: PackagesMap = new Map();
Expand Down Expand Up @@ -184,7 +184,7 @@ export function convertGraphToLockfile(
graph: DependenciesGraph,
manifests: Record<string, ProjectManifest>,
rootDir: string
): LockfileFileV9 {
): LockfileFile {
const packages = {};
const snapshots = {};
const allEdgeIds = new Set(graph.edges.map(({ id }) => id));
Expand Down
7 changes: 3 additions & 4 deletions scopes/dependencies/pnpm/pnpm.package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { VIRTUAL_STORE_DIR_MAX_LENGTH } from '@teambit/dependencies.pnpm.dep-path';
import { DEPS_GRAPH, isFeatureEnabled } from '@teambit/harmony.modules.feature-toggle';
import { Logger } from '@teambit/logger';
import { type LockfileFileV9 } from '@pnpm/lockfile.types';
import { type LockfileFile } from '@pnpm/lockfile.types';
import fs from 'fs';
import { memoize, omit } from 'lodash';
import { PeerDependencyIssuesByProjects } from '@pnpm/core';
Expand Down Expand Up @@ -85,7 +85,7 @@ export class PnpmPackageManager implements PackageManager {
manifests: Record<string, ProjectManifest>,
rootDir: string
) {
const lockfile: LockfileFileV9 = convertGraphToLockfile(dependenciesGraph, manifests, rootDir);
const lockfile: LockfileFile = convertGraphToLockfile(dependenciesGraph, manifests, rootDir);
Object.assign(lockfile, {
bit: {
restoredFromModel: true,
Expand Down Expand Up @@ -408,8 +408,7 @@ export class PnpmPackageManager implements PackageManager {
},
failOnMissingDependencies: false,
skipped: new Set(),
}),
{ forceSharedFormat: true }
})
);
const graph = convertLockfileToGraph(partialLockfile, opts);
return graph;
Expand Down
4 changes: 2 additions & 2 deletions scopes/scope/objects/models/dependencies-graph.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import semver from 'semver';
import { PackageInfo } from '@pnpm/lockfile.types';
import { LockfilePackageInfo } from '@pnpm/lockfile.types';
import * as dp from '@pnpm/dependency-path';

export type PackagesMap = Map<string, PackageAttributes>;

export type PackageAttributes = PackageInfo & {
export type PackageAttributes = LockfilePackageInfo & {
component?: {
scope: string;
name: string;
Expand Down
50 changes: 25 additions & 25 deletions workspace.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,35 @@
"@mdx-js/react": "1.6.22",
"@monaco-editor/react": "4.4.6",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
"@pnpm/client": "900.0.1",
"@pnpm/client": "1000.0.1",
"@pnpm/colorize-semver-diff": "1.0.1",
"@pnpm/config": "900.0.0",
"@pnpm/core": "900.0.1",
"@pnpm/default-reporter": "900.0.0",
"@pnpm/dependency-path": "900.0.0",
"@pnpm/error": "900.0.0",
"@pnpm/fetch": "900.0.0",
"@pnpm/list": "^900.0.0",
"@pnpm/lockfile.filtering": "^900.0.0",
"@pnpm/lockfile.fs": "^900.0.0",
"@pnpm/lockfile.types": "^900.0.0",
"@pnpm/logger": "900.0.0",
"@pnpm/modules-yaml": "900.0.0",
"@pnpm/config": "1001.0.0",
"@pnpm/core": "1001.0.1",
"@pnpm/default-reporter": "1001.0.0",
"@pnpm/dependency-path": "1000.0.0",
"@pnpm/error": "1000.0.1",
"@pnpm/fetch": "1000.1.0",
"@pnpm/list": "^1000.0.2",
"@pnpm/lockfile.filtering": "^1001.0.0",
"@pnpm/lockfile.fs": "^1001.1.0",
"@pnpm/lockfile.types": "^1001.0.0",
"@pnpm/logger": "1000.0.0",
"@pnpm/modules-yaml": "1000.0.0",
"@pnpm/network.ca-file": "3.0.0",
"@pnpm/node-fetch": "^1.0.0",
"@pnpm/package-store": "900.0.0",
"@pnpm/parse-overrides": "900.0.0",
"@pnpm/pick-registry-for-package": "900.0.0",
"@pnpm/plugin-commands-publishing": "900.0.1",
"@pnpm/plugin-commands-rebuild": "900.0.1",
"@pnpm/package-store": "1000.0.1",
"@pnpm/parse-overrides": "1000.0.1",
"@pnpm/pick-registry-for-package": "1000.0.0",
"@pnpm/plugin-commands-publishing": "1000.0.1",
"@pnpm/plugin-commands-rebuild": "1001.0.1",
"@pnpm/registry-mock": "3.44.0",
"@pnpm/reviewing.dependencies-hierarchy": "^900.0.0",
"@pnpm/reviewing.dependencies-hierarchy": "^1001.0.1",
"@pnpm/semver-diff": "1.1.0",
"@pnpm/sort-packages": "900.0.0",
"@pnpm/store-connection-manager": "900.0.1",
"@pnpm/types": "900.0.0",
"@pnpm/worker": "900.0.0",
"@pnpm/workspace.pkgs-graph": "900.0.1",
"@pnpm/sort-packages": "1000.0.0",
"@pnpm/store-connection-manager": "1000.0.1",
"@pnpm/types": "1000.0.0",
"@pnpm/worker": "1000.0.1",
"@pnpm/workspace.pkgs-graph": "1000.0.1",
"@prerenderer/prerenderer": "^1.2.0",
"@prerenderer/renderer-jsdom": "^1.1.2",
"@prerenderer/webpack-plugin": "^5.2.0",
Expand Down Expand Up @@ -160,7 +160,7 @@
"@teambit/defender.ui.test-loader": "^0.0.504",
"@teambit/defender.ui.test-table": "^0.0.510",
"@teambit/dependencies.modules.packages-excluder": "^1.0.8",
"@teambit/dependencies.pnpm.dep-path": "^0.0.2",
"@teambit/dependencies.pnpm.dep-path": "1.0.0",
"@teambit/design.buttons.action-button": "^0.0.2",
"@teambit/design.controls.menu": "^0.0.1",
"@teambit/design.elements.icon": "1.0.5",
Expand Down