From 39374d7ee13ffa0fe1e4ded146c91869acad144c Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 17 Sep 2024 10:27:51 +0200 Subject: [PATCH] fix: update bun to 1.1.27 --- .github/DockerfileBackendTests | 6 +++--- Dockerfile | 2 +- cli/main.ts | 12 ++++++++++++ cli/metadata.ts | 17 ++++++++++++++--- docker/DockerfileSlim | 3 +-- docker/DockerfileSlimEe | 3 +-- 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/.github/DockerfileBackendTests b/.github/DockerfileBackendTests index 3050e9ab5411b..9fa9d788ff628 100644 --- a/.github/DockerfileBackendTests +++ b/.github/DockerfileBackendTests @@ -11,8 +11,8 @@ SHELL ["/bin/bash", "-c"] RUN apt update -y RUN apt install -y unzip curl -RUN [ "$TARGETPLATFORM" == "linux/amd64" ] && curl -Lsf https://github.com/denoland/deno/releases/download/v1.41.0/deno-x86_64-unknown-linux-gnu.zip -o deno.zip || true -RUN [ "$TARGETPLATFORM" == "linux/arm64" ] && curl -Lsf https://github.com/denoland/deno/releases/download/v1.41.0/deno-aarch64-unknown-linux-gnu.zip -o deno.zip || true +RUN [ "$TARGETPLATFORM" == "linux/amd64" ] && curl -Lsf https://github.com/denoland/deno/releases/download/v1.46.3/deno-x86_64-unknown-linux-gnu.zip -o deno.zip || true +RUN [ "$TARGETPLATFORM" == "linux/arm64" ] && curl -Lsf https://github.com/denoland/deno/releases/download/v1.46.3/deno-aarch64-unknown-linux-gnu.zip -o deno.zip || true RUN unzip deno.zip && rm deno.zip @@ -53,7 +53,7 @@ RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VER RUN /usr/local/bin/python3 -m pip install pip-tools -COPY --from=oven/bun:1.1.8 /usr/local/bin/bun /usr/bin/bun +COPY --from=oven/bun:1.1.27 /usr/local/bin/bun /usr/bin/bun RUN [ "$TARGETPLATFORM" == "linux/amd64" ] && curl -Lsf https://github.com/denoland/deno/releases/download/v1.41.0/deno-x86_64-unknown-linux-gnu.zip -o deno.zip || true diff --git a/Dockerfile b/Dockerfile index 5b8a69e77d2e2..a1c77f7e13ddc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -172,7 +172,7 @@ COPY --from=builder /windmill/target/release/windmill ${APP}/windmill COPY --from=denoland/deno:1.46.3 --chmod=755 /usr/bin/deno /usr/bin/deno -COPY --from=oven/bun:1.1.25 /usr/local/bin/bun /usr/bin/bun +COPY --from=oven/bun:1.1.27 /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 diff --git a/cli/main.ts b/cli/main.ts index c67729bfec2b9..3385e4df3909d 100644 --- a/cli/main.ts +++ b/cli/main.ts @@ -145,6 +145,17 @@ const command = new Command() .command("completions", new CompletionsCommand()); export let showDiffs = false; + +let isWin: boolean | undefined = undefined; + +export async function getIsWin() { + if (isWin === undefined) { + const os = await import("node:os"); + isWin = os.platform() === "win32"; + } + return isWin; +} + async function main() { try { if (Deno.args.length === 0) { @@ -161,6 +172,7 @@ async function main() { handlers: { console: new log.ConsoleHandler(LOG_LEVEL, { formatter: ({ msg }) => `${msg}`, + useColors: isWin ? false : true, }), }, loggers: { diff --git a/cli/metadata.ts b/cli/metadata.ts index 1d0fa16eb3bc9..efbbdd0170b39 100644 --- a/cli/metadata.ts +++ b/cli/metadata.ts @@ -42,6 +42,7 @@ import { import { generateHash, readInlinePathSync } from "./utils.ts"; import { SyncCodebase } from "./codebase.ts"; import { FlowFile, replaceInlineScripts } from "./flow.ts"; +import { getIsWin } from "./main.ts"; export async function generateAllMetadata() {} @@ -169,6 +170,12 @@ export async function generateFlowLockInternal( log.info(colors.green(`Flow ${remote_path} lockfiles updated`)); } +// on windows, when using powershell, blue is not readable +async function blueColor(): Promise<(x: string) => void> { + const isWin = await getIsWin(); + return isWin ? colors.black : colors.blue; +} + export async function generateScriptMetadataInternal( scriptPath: string, workspace: Workspace, @@ -196,7 +203,7 @@ export async function generateScriptMetadataInternal( ); if (rawReqs) { log.info( - colors.blue( + (await blueColor())( `Found raw requirements (package.json/requirements.txt/composer.json) for ${scriptPath}, using it` ) ); @@ -786,7 +793,9 @@ export async function parseMetadataFile( } catch { // no metadata file at all. Create it log.info( - colors.blue(`Creating script metadata file for ${metadataFilePath}`) + (await blueColor())( + `Creating script metadata file for ${metadataFilePath}` + ) ); metadataFilePath = scriptPath + ".script.yaml"; let scriptInitialMetadata = defaultScriptMetadata(); @@ -800,7 +809,9 @@ export async function parseMetadataFile( if (generateMetadataIfMissing) { log.info( - colors.blue(`Generating lockfile and schema for ${metadataFilePath}`) + (await blueColor())( + `Generating lockfile and schema for ${metadataFilePath}` + ) ); try { await generateScriptMetadataInternal( diff --git a/docker/DockerfileSlim b/docker/DockerfileSlim index 54bfe26636fc3..ea8f9d8c5027b 100644 --- a/docker/DockerfileSlim +++ b/docker/DockerfileSlim @@ -15,7 +15,7 @@ ENV TZ=Etc/UTC RUN /usr/local/bin/python3 -m pip install pip-tools -COPY --from=oven/bun:1.1.26 /usr/local/bin/bun /usr/bin/bun +COPY --from=oven/bun:1.1.27 /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/ @@ -23,7 +23,6 @@ COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/ WORKDIR ${APP} COPY --from=ghcr.io/windmill-labs/windmill-ee:dev --chmod=755 ${APP}/windmill ${APP}/windmill -COPY --from=denoland/deno:1.46.1 --chmod=755 /usr/bin/deno /usr/bin/deno RUN ln -s ${APP}/windmill /usr/local/bin/windmill diff --git a/docker/DockerfileSlimEe b/docker/DockerfileSlimEe index 54bfe26636fc3..ea8f9d8c5027b 100644 --- a/docker/DockerfileSlimEe +++ b/docker/DockerfileSlimEe @@ -15,7 +15,7 @@ ENV TZ=Etc/UTC RUN /usr/local/bin/python3 -m pip install pip-tools -COPY --from=oven/bun:1.1.26 /usr/local/bin/bun /usr/bin/bun +COPY --from=oven/bun:1.1.27 /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/ @@ -23,7 +23,6 @@ COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/ WORKDIR ${APP} COPY --from=ghcr.io/windmill-labs/windmill-ee:dev --chmod=755 ${APP}/windmill ${APP}/windmill -COPY --from=denoland/deno:1.46.1 --chmod=755 /usr/bin/deno /usr/bin/deno RUN ln -s ${APP}/windmill /usr/local/bin/windmill