Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
build: Fix pnpm lockfile
Browse files Browse the repository at this point in the history
Regenerates the lockfile so it no longer contains SSH git
repositories.
A pnpm hook is introduced to assert during pnpm install
that the lockfile does not contain SSH git repos.
  • Loading branch information
Inphi committed Aug 11, 2023
1 parent 4804504 commit 1764ee8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This function does not modify the lockfile. It asserts that packages do not use SSH
// when specifying git repository
function afterAllResolved(lockfile, context) {
const pkgs = lockfile['packages'];
for (const [pkg, entry] of Object.entries(pkgs)) {
const repo = entry.resolution['repo'];
if (repo !== undefined) {
if (repo.startsWith('[email protected]')) {
throw new Error(`Invalid git ssh specification found for package ${pkg}. Ensure sure that the dependencies do not reference SSH-based git repos before running installing them`);
}
}
}
return lockfile
}

module.exports = {
hooks: {
afterAllResolved
}
}
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1764ee8

Please sign in to comment.