Skip to content

Conversation

@nazreen
Copy link
Contributor

@nazreen nazreen commented Nov 4, 2025

The verify lockfiles CI job expects lockfiles to be generated by pnpm v8 but in some cases a different version of pnpm might be used - leading to incorrect lockfiles being generated.

Problem

Currently, running pnpm lockfiles:generate on a local machine may result in lockfiles that would be rejected by the verify lockfiles CI job. This can happen due to the generate lockfiles script using the local machine's version of pnpm, disregarding the packageManager version of pnpm from package.json. This results in lockfiles with lockfileVersion: 9.0 whereas the CI job expects lockfileVersion: 6.0

Changes

Validate that the pnpm version used matches the one set in package.json

@nazreen nazreen changed the title force pnpm v8 and lockfileVersion 6 generate lockfiles script: force pnpm v8 and lockfileVersion 6 Nov 4, 2025
@nazreen nazreen marked this pull request as ready for review November 4, 2025 06:38
@nazreen nazreen requested a review from tinom9 November 4, 2025 06:38
@nazreen nazreen force-pushed the update-gen-lockfiles-script branch from 9d58f43 to e3ec16e Compare November 5, 2025 07:34
@nazreen nazreen changed the title generate lockfiles script: force pnpm v8 and lockfileVersion 6 generate lockfiles script: throw if pnpm used is not v8 Nov 5, 2025
Comment on lines +56 to +63
function getExpectedVersionFromPackageJson() {
const packageJson = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8'));
const packageManager = packageJson.packageManager;
if (!packageManager?.startsWith('pnpm@')) {
throw new Error(`Invalid packageManager: ${packageManager || 'missing'}. Expected format: "[email protected]"`);
}
return packageManager.slice(5); // Remove "pnpm@" prefix
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes that we will always have fixed versions and no trailing hash (example here https://github.com/LayerZero-Labs/docs/blob/main/package.json#L102).

I think it's a safe assumption given the timeline of the repo though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants