Skip to content

Commit d19009d

Browse files
committed
ref-policies-live.mjs: import encodeRefsClaim from dist, not src .ts
The live test's `import ... from '../src/jwt_claims.ts'` failed under plain node (no TS loader). Take encodeRefsClaim from the dist barrel that loadGitStorage already imports, so the script runs with `node`.
1 parent df4e54c commit d19009d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/code-storage-typescript/tests/ref-policies-live.mjs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { mkdtempSync, writeFileSync } from 'node:fs';
1212
import os from 'node:os';
1313
import path from 'node:path';
1414
import { fileURLToPath, pathToFileURL } from 'node:url';
15-
import { encodeRefsClaim } from '../src/jwt_claims.ts';
1615

1716
const __dirname = path.dirname(fileURLToPath(import.meta.url));
1817

@@ -116,6 +115,8 @@ function buildGitRemote(repoId, token) {
116115
return `${base}/${repoId}.git`.replace('://', `://t:${token}@`);
117116
}
118117

118+
let encodeRefsClaim;
119+
119120
async function loadGitStorage() {
120121
const candidates = [
121122
path.resolve(__dirname, '../dist/index.js'),
@@ -124,11 +125,13 @@ async function loadGitStorage() {
124125
for (const candidate of candidates) {
125126
if (existsSync(candidate)) {
126127
const mod = await import(pathToFileURL(candidate).href);
128+
encodeRefsClaim = mod.encodeRefsClaim;
127129
return mod.GitStorage ?? mod.default;
128130
}
129131
}
130-
const mod = await import('../src/index.ts');
131-
return mod.GitStorage;
132+
throw new Error(
133+
'GitStorage dist build not found. Run "pnpm --filter @pierre/storage build" first.'
134+
);
132135
}
133136

134137
async function main() {

0 commit comments

Comments
 (0)