Skip to content

Commit 24ed5c8

Browse files
authored
Merge pull request #87 from codecrafters-io/andy/upgrade
[Shell] CC-1745: Upgrade Bun to v1.2, Rust to v1.86, and Elixir to v1.18
2 parents c8aa03f + ed6bb08 commit 24ed5c8

40 files changed

+181
-80
lines changed

compiled_starters/elixir/codecrafters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ debug: false
77
# Use this to change the Elixir version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: elixir-1.17
11-
language_pack: elixir-1.17
10+
# Available versions: elixir-1.18
11+
language_pack: elixir-1.18

compiled_starters/elixir/mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule App.MixProject do
66
[
77
app: :codecrafters_shell,
88
version: "1.0.0",
9-
elixir: "~> 1.17",
9+
elixir: "~> 1.18",
1010
start_permanent: Mix.env() == :prod,
1111
deps: deps(),
1212
escript: [main_module: CLI]

compiled_starters/rust/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Time to move on to the next stage!
2727

2828
Note: This section is for stages 2 and beyond.
2929

30-
1. Ensure you have `cargo (1.85)` installed locally
30+
1. Ensure you have `cargo (1.86)` installed locally
3131
1. Run `./your_program.sh` to run your program, which is implemented in
3232
`src/main.rs`. This command compiles your Rust project, so it might be slow
3333
the first time you run it. Subsequent runs will be fast.

compiled_starters/rust/codecrafters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ debug: false
77
# Use this to change the Rust version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: rust-1.85
11-
language_pack: rust-1.85
10+
# Available versions: rust-1.86
11+
language_pack: rust-1.86
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/sh
22
#
33
# This script is used to compile your program on CodeCrafters
4-
#
4+
#
55
# This runs before .codecrafters/run.sh
66
#
77
# Learn more: https://codecrafters.io/program-interface
88

9-
# (This file is empty since Typescript programs don't use a compile step)
9+
set -e # Exit on failure
10+
11+
# (This file is empty since TypeScript programs don't use a compile step)
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/bin/sh
22
#
33
# This script is used to run your program on CodeCrafters
4-
#
4+
#
55
# This runs after .codecrafters/compile.sh
66
#
77
# Learn more: https://codecrafters.io/program-interface
88

9-
# Exit early if any commands fail
10-
set -e
9+
set -e # Exit on failure
1110

12-
exec bun run app/main.ts "$@"
11+
exec bun run $(dirname $0)/app/main.ts "$@"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
node_modules/
1+
node_modules/

compiled_starters/typescript/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Time to move on to the next stage!
2727

2828
Note: This section is for stages 2 and beyond.
2929

30-
1. Ensure you have `bun (1.1)` installed locally
30+
1. Ensure you have `bun (1.2)` installed locally
3131
1. Run `./your_program.sh` to run your program, which is implemented in
3232
`app/main.ts`.
3333
1. Commit your changes and run `git push origin master` to submit your solution
728 Bytes
Binary file not shown.

compiled_starters/typescript/codecrafters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ debug: false
77
# Use this to change the TypeScript version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: bun-1.1
11-
language_pack: bun-1.1
10+
# Available versions: bun-1.2
11+
language_pack: bun-1.2
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "@codecrafters/build-your-own-shell",
3-
"description": "Build your own Shell challenge, from Codecrafters",
2+
"name": "@codecrafters/shell",
3+
"description": "Build your own Shell challenge, from CodeCrafters",
44
"type": "module",
55
"scripts": {
66
"dev": "bun run app/main.ts"
77
},
88
"devDependencies": {
9-
"@types/node": "^20.14.2"
9+
"@types/bun": "latest"
1010
}
1111
}
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2022",
4-
"module": "ES2022",
5-
"moduleResolution": "node",
6-
"esModuleInterop": true,
3+
// Enable latest features
4+
"lib": ["ESNext", "DOM"],
5+
"target": "ESNext",
6+
"module": "ESNext",
7+
"moduleDetection": "force",
8+
"jsx": "react-jsx",
9+
"allowJs": true,
10+
11+
// Bundler mode
12+
"moduleResolution": "bundler",
13+
"allowImportingTsExtensions": true,
14+
"verbatimModuleSyntax": true,
15+
"noEmit": true,
16+
17+
// Best practices
718
"strict": true,
8-
"skipLibCheck": true
9-
},
10-
"ts-node": {
11-
"esm": true
19+
"skipLibCheck": true,
20+
"noFallthroughCasesInSwitch": true,
21+
22+
// Some stricter flags (disabled by default)
23+
"noUnusedLocals": false,
24+
"noUnusedParameters": false,
25+
"noPropertyAccessFromIndexSignature": false
1226
}
1327
}

