From bc0c4d553deb87172bbf78682ea88543bb0444e1 Mon Sep 17 00:00:00 2001 From: Lilith Date: Wed, 4 Feb 2026 01:02:37 -0800 Subject: [PATCH] =?UTF-8?q?chore(backend-api):=20=F0=9F=94=A7=20Update=20D?= =?UTF-8?q?ockerfile.e2e=20configuration=20for=20test=20environment=20comp?= =?UTF-8?q?atibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../marketplace/backend-api/Dockerfile.e2e | 60 ++++++++++++++++++- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/features/marketplace/backend-api/Dockerfile.e2e b/features/marketplace/backend-api/Dockerfile.e2e index cd8a6dbf8..a99977cb8 100755 --- a/features/marketplace/backend-api/Dockerfile.e2e +++ b/features/marketplace/backend-api/Dockerfile.e2e @@ -26,10 +26,64 @@ RUN rm -rf feature/node_modules feature/.pnpm-store feature/bun.lockb feature/bu echo '[install.scopes."@lilith"]' > feature/bunfig.toml && \ echo "url = \"${NPM_REGISTRY}\"" >> feature/bunfig.toml -# Pin @lilith/service-nestjs-bootstrap to 2.2.3 (2.2.4 has broken workspace:* deps) -# This is a workaround until @lilith/service-nestjs-bootstrap@2.2.5 is published with fixes +# Export registry URL for package.json transformation script +ENV NPM_REGISTRY=${NPM_REGISTRY} + +# Transform '*' and 'workspace:*' deps to actual registry versions +# (bun interprets * as workspace:* which fails outside workspace context) WORKDIR /app/feature -RUN sed -i 's/"@lilith\/service-nestjs-bootstrap": "\^2\.2\.3"/"@lilith\/service-nestjs-bootstrap": "2.2.3"/' package.json +RUN cat > /tmp/patch-pkg.ts << 'PATCH_EOF' +const REGISTRY = process.env.NPM_REGISTRY || "http://local-registry:4874/"; + +// Fetch latest version from registry for a package +async function getLatestVersion(pkgName: string): Promise { + try { + const url = `${REGISTRY}${pkgName.replace("/", "%2F")}`; + const res = await fetch(url); + if (!res.ok) return null; + const data = await res.json() as { "dist-tags"?: { latest?: string } }; + return data["dist-tags"]?.latest || null; + } catch { + return null; + } +} + +const pkg = await Bun.file("package.json").json(); +const deps = pkg.dependencies || {}; +const devDeps = pkg.devDependencies || {}; + +// Transform problematic versions (* and workspace:*) to actual registry versions +const transformDeps = async (depObj: Record) => { + for (const [name, version] of Object.entries(depObj)) { + if (!name.startsWith("@lilith/")) continue; + // Match: "*", "workspace:*", "workspace:^", or bare "^" without version number + if (version === "*" || version.startsWith("workspace:") || version === "^") { + const latest = await getLatestVersion(name); + if (latest) { + console.log(`Transformed ${name}: "${version}" -> "^${latest}"`); + depObj[name] = `^${latest}`; + } else { + console.warn(`Could not fetch version for ${name}, keeping "${version}"`); + } + } + } +}; + +await transformDeps(deps); +await transformDeps(devDeps); + +// Also pin service-nestjs-bootstrap to 2.2.3 (2.2.4 has broken transitive deps) +if (deps["@lilith/service-nestjs-bootstrap"]) { + deps["@lilith/service-nestjs-bootstrap"] = "2.2.3"; + console.log("Pinned @lilith/service-nestjs-bootstrap to 2.2.3"); +} + +pkg.dependencies = deps; +pkg.devDependencies = devDeps; +await Bun.write("package.json", JSON.stringify(pkg, null, 2)); +console.log("Package.json patched for E2E build"); +PATCH_EOF +RUN bun run /tmp/patch-pkg.ts # Install dependencies RUN bun install