Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mabenj/aoc-deno-ts

Advent of Code - Deno/TypeScript
https://github.com/mabenj/aoc-deno-ts

aoc-2024-in-deno aoc-2024-in-typescript deno typescript

Last synced: about 1 month ago
JSON representation

Advent of Code - Deno/TypeScript

Awesome Lists containing this project

README

        

# 🎄 Advent of Code in Deno/TypeScript

## Prerequisites

- [Deno](https://deno.land/)

## Setup

1. `git clone` this repository
2. `cd` into the repository
3. `deno install -e main.ts` to install the dependencies

❗ Note: to start from scratch without my solutions, delete everything inside the `lib` directory except for the `commands` and `types` directories and the `common.ts` file.

## Usage

Solve the puzzle for the given year, day and part:

```
deno main.ts solve [-d, --day ] [-p, --part <1 | 2>] [-y, --year ]
```

Initialize and scaffold a new puzzle directory into the `lib` directory:

```
deno main.ts init [-d, --day ] [-y, --year ]
```

_Defaults:_

- `day` defaults to the day of the latest puzzle
- `year` defaults to the year of the latest AoC
- `part` defaults to 1

❗ Note: to use the `init` command to automatically scaffold a new puzzle directory and to fetch your input and problem description, you will need to set the `AOC_SESSION` environment variable to your Advent of Code session cookie. You can achieve this by creating a `.env` file with `AOC_SESSION=` in the root of your project (see .env.example). This same variable is also used to submit answers after solving a puzzle.

## Testing

`deno test` will run all the solvers and test their output

❗ Note: the tests expect a file `main_test_answers.json` in the `lib/tests` directory with the correct answers for each puzzle. You can use the `main_test_answers.example.json` file as a template to create your own file.