This commit is contained in:
Yanick Champoux 2022-12-08 10:15:42 -05:00
parent d71cc47470
commit f4bc47bc23
13 changed files with 107 additions and 6 deletions

View File

@ -1 +0,0 @@
import * as R from "remeda";

View File

@ -1 +0,0 @@
import * as R from "remeda";

View File

@ -6,6 +6,8 @@ vars:
YEAR: 2022 YEAR: 2022
DAY: DAY:
sh: date '+%d' | perl -pe's/^0//' sh: date '+%d' | perl -pe's/^0//'
DAY_FORMATTED:
sh: date '+%d'
GREETING: Hello, World! GREETING: Hello, World!
tasks: tasks:
@ -25,6 +27,10 @@ tasks:
cmds: cmds:
- firefox https://adventofcode.com/{{.YEAR}}/day/{{.DAY}} - firefox https://adventofcode.com/{{.YEAR}}/day/{{.DAY}}
download:
cmds:
- aoc download -d {{.DAY}} -o -p 2022/{{.DAY_FORMATTED}}/puzzle.md -i 2022/{{.DAY_FORMATTED}}/input
default: default:
cmds: cmds:
- echo "{{.GREETING}}" - echo "{{.GREETING}}"

View File

@ -0,0 +1,15 @@
---
to: app/hello.js
---
const hello = ```
Hello!
This is your first hygen template.
Learn what it can do here:
https://github.com/jondot/hygen
```
console.log(hello)

View File

@ -0,0 +1,6 @@
---
to: 2022/<%= day %>/part1.js
---
import * as R from "remeda";
export default = () => {};

View File

@ -0,0 +1,7 @@
---
to: 2022/<%= day %>/part2.js
---
import * as R from "remeda";
export default = () => {};

View File

@ -0,0 +1,7 @@
module.exports = [
{
type: 'input',
name: 'day',
message: "advent day?"
}
]

View File

@ -1,17 +1,20 @@
---
to: 2022/<%= day %>/test.js
---
import { test, expect, describe } from "vitest"; import { test, expect, describe } from "vitest";
import { expectSolution } from "../01/main.js"; import { expectSolution } from "../01/main.js";
import { solutionPart1, puzzleInput } from "./part1.js"; import part1, { sample, puzzleInput } from "./part1.js";
import { solutionPart2 } from "./part2.js"; import part2 from "./part2.js";
describe("part 1", () => { describe("part 1", () => {
test.todo("solution", () => { test.todo("solution", () => {
expectSolution(solutionPart1(puzzleInput)).toEqual("TODO"); expectSolution(part1(puzzleInput)).toEqual("TODO");
}); });
}); });
describe("part 2", () => { describe("part 2", () => {
test.todo("solution", () => { test.todo("solution", () => {
expectSolution(solutionPart2(puzzleInput)).toEqual("TODO"); expectSolution(part2(puzzleInput)).toEqual("TODO");
}); });
}); });

View File

@ -0,0 +1,5 @@
---
message: |
hygen {bold generator new} --name [NAME] --action [ACTION]
hygen {bold generator with-prompt} --name [NAME] --action [ACTION]
---

View File

@ -0,0 +1,18 @@
---
to: _templates/<%= name %>/<%= action || 'new' %>/hello.ejs.t
---
---
to: app/hello.js
---
const hello = ```
Hello!
This is your first hygen template.
Learn what it can do here:
https://github.com/jondot/hygen
```
console.log(hello)

View File

@ -0,0 +1,18 @@
---
to: _templates/<%= name %>/<%= action || 'new' %>/hello.ejs.t
---
---
to: app/hello.js
---
const hello = ```
Hello!
This is your first prompt based hygen template.
Learn what it can do here:
https://github.com/jondot/hygen
```
console.log(hello)

View File

@ -0,0 +1,14 @@
---
to: _templates/<%= name %>/<%= action || 'new' %>/prompt.js
---
// see types of prompts:
// https://github.com/enquirer/enquirer/tree/master/examples
//
module.exports = [
{
type: 'input',
name: 'message',
message: "What's your message?"
}
]

View File

@ -0,0 +1,4 @@
---
setup: <%= name %>
force: true # this is because mostly, people init into existing folders is safe
---