5
0
mirror of https://github.com/astral-sh/setup-uv.git synced 2026-03-22 02:39:09 +00:00

Switch to ESM for source and test, use CommonJS for dist (#806)

This commit is contained in:
Kevin Stillhammer
2026-03-14 17:43:49 +01:00
committed by GitHub
parent f9070de1ea
commit fd8f376b22
23 changed files with 212259 additions and 231165 deletions

33
scripts/build-dist.mjs Normal file
View File

@@ -0,0 +1,33 @@
import { rm } from "node:fs/promises";
import { build } from "esbuild";
const builds = [
{
entryPoints: ["src/setup-uv.ts"],
outfile: "dist/setup/index.cjs",
staleOutfiles: ["dist/setup/index.mjs"],
},
{
entryPoints: ["src/save-cache.ts"],
outfile: "dist/save-cache/index.cjs",
staleOutfiles: ["dist/save-cache/index.mjs"],
},
{
entryPoints: ["src/update-known-checksums.ts"],
outfile: "dist/update-known-checksums/index.cjs",
staleOutfiles: ["dist/update-known-checksums/index.mjs"],
},
];
for (const { staleOutfiles, ...options } of builds) {
await Promise.all(
staleOutfiles.map((outfile) => rm(outfile, { force: true })),
);
await build({
bundle: true,
format: "cjs",
platform: "node",
target: "node24",
...options,
});
}