mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
chore: upgrade bun to 1.2.18 (#6218)
This commit is contained in:
@@ -42,7 +42,7 @@ RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VER
|
||||
RUN /usr/local/bin/python3 -m pip install pip-tools
|
||||
|
||||
# Bun
|
||||
COPY --from=oven/bun:1.2.4 /usr/local/bin/bun /usr/bin/bun
|
||||
COPY --from=oven/bun:1.2.18 /usr/local/bin/bun /usr/bin/bun
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ COPY --from=builder /windmill/target/release/windmill ${APP}/windmill
|
||||
|
||||
COPY --from=denoland/deno:2.2.1 --chmod=755 /usr/bin/deno /usr/bin/deno
|
||||
|
||||
COPY --from=oven/bun:1.2.4 /usr/local/bin/bun /usr/bin/bun
|
||||
COPY --from=oven/bun:1.2.18 /usr/local/bin/bun /usr/bin/bun
|
||||
|
||||
COPY --from=php:8.3.7-cli /usr/local/bin/php /usr/bin/php
|
||||
COPY --from=composer:2.7.6 /usr/bin/composer /usr/bin/composer
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
const bo = await Bun.build({
|
||||
entrypoints: ["./main.ts"],
|
||||
outdir: "./out",
|
||||
plugins: [p],
|
||||
external: ["*"],
|
||||
});
|
||||
try {
|
||||
await Bun.build({
|
||||
entrypoints: ["./main.ts"],
|
||||
outdir: "./out",
|
||||
plugins: [p],
|
||||
external: ["*"],
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
console.log("Failed to build bundle");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const fs = require("fs/promises");
|
||||
|
||||
@@ -12,66 +18,58 @@ const captureVersion =
|
||||
|
||||
import { semver } from "bun";
|
||||
|
||||
if (!bo.success) {
|
||||
bo.logs.forEach((l) => console.log(l));
|
||||
console.log("Failed to build bundle");
|
||||
process.exit(1);
|
||||
} else {
|
||||
let content = await fs.readFile("./out/main.js", { encoding: "utf8" });
|
||||
const imports = new Bun.Transpiler().scanImports(
|
||||
content.replaceAll("__require", "require")
|
||||
);
|
||||
let content = await fs.readFile("./out/main.js", { encoding: "utf8" });
|
||||
const imports = new Bun.Transpiler().scanImports(
|
||||
content.replaceAll("__require", "require")
|
||||
);
|
||||
|
||||
const dependencies = {};
|
||||
for (const i of imports) {
|
||||
let [_, name, version] = i.path.match(captureVersion) ?? [];
|
||||
if (name == undefined) {
|
||||
throw Error("Unrecognized import: " + i.path);
|
||||
}
|
||||
if (name.startsWith("node:")) {
|
||||
continue;
|
||||
}
|
||||
let splitted = name.split("/");
|
||||
if (splitted.length > 2) {
|
||||
name = splitted.slice(0, 2).join("/");
|
||||
}
|
||||
if (version == undefined) {
|
||||
if (dependencies[name] == undefined) {
|
||||
dependencies[name] = [];
|
||||
}
|
||||
} else {
|
||||
if (dependencies[name] == undefined) {
|
||||
dependencies[name] = [version];
|
||||
} else if (!dependencies[name].includes(version)) {
|
||||
dependencies[name].push(version);
|
||||
}
|
||||
}
|
||||
const dependencies = {};
|
||||
for (const i of imports) {
|
||||
let [_, name, version] = i.path.match(captureVersion) ?? [];
|
||||
if (name == undefined) {
|
||||
throw Error("Unrecognized import: " + i.path);
|
||||
}
|
||||
const resolvedDeps = {};
|
||||
for (const i in dependencies) {
|
||||
const versions = dependencies[i];
|
||||
resolvedDeps[i] =
|
||||
versions.length == 0
|
||||
? "latest"
|
||||
: versions.length == 1
|
||||
? versions[0]
|
||||
: reduceIntersect(versions, i);
|
||||
if (name.startsWith("node:")) {
|
||||
continue;
|
||||
}
|
||||
await Bun.write(
|
||||
"./package.json",
|
||||
JSON.stringify({ dependencies: resolvedDeps }, null, 2)
|
||||
);
|
||||
|
||||
function reduceIntersect(versions, name) {
|
||||
console.log(
|
||||
`multiple versions detected for ${name}: ${versions.join(", ")}`
|
||||
);
|
||||
const regex = /^(?:\^|~|<|<=|>=|>)+/g;
|
||||
|
||||
const r = versions
|
||||
.map((x) => [x, x.replace(regex, "")])
|
||||
.sort((a, b) => semver.order(a[1], b[1]))[0][0];
|
||||
console.log(`resolved to ${r} for ${name}`);
|
||||
return r;
|
||||
let splitted = name.split("/");
|
||||
if (splitted.length > 2) {
|
||||
name = splitted.slice(0, 2).join("/");
|
||||
}
|
||||
if (version == undefined) {
|
||||
if (dependencies[name] == undefined) {
|
||||
dependencies[name] = [];
|
||||
}
|
||||
} else {
|
||||
if (dependencies[name] == undefined) {
|
||||
dependencies[name] = [version];
|
||||
} else if (!dependencies[name].includes(version)) {
|
||||
dependencies[name].push(version);
|
||||
}
|
||||
}
|
||||
}
|
||||
const resolvedDeps = {};
|
||||
for (const i in dependencies) {
|
||||
const versions = dependencies[i];
|
||||
resolvedDeps[i] =
|
||||
versions.length == 0
|
||||
? "latest"
|
||||
: versions.length == 1
|
||||
? versions[0]
|
||||
: reduceIntersect(versions, i);
|
||||
}
|
||||
await Bun.write(
|
||||
"./package.json",
|
||||
JSON.stringify({ dependencies: resolvedDeps }, null, 2)
|
||||
);
|
||||
|
||||
function reduceIntersect(versions, name) {
|
||||
console.log(`multiple versions detected for ${name}: ${versions.join(", ")}`);
|
||||
const regex = /^(?:\^|~|<|<=|>=|>)+/g;
|
||||
|
||||
const r = versions
|
||||
.map((x) => [x, x.replace(regex, "")])
|
||||
.sort((a, b) => semver.order(a[1], b[1]))[0][0];
|
||||
console.log(`resolved to ${r} for ${name}`);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -418,17 +418,17 @@ try {{
|
||||
|
||||
}}
|
||||
|
||||
const bo = await Bun.build({{
|
||||
entrypoints: ["{job_dir}/wrapper.mjs"],
|
||||
outdir: "./",
|
||||
target: "node",
|
||||
plugins: [p],
|
||||
external: fileNames,
|
||||
minify: true,
|
||||
}});
|
||||
|
||||
if (!bo.success) {{
|
||||
bo.logs.forEach((l) => console.log(l));
|
||||
try {{
|
||||
await Bun.build({{
|
||||
entrypoints: ["{job_dir}/wrapper.mjs"],
|
||||
outdir: "./",
|
||||
target: "node",
|
||||
plugins: [p],
|
||||
external: fileNames,
|
||||
minify: true,
|
||||
}});
|
||||
}} catch(err) {{
|
||||
console.log(err);
|
||||
console.log("Failed to build node bundle");
|
||||
process.exit(1);
|
||||
}}
|
||||
@@ -462,21 +462,21 @@ plugin(p)
|
||||
r#"
|
||||
{}
|
||||
|
||||
const bo = await Bun.build({{
|
||||
entrypoints: ["{job_dir}/main.ts"],
|
||||
outdir: "./",
|
||||
target: "{}",
|
||||
plugins: [p],
|
||||
external: ["electron"],
|
||||
minify: {{
|
||||
identifiers: false,
|
||||
syntax: true,
|
||||
whitespace: false
|
||||
}},
|
||||
}});
|
||||
|
||||
if (!bo.success) {{
|
||||
bo.logs.forEach((l) => console.log(l));
|
||||
try {{
|
||||
await Bun.build({{
|
||||
entrypoints: ["{job_dir}/main.ts"],
|
||||
outdir: "./",
|
||||
target: "{}",
|
||||
plugins: [p],
|
||||
external: ["electron"],
|
||||
minify: {{
|
||||
identifiers: false,
|
||||
syntax: true,
|
||||
whitespace: false
|
||||
}},
|
||||
}});
|
||||
}} catch(err) {{
|
||||
console.log(err)
|
||||
console.log("Failed to build node bundle");
|
||||
process.exit(1);
|
||||
}}
|
||||
|
||||
@@ -20,7 +20,7 @@ RUN /usr/local/bin/python3 -m pip install pip-tools
|
||||
# Install UV
|
||||
RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.5.15/uv-installer.sh | sh && mv /root/.local/bin/uv /usr/local/bin/uv
|
||||
|
||||
COPY --from=oven/bun:1.2.4 /usr/local/bin/bun /usr/bin/bun
|
||||
COPY --from=oven/bun:1.2.18 /usr/local/bin/bun /usr/bin/bun
|
||||
|
||||
# add the docker client to call docker from a worker if enabled
|
||||
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
|
||||
|
||||
@@ -19,7 +19,7 @@ RUN /usr/local/bin/python3 -m pip install pip-tools
|
||||
# Install UV
|
||||
RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.5.15/uv-installer.sh | sh && mv /root/.local/bin/uv /usr/local/bin/uv
|
||||
|
||||
COPY --from=oven/bun:1.2.4 /usr/local/bin/bun /usr/bin/bun
|
||||
COPY --from=oven/bun:1.2.18 /usr/local/bin/bun /usr/bin/bun
|
||||
|
||||
# add the docker client to call docker from a worker if enabled
|
||||
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
|
||||
|
||||
Reference in New Issue
Block a user