compiled_starters/typescript/your_program.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ set -e # Exit early if any commands fail
1212
#
1313
# - Edit this to change how your program runs locally
1414
# - Edit .codecrafters/run.sh to change how your program runs remotely
15-
exec bun run app/main.ts "$@"
15+
exec bun run $(dirname $0)/app/main.ts "$@"

dockerfiles/bun-1.2.Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# syntax=docker/dockerfile:1.7-labs
2+
FROM oven/bun:1.2-alpine
3+
4+
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="package.json,bun.lockb"
5+
6+
WORKDIR /app
7+
8+
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
9+
COPY --exclude=.git --exclude=README.md . /app
10+
11+
# For reproducible builds.
12+
# This will install the exact versions of each package specified in the lockfile.
13+
# If package.json disagrees with bun.lockb, Bun will exit with an error. The lockfile will not be updated.
14+
RUN bun install --frozen-lockfile
15+
16+
# If the node_modules directory exists, move it to /app-cached
17+
RUN mkdir -p /app-cached
18+
RUN if [ -d "/app/node_modules" ]; then mv /app/node_modules /app-cached; fi

dockerfiles/elixir-1.18.Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# syntax=docker/dockerfile:1.7-labs
2+
FROM elixir:1.18.3-alpine
3+
4+
# Ensures the container is re-built if dependency files change
5+
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="mix.exs"
6+
7+
WORKDIR /app
8+
9+
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
10+
COPY --exclude=.git --exclude=README.md . /app
11+
12+
# install hex + rebar
13+
RUN mix local.hex --force && \
14+
mix local.rebar --force
15+
16+
# install and compile mix dependencies
17+
RUN mix deps.get && \
18+
mix deps.compile
19+
20+
# Install & cache deps
21+
RUN .codecrafters/compile.sh
22+
23+
RUN mkdir -p /app-cached
24+
RUN if [ -d "/app/_build" ]; then mv /app/_build /app-cached; fi
25+
RUN if [ -d "/app/deps" ]; then mv /app/deps /app-cached; fi

dockerfiles/rust-1.86.Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# syntax=docker/dockerfile:1.7-labs
2+
FROM rust:1.86-bookworm
3+
4+
# Rebuild the container if these files change
5+
ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="Cargo.toml,Cargo.lock"
6+
7+
WORKDIR /app
8+
9+
# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
10+
COPY --exclude=.git --exclude=README.md . /app
11+
12+
# This runs cargo build
13+
RUN .codecrafters/compile.sh

solutions/elixir/01-oo8/code/codecrafters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ debug: false
77
# Use this to change the Elixir version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: elixir-1.17
11-
language_pack: elixir-1.17
10+
# Available versions: elixir-1.18
11+
language_pack: elixir-1.18

