Skip to content
Open
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
21 changes: 11 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ jobs:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
version: 10.34.4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm run check:pnpm-version
- run: pnpm run format:check
- run: pnpm build
- run: pnpm api:check
Expand All @@ -41,7 +42,7 @@ jobs:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
version: 10.34.4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
Expand All @@ -61,7 +62,7 @@ jobs:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
version: 10.34.4
- uses: actions/setup-node@v4
with:
node-version: 22
Expand Down Expand Up @@ -104,7 +105,7 @@ jobs:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
version: 10.34.4
- uses: oven-sh/setup-bun@v2
if: matrix.bun
with:
Expand Down Expand Up @@ -143,7 +144,7 @@ jobs:
- uses: pnpm/action-setup@v4
if: steps.should-run.outputs.run == 'true'
with:
version: 10
version: 10.34.4

- uses: actions/setup-node@v4
if: steps.should-run.outputs.run == 'true'
Expand Down Expand Up @@ -189,7 +190,7 @@ jobs:
- uses: pnpm/action-setup@v4
if: steps.should-run.outputs.run == 'true'
with:
version: 10
version: 10.34.4

- uses: actions/setup-node@v4
if: steps.should-run.outputs.run == 'true'
Expand Down Expand Up @@ -217,7 +218,7 @@ jobs:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
version: 10.34.4
- uses: actions/setup-node@v4
with:
node-version: 22
Expand All @@ -233,7 +234,7 @@ jobs:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
version: 10.34.4
- uses: actions/setup-node@v4
with:
node-version: 22
Expand All @@ -258,7 +259,7 @@ jobs:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
version: 10.34.4
- uses: actions/setup-node@v4
with:
node-version: 22
Expand All @@ -283,7 +284,7 @@ jobs:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
version: 10.34.4
- uses: actions/setup-node@v4
with:
node-version: 22
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx pnpm format:check && npx pnpm build && npx pnpm test
npx pnpm check:pnpm-version && npx pnpm format:check && npx pnpm build && npx pnpm test
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@
"engines": {
"node": ">=20"
},
"packageManager": "pnpm@10.34.4",
"scripts": {
"build": "tsup",
"check:pnpm-version": "node scripts/check-pnpm-version.mjs",
"test": "vitest run --exclude 'test/chains/stellar/properties.test.ts' --exclude 'test/leaks/scan-leak.test.ts' --exclude 'test/leaks/heap-snapshot.test.ts' && pnpm --filter @wraith-protocol/sdk-svelte test",
"docs": "typedoc",
"test:exports": "node test/smoke/run.mjs",
Expand Down
36 changes: 36 additions & 0 deletions scripts/check-pnpm-version.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { execFileSync } from 'node:child_process';

const packageJsonPath = fileURLToPath(new URL('../package.json', import.meta.url));
const { packageManager } = JSON.parse(readFileSync(packageJsonPath, 'utf8'));

if (!packageManager) {
console.error('error: package.json has no "packageManager" field');
process.exit(1);
}

const [name, pinnedVersion] = packageManager.split('@');
const pinnedMajor = Number(pinnedVersion.split('.')[0]);

let actualVersion;
try {
actualVersion = execFileSync('pnpm', ['--version'], { encoding: 'utf8' }).trim();
} catch {
console.error('error: pnpm is not available on PATH');
process.exit(1);
}

const actualMajor = Number(actualVersion.split('.')[0]);

if (actualMajor !== pinnedMajor) {
console.error(
`error: pnpm major version mismatch: lockfile pinned to ${packageManager}, but running pnpm@${actualVersion}`,
);
console.error(
'Re-run install with the pinned pnpm major before modifying the lockfile.',
);
process.exit(1);
}

console.log(`ok: pnpm@${actualVersion} matches ${packageManager}`);
Loading