add hygen template

This commit is contained in:
Yanick Champoux 2021-12-05 11:46:03 -05:00
parent ba9ebde241
commit e89237b77c
8 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,15 @@
---
to: '<%= day %>/part1.pm'
---
package part1;
use 5.34.0;
use warnings;
use experimental 'signatures';
use List::AllUtils qw/ /;
sub solution() {
}
1;

View File

@ -0,0 +1,19 @@
---
to: '<%= day %>/part2.pm'
---
package part2;
use 5.20.0;
use warnings;
use experimental 'signatures';
use List::AllUtils qw/ /;
require './part1.pm';
use experimental qw/ signatures postderef /;
sub solution() {
}
1;

View File

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

View File

@ -0,0 +1,20 @@
---
to: '<%= day %>/test.t'
---
use 5.34.0;
use Test2::V0;
use Path::Tiny;
require './part1.pm';
require './part2.pm';
subtest part1 => sub {
my $todo = todo 'TODO';
is part1::solution( ) => 'TODO';
};
subtest part2 => sub {
my $todo = todo 'TODO';
is part2::solution( ) => '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?"
}
]