Initial commit

This commit is contained in:
Joshua Seigler 2020-12-02 10:06:38 -05:00
commit f3d555f01c
12 changed files with 370 additions and 0 deletions

28
run.js Normal file
View file

@ -0,0 +1,28 @@
const solutionId = process.argv[2]
async function start () {
try {
await runSolution()
} catch (ex) {
if (!solutionId) {
console.error('No solution ID provided; please re-run with an argument, e.g.: npm start day1, or: node run day1')
} else {
await copyTemplate()
}
}
}
function runSolution () {
return require(`./solutions/${solutionId}/solution.js`)
}
async function copyTemplate () {
try {
await require('./copy-template.js')
await runSolution()
} catch (ex) {
console.error(`Unable to run solution for '${solutionId}': ${ex}`, ex.stack)
}
}
start()