mirror of
https://github.com/cupcakearmy/advent-of-code.git
synced 2024-12-21 23:56:30 +00:00
download also the input
This commit is contained in:
parent
f125724239
commit
8f601de26e
17
_templates/riddle/new/index.js
Normal file
17
_templates/riddle/new/index.js
Normal 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) }
|
||||||
|
},
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
---
|
---
|
||||||
to: <%= year %>/<%= day %>/input.txt
|
to: <%= year %>/<%= day %>/input.txt
|
||||||
|
unless_exists: true
|
||||||
---
|
---
|
||||||
|
<%= input %>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
to: <%= year %>/<%= day %>/python/main.py
|
to: <%= year %>/<%= day %>/python/main.py
|
||||||
|
unless_exists: true
|
||||||
---
|
---
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
to: <%= year %>/<%= day %>/README.md
|
to: <%= year %>/<%= day %>/README.md
|
||||||
|
unless_exists: true
|
||||||
---
|
---
|
||||||
|
|
||||||
# <%= day %>
|
# <%= day %>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
---
|
---
|
||||||
to: <%= year %>/<%= day %>/test.txt
|
to: <%= year %>/<%= day %>/test.txt
|
||||||
|
unless_exists: true
|
||||||
---
|
---
|
||||||
|
6
package.json
Normal file
6
package.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.6.0",
|
||||||
|
"hygen": "^6.2.11"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user