mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 08:01:25 +00:00
1f64715043
* codebases * codebases * foo * foo * foo * foo * fix(frontend): Disable the insert button when required fields are empty strings (#3659) * fix(frontend): use normal password mask for the sensitive fields of the resource editor * handle super admins in password arg input * chore(main): release 1.323.2 (#3660) * chore(main): release 1.323.2 * Apply automatic changes --------- Co-authored-by: rubenfiszel <rubenfiszel@users.noreply.github.com> * foo * all * s3_helpers move * progress * all * progress * progress * progress * progress * codebase final * update without ee * sqlx * all * all * all * all * all * all * all * all * all * all * all * all * all * all * all * update * all * all * all --------- Co-authored-by: Faton Ramadani <faton.ramadani14@gmail.com> Co-authored-by: rubenfiszel <rubenfiszel@users.noreply.github.com>
77 lines
2.0 KiB
JavaScript
77 lines
2.0 KiB
JavaScript
const bo = await Bun.build({
|
|
entrypoints: ["./main.ts"],
|
|
outdir: "./out",
|
|
plugins: [p],
|
|
external: ["*"],
|
|
});
|
|
|
|
const fs = require("fs/promises");
|
|
|
|
const captureVersion =
|
|
/^((?:\@[^\/\@]+\/[^\/\@]+)|(?:[^\/\@]+))(?:\@([^\/]+))?.*$/;
|
|
|
|
import { semver } from "bun";
|
|
|
|
if (!bo.success) {
|
|
bo.logs.forEach((l) => console.log(l));
|
|
process.exit(1);
|
|
} else {
|
|
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 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;
|
|
}
|
|
}
|