From 618fbe010286eebbed0bd3fb03d72ed98f55cad7 Mon Sep 17 00:00:00 2001 From: Pascal Syma Date: Mon, 2 Dec 2024 13:33:22 +0100 Subject: [PATCH] Add CI and README --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ LICENSE | 3 +++ README.md | 37 +++++++++++++++++++++++++++++++++---- package.json | 1 + 4 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 LICENSE diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..8cef73f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: Bun CI + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install bun + uses: oven-sh/setup-bun@v2 + - name: Install dependencies + run: bun install --include=dev + - name: Check formatting + run: bun run check + - name: Run tests + run: bun run test diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d859daf --- /dev/null +++ b/LICENSE @@ -0,0 +1,3 @@ +ALL RIGHTS RESERVED. + +Pascal Syma, 2024. \ No newline at end of file diff --git a/README.md b/README.md index e725b33..9427b13 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,22 @@ -# aoc +# Advent of Code + +> [LANGUAGE: TypeScript] +> +> [RUNTIME: Bun] + +## Structure + +Every solution is grouped by its year and day and (usually) consists of five files: + +| Filename | Purpose | +| ----------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `//index.ts` | Has the solution. Exports two functions: `solveFirst(string): number` and `solveSecond(string): number` | +| `//index.test.ts` | Unit test using the example input and expected solution. | +| `//run.ts` | Basic run script: Loading the actual input and passing it into the two solve functions. | +| `//input.txt` | Input text from AOC. | +| `//-.run.xml` | IntelliJ/Webstorm runfile for `run.ts` using Bun. | + +## Setup To install dependencies: @@ -6,10 +24,21 @@ To install dependencies: bun install ``` -To run: +To test all days: ```bash -bun run src/index.ts +bun run test ``` -This project was created using `bun init` in bun v1.1.36. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. +To create a new day-folder: + +```bash +bun run copy.ts +``` + +To run a single day, first copy your input file from `https://adventofcode.com//day//input` into +`//input.txt`. Then run: + +```bash +bun run //run.ts +``` diff --git a/package.json b/package.json index d343534..a06e86f 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "aoc", "type": "module", "author": "Pascal Syma (https://syma.dev/)", + "license": "All rights reserved.", "scripts": { "format": "prettier --write .", "check": "prettier --check .",