Hello!
It's getting to be that time of year when the annual Advent of Code kicks off. I've taken a swing at it the last couple of years but always fell off after a few days. One of the biggest reasons was having to setup a new 'project' every day. Having to take the time to copy things over and tweak the config was often just enough to keep me from keeping on.
Solution
So this year I've put together a package to install a starter project with minimal effort and I've made it available to everyone through NPM. Now I'm not going to claim that this is the best in the world. In fact it's still a bit rough.
BUT.
I'll be dogfooding it for the rest of the month while I work through some of the previous years puzzles. Anything I find that makes getting up and running with the least possible effort will be added to the package.
I'm also hoping that some folks may find it useful enough to make some suggestions to improve it π
Usage
The README.md should give a pretty clear idea of how to use the package. Of special note: I've made sure you can run it using the npx
command. For those who might not be familiar, npx
allows you to run an npm
command without actually installing it. It's pretty slick π
For example, you can just run
npx @thedavefulton/create-node-cli
and the package will work it's magic without any extra work on your part. It really is one of my favorite things about the Node ecosystem!
Sorry to gush π
I've also added a flag for all of the options so that you can setup an alias in your terminal's configuration. So rather than typing it all out every day or going through the wizard, you could just setup something like
alias newcli='npx @thedavefulton/create-node-cli ts --name "Dave Fulton" --project '
and then everyday you just type
newcli my-new-project-name
and you're off π
Features
So you're still not convinced that this is the one thing that could make 2020 not a complete dumpster fire?
Well, you're probably right π’
But there are a few other things that I think make this pretty useful. I've included a few packages that will make your life a little easier and hopefully help you focus on solving the various daily challenges.
There's Lodash, a really great utility library. I know some of you may frown on it, and there is certainly a lot more that can be done in vanilla JavaScript now. But I still find a bunch of their functions to be helpful Β―_(γ)_/Β―
I've also included a basic testing setup using Jest. I really like having this around for AoC. They usually offer a bunch of examples for their problems and writing a couple of simple unit tests using their data can really clarify my thinking π€
Prettier is there because I like to not worry about how my code is formatted and styled and whatnot
Chalk is there because I like to worry about how my output is formatted and styled and whatnot.
I'm also keeping an eye on adding utility functions when they seem appropriate. For instance, there's a function now that will read a file and give you back an array of lines. Nothing fancy, but I hate having to write that stuff over and over.
In Closing
I'm really excited to get started on the Advent of Code this year. If you are too and you're planning to use JavaScript or TypeScript I hope you'll consider checking out my project. If you're newish (or lazyish π) I think you'll find it can really take out a lot of the boilerplate busywork and let you focus on the challenges you actually care about ποΈ
I'd also love you hear your thoughts and suggestions for improving it! I'm sure there are a bunch of things I haven't thought of that could make your life easier. But more importantly: they could also make my life easier π
Be well π
Top comments (0)