Skip to content

EmerikC/adventofcode2024

Repository files navigation

AdventOfCode2024 — TypeScript runner

CI dependencies license

This repository is a TypeScript console runner for Advent of Code practice. It uses ESM and tsx for a fast development workflow.

Quick commands (PowerShell)

# Quick usage
- One-shot dev run (recommended when you have autosave enabled):
  npm run dev -- --day 1 --part 1

- Watch/dev loop (auto-reload) — explicit command:
  npm run dev:watch -- --day 1 --part 1

Notes on npm argument forwarding: when running via `npm run` the underlying `tsx` binary may parse flags itself. If you find flags being consumed, either run `npx tsx advent-app.ts -- --day 1 --part 1` (direct) or pass an extra `--` through npm: `npm run dev -- -- --day 1 --part 1`.

# Run a single day's TypeScript file directly (no runner)
npx tsx day1/index.ts

# Build (compile to `dist`)


# Run compiled output
npm start

# Tests & lint
npm test
npm run lint
npm run format

Project layout

  • advent-app.ts — runner that reads dayN/input.txt and dynamically imports dayN/index.ts.
  • dayN/index.ts — implement export function Part1(input: string) and export function Part2(input: string) for each day.
  • dayN/input.txt — put puzzle input here.
  • dayN/sample.txt — (optional) small sample inputs for tests.
  • test/utils.ts — helper to load sample files in tests.

Notes

  • Interactive prompts use prompts when available, with a fallback to Node's readline/promises.
  • CLI parsing uses yargs when available; the runner also accepts --day=1 or -d 1 style flags.
  • ESLint and Prettier are included for linting and formatting.
  • CI: .github/workflows/ci.yml runs lint, build and tests on push/PR.

Parsing assumptions

  • Day input parsing currently assumes non-negative integer tokens (no negatives or decimals). The parser trims blank lines and validates numeric tokens; malformed lines are ignored.

Dependabot & branch protection

  • This repository uses Dependabot to propose dependency updates on a weekly schedule. Dependabot PRs will trigger CI so updates are validated automatically.
  • The CI workflow includes a dependency-review step that fails the build if a PR introduces any known dependency vulnerabilities.
  • For safer merges, enable branch protection on master/main to require passing status checks (CI) before merging.

Git ignore

  • A .gitignore file is included; it ignores node_modules, dist, .vscode, and other local files.

About

Node.js app with runner for the advent of code 2024 event

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published