Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grazen0/advent-of-code
TypeScript solutions for Advent of Code
https://github.com/grazen0/advent-of-code
advent-of-code nodejs typescript
Last synced: about 2 months ago
JSON representation
TypeScript solutions for Advent of Code
- Host: GitHub
- URL: https://github.com/grazen0/advent-of-code
- Owner: Grazen0
- License: mit
- Created: 2020-12-03T13:36:27.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-14T14:29:54.000Z (8 months ago)
- Last Synced: 2024-09-02T18:04:56.775Z (4 months ago)
- Topics: advent-of-code, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 907 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Advent of Code · [![Build](https://github.com/ElCholoGamer/advent-of-code/actions/workflows/build.yml/badge.svg)](https://github.com/ElCholoGamer/advent-of-code/actions/workflows/build.yml)
My own entries for the [Advent of Code](https://adventofcode.com) event.
Includes a useful CLI tool to automatically fetch puzzle input and execute code.
## CLI Usage
1. Set the `SESSION_COOKIE` variable in a `.env` file, using your own session cookie from the AoC website:
```bash
# .env
SESSION_COOKIE=abcdefghijklmnopqrstuvwxyz
```2. Put your own code into one of the files in the `src/days/[year]` folder. The file must export 2 functions of type `AoCPart`, that must be named `part1` and `part2`, and return either a string or a number as the result.
```typescript
import { AoCPart } from '../../types';export const part1: AoCPart = (input) => {
return '[This is the result for part 1!]';
};export const part2: AoCPart = (input) => {
return '[This is the result for part 2!]';
};
```3. Run the program from the command line, either using the `dev` script or building and using the `start` script
```bash
# Run day 4 of the current year
$ pnpm dev run 4
# or...
$ pnpm build
$ pnpm start run 4
```For more information on the available flags and options, use the `help` command.