For this year I chose to use a starter to organize the code. I used ts-aoc-starter
The repository is organized per day. Every day has a separate folder. The folder structure is outlined below.
ts-aoc-starter
├── puzzles
│ ├── day-1
│ │ ├── day-1-a.data.txt
│ │ ├── day-1-a.sample-data.txt
│ │ ├── day-1-a.ts
│ │ ├── day-1-b.data.txt
│ │ ├── day-1-b.sample-data.txt
│ │ └── day-1-b.ts
│ ├── day-2
│ ├── day-3
Sample input for the day is placed in the day-[x]-[part].sample-data.txt
. Actual input is placed in day-[x]-[part].data.txt
.
The NX template takes care of loading the proper data file.
Warning
Because AOC input is copyrighted, you'll have to provide your own input. The input files are not provided in this repository.
You'll have to create your own day-[x]-[part].sample-data.txt
and day-[x]-[part].data.txt
files.
The code can then be written in day-[x]-[part].ts
files.
To run a puzzle with sample data, one of the following commands can be run:
pnpm day-1-a:sample
or
nx day-1-a --data=sample
To run the solution against the actual data set, run the following command:
pnpm day-1-a
or
nx day-1-a