hygen
This commit is contained in:
parent
d71cc47470
commit
f4bc47bc23
@ -1 +0,0 @@
|
|||||||
import * as R from "remeda";
|
|
@ -1 +0,0 @@
|
|||||||
import * as R from "remeda";
|
|
@ -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}}"
|
||||||
|
15
_templates/day/new/hello.ejs.t
Normal file
15
_templates/day/new/hello.ejs.t
Normal 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)
|
||||||
|
|
||||||
|
|
6
_templates/day/new/part1.ejs
Normal file
6
_templates/day/new/part1.ejs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
to: 2022/<%= day %>/part1.js
|
||||||
|
---
|
||||||
|
import * as R from "remeda";
|
||||||
|
|
||||||
|
export default = () => {};
|
7
_templates/day/new/part2.ejs
Normal file
7
_templates/day/new/part2.ejs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
to: 2022/<%= day %>/part2.js
|
||||||
|
---
|
||||||
|
import * as R from "remeda";
|
||||||
|
|
||||||
|
|
||||||
|
export default = () => {};
|
7
_templates/day/new/prompt.js
Normal file
7
_templates/day/new/prompt.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module.exports = [
|
||||||
|
{
|
||||||
|
type: 'input',
|
||||||
|
name: 'day',
|
||||||
|
message: "advent day?"
|
||||||
|
}
|
||||||
|
]
|
@ -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");
|
||||||
});
|
});
|
||||||
});
|
});
|
5
_templates/generator/help/index.ejs.t
Normal file
5
_templates/generator/help/index.ejs.t
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
message: |
|
||||||
|
hygen {bold generator new} --name [NAME] --action [ACTION]
|
||||||
|
hygen {bold generator with-prompt} --name [NAME] --action [ACTION]
|
||||||
|
---
|
18
_templates/generator/new/hello.ejs.t
Normal file
18
_templates/generator/new/hello.ejs.t
Normal 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)
|
||||||
|
|
||||||
|
|
18
_templates/generator/with-prompt/hello.ejs.t
Normal file
18
_templates/generator/with-prompt/hello.ejs.t
Normal 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)
|
||||||
|
|
||||||
|
|
14
_templates/generator/with-prompt/prompt.ejs.t
Normal file
14
_templates/generator/with-prompt/prompt.ejs.t
Normal 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?"
|
||||||
|
}
|
||||||
|
]
|
4
_templates/init/repo/new-repo.ejs.t
Normal file
4
_templates/init/repo/new-repo.ejs.t
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
setup: <%= name %>
|
||||||
|
force: true # this is because mostly, people init into existing folders is safe
|
||||||
|
---
|
Loading…
Reference in New Issue
Block a user