solutions/elixir/01-oo8/code/mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule App.MixProject do
66
[
77
app: :codecrafters_shell,
88
version: "1.0.0",
9-
elixir: "~> 1.17",
9+
elixir: "~> 1.18",
1010
start_permanent: Mix.env() == :prod,
1111
deps: deps(),
1212
escript: [main_module: CLI]

solutions/rust/01-oo8/code/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Time to move on to the next stage!
2727

2828
Note: This section is for stages 2 and beyond.
2929

30-
1. Ensure you have `cargo (1.85)` installed locally
30+
1. Ensure you have `cargo (1.86)` installed locally
3131
1. Run `./your_program.sh` to run your program, which is implemented in
3232
`src/main.rs`. This command compiles your Rust project, so it might be slow
3333
the first time you run it. Subsequent runs will be fast.

solutions/rust/01-oo8/code/codecrafters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ debug: false
77
# Use this to change the Rust version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: rust-1.85
11-
language_pack: rust-1.85
10+
# Available versions: rust-1.86
11+
language_pack: rust-1.86

solutions/rust/02-cz2/code/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Time to move on to the next stage!
2727

2828
Note: This section is for stages 2 and beyond.
2929

30-
1. Ensure you have `cargo (1.85)` installed locally
30+
1. Ensure you have `cargo (1.86)` installed locally
3131
1. Run `./your_program.sh` to run your program, which is implemented in
3232
`src/main.rs`. This command compiles your Rust project, so it might be slow
3333
the first time you run it. Subsequent runs will be fast.

solutions/rust/02-cz2/code/codecrafters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ debug: false
77
# Use this to change the Rust version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: rust-1.85
11-
language_pack: rust-1.85
10+
# Available versions: rust-1.86
11+
language_pack: rust-1.86
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/sh
22
#
33
# This script is used to compile your program on CodeCrafters
4-
#
4+
#
55
# This runs before .codecrafters/run.sh
66
#
77
# Learn more: https://codecrafters.io/program-interface
88

9-
# (This file is empty since Typescript programs don't use a compile step)
9+
set -e # Exit on failure
10+
11+
# (This file is empty since TypeScript programs don't use a compile step)
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/bin/sh
22
#
33
# This script is used to run your program on CodeCrafters
4-
#
4+
#
55
# This runs after .codecrafters/compile.sh
66
#
77
# Learn more: https://codecrafters.io/program-interface
88

9-
# Exit early if any commands fail
10-
set -e
9+
set -e # Exit on failure
1110

12-
exec bun run app/main.ts "$@"
11+
exec bun run $(dirname $0)/app/main.ts "$@"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
node_modules/
1+
node_modules/

solutions/typescript/01-oo8/code/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Time to move on to the next stage!
2727

2828
Note: This section is for stages 2 and beyond.
2929

30-
1. Ensure you have `bun (1.1)` installed locally
30+
1. Ensure you have `bun (1.2)` installed locally
3131
1. Run `./your_program.sh` to run your program, which is implemented in
3232
`app/main.ts`.
3333
1. Commit your changes and run `git push origin master` to submit your solution
728 Bytes
Binary file not shown.

solutions/typescript/01-oo8/code/codecrafters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ debug: false
77
# Use this to change the TypeScript version used to run your code
88
# on Codecrafters.
99
#
10-
# Available versions: bun-1.1
11-
language_pack: bun-1.1
10+
# Available versions: bun-1.2
11+
language_pack: bun-1.2
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "@codecrafters/build-your-own-shell",
3-
"description": "Build your own Shell challenge, from Codecrafters",
2+
"name": "@codecrafters/shell",
3+
"description": "Build your own Shell challenge, from CodeCrafters",
44
"type": "module",
55
"scripts": {
66
"dev": "bun run app/main.ts"
77
},
88
"devDependencies": {
9-
"@types/node": "^20.14.2"
9+
"@types/bun": "latest"
1010
}
1111
}
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2022",
4-
"module": "ES2022",
5-
"moduleResolution": "node",
6-
"esModuleInterop": true,
3+
// Enable latest features
4+
"lib": ["ESNext", "DOM"],
5+
"target": "ESNext",
6+
"module": "ESNext",
7+
"moduleDetection": "force",
8+
"jsx": "react-jsx",
9+
"allowJs": true,
10+
11+
// Bundler mode
12+
"moduleResolution": "bundler",
13+
"allowImportingTsExtensions": true,
14+
"verbatimModuleSyntax": true,
15+
"noEmit": true,
16+
17+
// Best practices
718
"strict": true,
8-
"skipLibCheck": true
9-
},
10-
"ts-node": {
11-
"esm": true
19+
"skipLibCheck": true,
20+
"noFallthroughCasesInSwitch": true,
21+
22+
// Some stricter flags (disabled by default)
23+
"noUnusedLocals": false,
24+
"noUnusedParameters": false,
25+
"noPropertyAccessFromIndexSignature": false
1226
}
1327
}

solutions/typescript/01-oo8/code/your_program.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ set -e # Exit early if any commands fail
1212
#
1313
# - Edit this to change how your program runs locally
1414
# - Edit .codecrafters/run.sh to change how your program runs remotely
15-
exec bun run app/main.ts "$@"
15+
exec bun run $(dirname $0)/app/main.ts "$@"

starter_templates/elixir/code/mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule App.MixProject do
66
[
77
app: :codecrafters_shell,
88
version: "1.0.0",
9-
elixir: "~> 1.17",
9+
elixir: "~> 1.18",
1010
start_permanent: Mix.env() == :prod,
1111
deps: deps(),
1212
escript: [main_module: CLI]

starter_templates/rust/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
attributes:
2-
required_executable: cargo (1.85)
2+
required_executable: cargo (1.86)
33
user_editable_file: src/main.rs
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/sh
22
#
33
# This script is used to compile your program on CodeCrafters
4-
#
4+
#
55
# This runs before .codecrafters/run.sh
66
#
77
# Learn more: https://codecrafters.io/program-interface
88

9-
# (This file is empty since Typescript programs don't use a compile step)
9+
set -e # Exit on failure
10+
11+
# (This file is empty since TypeScript programs don't use a compile step)

0 commit comments

Comments
 (0)