Skip to content

Commit ff73805

Browse files
committed
Improve debug logging and update bundling configuration for workspace packages
1 parent 2d41988 commit ff73805

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

packages/ddb-publisher/scripts/bundle-release.mjs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ const outFile = resolve(outDir, "index.cjs");
2020
await rm(outDir, { recursive: true, force: true });
2121
await mkdir(dirname(outFile), { recursive: true });
2222

23+
const schemasRoot = resolve(repoRoot, "packages/events");
24+
25+
// eslint-disable-next-line no-console
26+
console.log("[bundle-release] repoRoot=", repoRoot);
27+
// eslint-disable-next-line no-console
28+
console.log("[bundle-release] packageRoot=", packageRoot);
29+
// eslint-disable-next-line no-console
30+
console.log("[bundle-release] schemasRoot=", schemasRoot);
31+
// eslint-disable-next-line no-console
32+
console.log("[bundle-release] outFile=", outFile);
33+
2334
await esbuild.build({
2435
absWorkingDir: repoRoot,
2536
entryPoints: [resolve(packageRoot, "src/cli.ts")],
@@ -30,7 +41,7 @@ await esbuild.build({
3041
target: "node20",
3142
format: "cjs",
3243
sourcemap: false,
33-
logLevel: "info",
44+
logLevel: "debug",
3445
banner: {
3546
js: [
3647
"// Polyfill for libs that reference import.meta.url even in CJS builds (e.g. yargs-parser)",
@@ -39,13 +50,20 @@ await esbuild.build({
3950
},
4051
define: {
4152
"import.meta.url": "globalThis.__IMPORT_META_URL__",
53+
// yargs may reference `import.meta.resolve(...)` but we bundle as CJS.
54+
// Make it explicitly unavailable to avoid esbuild emitting confusing debug warnings.
55+
"import.meta.resolve": "undefined",
4256
},
4357
alias: {
44-
// In CI, the workspace package may not be built/linked into node_modules.
45-
// Use an absolute path: esbuild resolves aliases relative to the current working directory.
58+
// Bundle against the workspace sources instead of relying on the package
59+
// being built/linked into node_modules.
4660
"@nhsdigital/nhs-notify-event-schemas-supplier-config": resolve(
47-
repoRoot,
48-
"packages/events",
61+
schemasRoot,
62+
"src/index.ts",
63+
),
64+
"@nhsdigital/nhs-notify-event-schemas-supplier-config/src": resolve(
65+
schemasRoot,
66+
"src",
4967
),
5068
},
5169
});

0 commit comments

Comments
 (0)