Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 2.69 KB

README.md

File metadata and controls

65 lines (52 loc) · 2.69 KB

🎅 advent-pages 🎄

a simple advent-of-code project site generator

image

How it works

This project builds a node script (dist/index.js) that scans a directory for a advent.config.json file and uses metadata in that file to generate a static site to the folder advent-pages.

The metadata provided allows you to specify which code file corresponds to a advent problem and solution and renders it in a standalone page. Configuration uses relative pathing to where the script process is running. image

Get started

Installing

Install the package and run the generate command to create the site folder.

npm install --save @koalanis/advent-pages
npx @koalanis/advent-pages generate

Configuration

The static site's metadata is configured in a advent.config.json file.

{
  "lang": "rust",
  "year": 2021,
  "days": {
    "1": {
       "partOneDone": true,
       "testDataOne": "./test_data.txt",
       "codeOne": "./src/day1/partone.rs",
       "answerOne": "./answer.txt",

       "partTwoDone": true,
       "testDataTwo": "./test_data_2.txt",
       "codeTwo": "./src/day1/parttwo.rs",
       "answerTwo": "./answer_2.txt",
    },
    ...
    "25": {...}
  }
}

The fields days[n].partOneDone and days[n].partTwoDone are booleans that signify if a problem has been compelted, which in turn effects how the completion stars are rendered on the static site.

The other fields in days[n], such as testDataOne, codeOne, etc, are relative paths that are used to inject source text blobs into the static site for display. You can use this to display your advent data & answers, and most importantly, your code solutions.

Github workflow

You can configure this static site generator to work in combination of a github pages. You can add an action to publish the static onto your advent of code github repos. For a template of doing this, take a look at my starter.

Example

Python Advent of Code 2015 link

details

  • built using tsup
  • default styling using NES.css
  • templating using native ts/js string templating

roadmap

  • publish npm package
  • add custom theming support

lastly

the static site is styled in NES.csshttps://github.com/nostalgic-css/NES.css 🙏 thanks to the nostalgic-css team