Skip to content

Commit 0b09320

Browse files
authored
cli: bump undici version (#1469)
* cli: bump undici version * fix and changeset * fix test * format
1 parent 4e67e7a commit 0b09320

5 files changed

Lines changed: 36 additions & 20 deletions

File tree

.changeset/floppy-cows-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@openfn/cli': patch
3+
---
4+
5+
Update undici version

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"json-diff": "^1.0.6",
6767
"rimraf": "^6.1.3",
6868
"treeify": "^1.1.0",
69-
"undici": "6.24.1",
69+
"undici": "8.5.0",
7070
"ws": "^8.19.0",
7171
"yargs": "^17.7.2"
7272
},

packages/cli/src/projects/util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ export const getLightningUrl = (
108108
}
109109
const params = new URLSearchParams();
110110
snapshots?.forEach((snapshot) => params.append('snapshots[]', snapshot));
111-
return new URL(`/api/provision/${path}?${params.toString()}`, endpoint);
111+
const query = params.toString();
112+
return new URL(`/api/provision/${path}${query ? `?${query}` : ''}`, endpoint);
112113
};
113114

114115
// TODO move to client.ts

packages/cli/test/projects/deploy.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { writeFile } from 'node:fs/promises';
22
import test from 'ava';
33
import mock from 'mock-fs';
44
import path from 'node:path';
5+
import { createRequire } from 'node:module';
56
import Project, { generateWorkflow } from '@openfn/project';
67
import { createMockLogger } from '@openfn/logger';
78
import createLightningServer from '@openfn/lightning-mock';
@@ -29,15 +30,24 @@ const ENDPOINT = `http://localhost:${port}`;
2930
const projectYaml = myProject_yaml.replace('https://app.openfn.org', ENDPOINT);
3031
const two_workflows_yaml = twowfs.replace('https://app.openfn.org', ENDPOINT);
3132

33+
const require = createRequire(import.meta.url);
34+
3235
const mockFs = (paths: Record<string, string>) => {
3336
// ensure this path is available to pnpm (needed by deps for some reason??)
3437
// Note: loading all of pnpm takes ~7 seconds per test
3538
// this workaround cuts out that delay entirely
3639
const iconv = path.resolve(
3740
'../../node_modules/.pnpm/iconv-lite@0.4.24/node_modules/iconv-lite/encodings'
3841
);
42+
// undici v8 reads its llhttp WASM from disk on the first request, so keep
43+
// that dir visible or fetches to the mock server fail with ENOENT
44+
const undiciLlhttp = path.join(
45+
path.dirname(require.resolve('undici')),
46+
'lib/llhttp'
47+
);
3948
mock({
4049
[iconv]: mock.load(iconv, {}),
50+
[undiciLlhttp]: mock.load(undiciLlhttp, {}),
4151
...paths,
4252
});
4353
};

pnpm-lock.yaml

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)