From 2ee4f6444bb1c38d8385d587a3d5d0f39017beb3 Mon Sep 17 00:00:00 2001 From: Andy Li <1450947+andy1li@users.noreply.github.com> Date: Mon, 9 Mar 2026 07:27:39 +0900 Subject: [PATCH] CC-2145: Upgrade Bun to v1.3 --- .../typescript/.codecrafters/run.sh | 2 +- compiled_starters/typescript/README.md | 2 +- compiled_starters/typescript/bun.lock | 21 +++++++++++++++++++ compiled_starters/typescript/codecrafters.yml | 4 ++-- compiled_starters/typescript/your_program.sh | 2 +- dockerfiles/bun-1.3.Dockerfile | 20 ++++++++++++++++++ .../01-vi6/code/.codecrafters/run.sh | 2 +- solutions/typescript/01-vi6/code/README.md | 2 +- solutions/typescript/01-vi6/code/bun.lock | 21 +++++++++++++++++++ .../typescript/01-vi6/code/codecrafters.yml | 4 ++-- .../typescript/01-vi6/code/your_program.sh | 2 +- .../typescript/code/.codecrafters/run.sh | 2 +- starter_templates/typescript/code/bun.lock | 21 +++++++++++++++++++ starter_templates/typescript/config.yml | 2 +- 14 files changed, 95 insertions(+), 12 deletions(-) create mode 100644 compiled_starters/typescript/bun.lock create mode 100644 dockerfiles/bun-1.3.Dockerfile create mode 100644 solutions/typescript/01-vi6/code/bun.lock create mode 100644 starter_templates/typescript/code/bun.lock diff --git a/compiled_starters/typescript/.codecrafters/run.sh b/compiled_starters/typescript/.codecrafters/run.sh index f41df1f..22e0e2f 100755 --- a/compiled_starters/typescript/.codecrafters/run.sh +++ b/compiled_starters/typescript/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec bun run $(dirname $0)/app/main.ts "$@" +exec bun run "$(dirname "$0")/app/main.ts" "$@" \ No newline at end of file diff --git a/compiled_starters/typescript/README.md b/compiled_starters/typescript/README.md index 2696fed..5f6b654 100644 --- a/compiled_starters/typescript/README.md +++ b/compiled_starters/typescript/README.md @@ -27,7 +27,7 @@ That's all! Note: This section is for stages 2 and beyond. -1. Ensure you have `bun (1.2)` installed locally +1. Ensure you have `bun (1.3)` installed locally 1. Run `./your_program.sh` to run your Kafka broker, which is implemented in `app/main.ts`. 1. Commit your changes and run `git push origin master` to submit your solution diff --git a/compiled_starters/typescript/bun.lock b/compiled_starters/typescript/bun.lock new file mode 100644 index 0000000..7ec9ad0 --- /dev/null +++ b/compiled_starters/typescript/bun.lock @@ -0,0 +1,21 @@ +{ + "lockfileVersion": 1, + "configVersion": 1, + "workspaces": { + "": { + "name": "@codecrafters/kafka", + "devDependencies": { + "@types/bun": "latest", + }, + }, + }, + "packages": { + "@types/bun": ["@types/bun@1.3.10", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="], + + "@types/node": ["@types/node@25.3.5", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-oX8xrhvpiyRCQkG1MFchB09f+cXftgIXb3a7UUa4Y3wpmZPw5tyZGTLWhlESOLq1Rq6oDlc8npVU2/9xiCuXMA=="], + + "bun-types": ["bun-types@1.3.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="], + + "undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="], + } +} diff --git a/compiled_starters/typescript/codecrafters.yml b/compiled_starters/typescript/codecrafters.yml index 82966c7..55c5865 100644 --- a/compiled_starters/typescript/codecrafters.yml +++ b/compiled_starters/typescript/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the TypeScript version used to run your code # on Codecrafters. # -# Available versions: bun-1.2 -buildpack: bun-1.2 +# Available versions: bun-1.3 +buildpack: bun-1.3 diff --git a/compiled_starters/typescript/your_program.sh b/compiled_starters/typescript/your_program.sh index fcc2fd5..a1a7b7b 100755 --- a/compiled_starters/typescript/your_program.sh +++ b/compiled_starters/typescript/your_program.sh @@ -12,4 +12,4 @@ set -e # Exit early if any commands fail # # - Edit this to change how your program runs locally # - Edit .codecrafters/run.sh to change how your program runs remotely -exec bun run $(dirname $0)/app/main.ts "$@" +exec bun run "$(dirname "$0")/app/main.ts" "$@" diff --git a/dockerfiles/bun-1.3.Dockerfile b/dockerfiles/bun-1.3.Dockerfile new file mode 100644 index 0000000..a65b103 --- /dev/null +++ b/dockerfiles/bun-1.3.Dockerfile @@ -0,0 +1,20 @@ +# syntax=docker/dockerfile:1.7-labs +FROM oven/bun:1.3-alpine + +ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="package.json,bun.lock" + +RUN apk add --no-cache --upgrade 'bash>=5.2' + +WORKDIR /app + +# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses +COPY --exclude=.git --exclude=README.md . /app + +# For reproducible builds. +# This will install the exact versions of each package specified in the lockfile. +# If package.json disagrees with bun.lockb, Bun will exit with an error. The lockfile will not be updated. +RUN bun install --frozen-lockfile + +# If the node_modules directory exists, move it to /app-cached +RUN mkdir -p /app-cached +RUN if [ -d "/app/node_modules" ]; then mv /app/node_modules /app-cached; fi diff --git a/solutions/typescript/01-vi6/code/.codecrafters/run.sh b/solutions/typescript/01-vi6/code/.codecrafters/run.sh index f41df1f..22e0e2f 100755 --- a/solutions/typescript/01-vi6/code/.codecrafters/run.sh +++ b/solutions/typescript/01-vi6/code/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec bun run $(dirname $0)/app/main.ts "$@" +exec bun run "$(dirname "$0")/app/main.ts" "$@" \ No newline at end of file diff --git a/solutions/typescript/01-vi6/code/README.md b/solutions/typescript/01-vi6/code/README.md index 2696fed..5f6b654 100644 --- a/solutions/typescript/01-vi6/code/README.md +++ b/solutions/typescript/01-vi6/code/README.md @@ -27,7 +27,7 @@ That's all! Note: This section is for stages 2 and beyond. -1. Ensure you have `bun (1.2)` installed locally +1. Ensure you have `bun (1.3)` installed locally 1. Run `./your_program.sh` to run your Kafka broker, which is implemented in `app/main.ts`. 1. Commit your changes and run `git push origin master` to submit your solution diff --git a/solutions/typescript/01-vi6/code/bun.lock b/solutions/typescript/01-vi6/code/bun.lock new file mode 100644 index 0000000..7ec9ad0 --- /dev/null +++ b/solutions/typescript/01-vi6/code/bun.lock @@ -0,0 +1,21 @@ +{ + "lockfileVersion": 1, + "configVersion": 1, + "workspaces": { + "": { + "name": "@codecrafters/kafka", + "devDependencies": { + "@types/bun": "latest", + }, + }, + }, + "packages": { + "@types/bun": ["@types/bun@1.3.10", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="], + + "@types/node": ["@types/node@25.3.5", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-oX8xrhvpiyRCQkG1MFchB09f+cXftgIXb3a7UUa4Y3wpmZPw5tyZGTLWhlESOLq1Rq6oDlc8npVU2/9xiCuXMA=="], + + "bun-types": ["bun-types@1.3.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="], + + "undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="], + } +} diff --git a/solutions/typescript/01-vi6/code/codecrafters.yml b/solutions/typescript/01-vi6/code/codecrafters.yml index 82966c7..55c5865 100644 --- a/solutions/typescript/01-vi6/code/codecrafters.yml +++ b/solutions/typescript/01-vi6/code/codecrafters.yml @@ -7,5 +7,5 @@ debug: false # Use this to change the TypeScript version used to run your code # on Codecrafters. # -# Available versions: bun-1.2 -buildpack: bun-1.2 +# Available versions: bun-1.3 +buildpack: bun-1.3 diff --git a/solutions/typescript/01-vi6/code/your_program.sh b/solutions/typescript/01-vi6/code/your_program.sh index fcc2fd5..a1a7b7b 100755 --- a/solutions/typescript/01-vi6/code/your_program.sh +++ b/solutions/typescript/01-vi6/code/your_program.sh @@ -12,4 +12,4 @@ set -e # Exit early if any commands fail # # - Edit this to change how your program runs locally # - Edit .codecrafters/run.sh to change how your program runs remotely -exec bun run $(dirname $0)/app/main.ts "$@" +exec bun run "$(dirname "$0")/app/main.ts" "$@" diff --git a/starter_templates/typescript/code/.codecrafters/run.sh b/starter_templates/typescript/code/.codecrafters/run.sh index f41df1f..22e0e2f 100755 --- a/starter_templates/typescript/code/.codecrafters/run.sh +++ b/starter_templates/typescript/code/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec bun run $(dirname $0)/app/main.ts "$@" +exec bun run "$(dirname "$0")/app/main.ts" "$@" \ No newline at end of file diff --git a/starter_templates/typescript/code/bun.lock b/starter_templates/typescript/code/bun.lock new file mode 100644 index 0000000..7ec9ad0 --- /dev/null +++ b/starter_templates/typescript/code/bun.lock @@ -0,0 +1,21 @@ +{ + "lockfileVersion": 1, + "configVersion": 1, + "workspaces": { + "": { + "name": "@codecrafters/kafka", + "devDependencies": { + "@types/bun": "latest", + }, + }, + }, + "packages": { + "@types/bun": ["@types/bun@1.3.10", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="], + + "@types/node": ["@types/node@25.3.5", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-oX8xrhvpiyRCQkG1MFchB09f+cXftgIXb3a7UUa4Y3wpmZPw5tyZGTLWhlESOLq1Rq6oDlc8npVU2/9xiCuXMA=="], + + "bun-types": ["bun-types@1.3.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-tcpfCCl6XWo6nCVnpcVrxQ+9AYN1iqMIzgrSKYMB/fjLtV2eyAVEg7AxQJuCq/26R6HpKWykQXuSOq/21RYcbg=="], + + "undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="], + } +} diff --git a/starter_templates/typescript/config.yml b/starter_templates/typescript/config.yml index 187d430..2be2f06 100644 --- a/starter_templates/typescript/config.yml +++ b/starter_templates/typescript/config.yml @@ -1,3 +1,3 @@ attributes: - required_executable: bun (1.2) + required_executable: bun (1.3) user_editable_file: app/main.ts