Coder Social home page Coder Social logo

nesvand / aoc-ts-starter Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 164 KB

Advent of Code starter/setup with helpers/tools to make life easier

License: MIT License

JavaScript 2.46% TypeScript 94.03% Shell 0.31% EJS 3.20%
advent-of-code eslint jest prettier typescript template

aoc-ts-starter's Introduction

Advent of Code Typescript Starter

Test Report

A template for Advent of Code written in Typescript with Node.

(Adapted from https://github.com/ljgago - repo not available)

Usage

The project uses Node.js for the javascript runtime, pnpm for the package manager, and Jest with ts-jest for testing.

git clone https://github.com/nesvand/aoc-solutions
cd aoc-solutions
# install dependencies
pnpm install
# run tests for day01
pnpm test day01
# run day01
pnpm start day01

Generate

You can generate all necessary files for use in the event with a simple command:

$ pnpm gen day01

This command generates these files:

* creating src/day01/resources/input.txt
* creating src/day01/index.ts
* creating src/day01/main.ts
* creating src/day01/part1.ts
* creating src/day01/part2.ts
* creating src/day01/README.md
* creating test/day01.test.spec.ts
  • /src/day01/resources/input.txt: the input data.
  • /src/day01/index.ts: export the modules for testing.
  • /src/day01/main.ts: the main module.
  • /src/day01/part1.ts: solution for part 1.
  • /src/day01/part2.ts: solution for part 2.
  • /src/day01/README.md: you can write the challenge statement.
  • /tests/day01.test.spec.ts: the module where you write the tests.

Config

You can configure the automatic input download from Advent of Code by using your session token.

To download the inputs from web, you need to set the environment var AOC_SESSION. You can to get the session token from the cookie web browser.

Also can you set the AOC_YEAR to select a certain year.

(It is not mandatory use the AOC_YEAR, the pnpm gen can get the year automatically)

You can set an .env file with these variables.

Folder structure:

├── src
│   └── day01
│       ├── index.ts
│       ├── main.ts
│       ├── part1.ts
│       ├── part2.ts
│       ├── README.md
│       └── resources
│           └── input.txt
└── test
    └── day01.test.spec.ts

Happy coding!

Additional Credits

StringView is adapted from sv by Alexey Kutepov.

MIT License

aoc-ts-starter's People

Contributors

nesvand avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.