download also the input

This commit is contained in:
Niccolo Borgioli 2023-11-02 00:23:17 +01:00
parent f125724239
commit 8f601de26e
No known key found for this signature in database
GPG Key ID: D93C615F75EE4F0B
7 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,17 @@
const { default: axios } = require('axios')
async function getInput(year, day) {
const { data } = await axios({
url: `https://adventofcode.com/${year}/day/${day}/input`,
headers: {
Cookie: `session=${process.env.TOKEN};`,
},
})
return data
}
module.exports = {
params: async ({ args }) => {
return { ...args, input: await getInput(args.year, args.day) }
},
}

View File

@ -1,3 +1,5 @@
---
to: <%= year %>/<%= day %>/input.txt
unless_exists: true
---
<%= input %>

View File

@ -1,5 +1,6 @@
---
to: <%= year %>/<%= day %>/python/main.py
unless_exists: true
---
#!/usr/bin/env python

View File

@ -1,5 +1,6 @@
---
to: <%= year %>/<%= day %>/README.md
unless_exists: true
---
# <%= day %>

View File

@ -1,3 +1,4 @@
---
to: <%= year %>/<%= day %>/test.txt
unless_exists: true
---

BIN
bun.lockb Executable file

Binary file not shown.

6
package.json Normal file
View File

@ -0,0 +1,6 @@
{
"dependencies": {
"axios": "^1.6.0",
"hygen": "^6.2.11"
}
}