diff --git a/compiled_starters/typescript/.codecrafters/run.sh b/compiled_starters/typescript/.codecrafters/run.sh index c3c6b1e..f41df1f 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 app/main.ts "$@" +exec bun run $(dirname $0)/app/main.ts "$@" diff --git a/compiled_starters/typescript/bun.lockb b/compiled_starters/typescript/bun.lockb index 1b830cd..f99a66d 100755 Binary files a/compiled_starters/typescript/bun.lockb and b/compiled_starters/typescript/bun.lockb differ diff --git a/compiled_starters/typescript/package.json b/compiled_starters/typescript/package.json index 54632d5..24cc9c5 100644 --- a/compiled_starters/typescript/package.json +++ b/compiled_starters/typescript/package.json @@ -1,14 +1,11 @@ { - "name": "@codecrafters/build-your-own-grep", - "description": "Build your own Grep challenge, from CodeCrafters", + "name": "@codecrafters/grep", + "description": "Build your own grep challenge, from CodeCrafters", "type": "module", "scripts": { "dev": "bun run app/main.ts" }, - "dependencies": { - "fs-extra": "^11.2.0" - }, "devDependencies": { - "@types/node": "^20.12.12" + "@types/bun": "latest" } -} \ No newline at end of file +} diff --git a/compiled_starters/typescript/tsconfig.json b/compiled_starters/typescript/tsconfig.json index 4fce359..238655f 100644 --- a/compiled_starters/typescript/tsconfig.json +++ b/compiled_starters/typescript/tsconfig.json @@ -1,13 +1,27 @@ { - "compilerOptions": { - "target": "ES2020", - "module": "ES2022", - "moduleResolution": "node", - "esModuleInterop": true, - "strict": true, - "skipLibCheck": true, - }, - "ts-node": { - "esm": true - } + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } } diff --git a/compiled_starters/typescript/your_program.sh b/compiled_starters/typescript/your_program.sh index 45031bb..fcc2fd5 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 app/main.ts "$@" +exec bun run $(dirname $0)/app/main.ts "$@" diff --git a/dockerfiles/bun-1.1.Dockerfile b/dockerfiles/bun-1.1.Dockerfile index 4db1041..e118d6f 100644 --- a/dockerfiles/bun-1.1.Dockerfile +++ b/dockerfiles/bun-1.1.Dockerfile @@ -1,17 +1,18 @@ -FROM oven/bun:1.1.4-alpine +# syntax=docker/dockerfile:1.7-labs +FROM oven/bun:1.1-alpine ENV CODECRAFTERS_DEPENDENCY_FILE_PATHS="package.json,bun.lockb" WORKDIR /app -COPY package.json ./ -COPY bun.lockb ./ +# .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 -RUN mkdir -p /app-cached # 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-cq2/code/.codecrafters/run.sh b/solutions/typescript/01-cq2/code/.codecrafters/run.sh index c3c6b1e..f41df1f 100755 --- a/solutions/typescript/01-cq2/code/.codecrafters/run.sh +++ b/solutions/typescript/01-cq2/code/.codecrafters/run.sh @@ -8,4 +8,4 @@ set -e # Exit on failure -exec bun run app/main.ts "$@" +exec bun run $(dirname $0)/app/main.ts "$@" diff --git a/solutions/typescript/01-cq2/code/bun.lockb b/solutions/typescript/01-cq2/code/bun.lockb index 1b830cd..f99a66d 100755 Binary files a/solutions/typescript/01-cq2/code/bun.lockb and b/solutions/typescript/01-cq2/code/bun.lockb differ diff --git a/solutions/typescript/01-cq2/code/package.json b/solutions/typescript/01-cq2/code/package.json index 54632d5..24cc9c5 100644 --- a/solutions/typescript/01-cq2/code/package.json +++ b/solutions/typescript/01-cq2/code/package.json @@ -1,14 +1,11 @@ { - "name": "@codecrafters/build-your-own-grep", - "description": "Build your own Grep challenge, from CodeCrafters", + "name": "@codecrafters/grep", + "description": "Build your own grep challenge, from CodeCrafters", "type": "module", "scripts": { "dev": "bun run app/main.ts" }, - "dependencies": { - "fs-extra": "^11.2.0" - }, "devDependencies": { - "@types/node": "^20.12.12" + "@types/bun": "latest" } -} \ No newline at end of file +} diff --git a/solutions/typescript/01-cq2/code/tsconfig.json b/solutions/typescript/01-cq2/code/tsconfig.json index 4fce359..238655f 100644 --- a/solutions/typescript/01-cq2/code/tsconfig.json +++ b/solutions/typescript/01-cq2/code/tsconfig.json @@ -1,13 +1,27 @@ { - "compilerOptions": { - "target": "ES2020", - "module": "ES2022", - "moduleResolution": "node", - "esModuleInterop": true, - "strict": true, - "skipLibCheck": true, - }, - "ts-node": { - "esm": true - } + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } } diff --git a/solutions/typescript/01-cq2/code/your_program.sh b/solutions/typescript/01-cq2/code/your_program.sh index 45031bb..fcc2fd5 100755 --- a/solutions/typescript/01-cq2/code/your_program.sh +++ b/solutions/typescript/01-cq2/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 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 c3c6b1e..f41df1f 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 app/main.ts "$@" +exec bun run $(dirname $0)/app/main.ts "$@" diff --git a/starter_templates/typescript/code/bun.lockb b/starter_templates/typescript/code/bun.lockb index 1b830cd..f99a66d 100755 Binary files a/starter_templates/typescript/code/bun.lockb and b/starter_templates/typescript/code/bun.lockb differ diff --git a/starter_templates/typescript/code/package.json b/starter_templates/typescript/code/package.json index 54632d5..24cc9c5 100644 --- a/starter_templates/typescript/code/package.json +++ b/starter_templates/typescript/code/package.json @@ -1,14 +1,11 @@ { - "name": "@codecrafters/build-your-own-grep", - "description": "Build your own Grep challenge, from CodeCrafters", + "name": "@codecrafters/grep", + "description": "Build your own grep challenge, from CodeCrafters", "type": "module", "scripts": { "dev": "bun run app/main.ts" }, - "dependencies": { - "fs-extra": "^11.2.0" - }, "devDependencies": { - "@types/node": "^20.12.12" + "@types/bun": "latest" } -} \ No newline at end of file +} diff --git a/starter_templates/typescript/code/tsconfig.json b/starter_templates/typescript/code/tsconfig.json index 4fce359..238655f 100644 --- a/starter_templates/typescript/code/tsconfig.json +++ b/starter_templates/typescript/code/tsconfig.json @@ -1,13 +1,27 @@ { - "compilerOptions": { - "target": "ES2020", - "module": "ES2022", - "moduleResolution": "node", - "esModuleInterop": true, - "strict": true, - "skipLibCheck": true, - }, - "ts-node": { - "esm": true - } + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } }