hygen
This commit is contained in:
parent
5b7b8336d6
commit
139deb8614
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.js
Normal file
14
_templates/generator/with-prompt/prompt.js
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?"
|
||||||
|
}
|
||||||
|
]
|
3
_templates/package.json
Normal file
3
_templates/package.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "commonjs"
|
||||||
|
}
|
11
_templates/story/new/index.js
Normal file
11
_templates/story/new/index.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
params: ({ args }) => {
|
||||||
|
|
||||||
|
const storypath = args.path.replace( '.svelte', '.stories.svelte' );
|
||||||
|
const component = path.basename(args.path).replace('.svelte','');
|
||||||
|
|
||||||
|
return { storypath, component}
|
||||||
|
}
|
||||||
|
}
|
21
_templates/story/new/stories.svelte.temp
Normal file
21
_templates/story/new/stories.svelte.temp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
to: <%= storypath %>
|
||||||
|
---
|
||||||
|
<Meta title="<%= component %>" component={<%= component %>} argTypes={{}} />
|
||||||
|
|
||||||
|
<Story name="Primary" args={{}} />
|
||||||
|
|
||||||
|
<Template let:args>
|
||||||
|
<div style="width: 50em">
|
||||||
|
<<%= component %> />
|
||||||
|
</div>
|
||||||
|
</Template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
|
||||||
|
import { action } from "@storybook/addon-actions";
|
||||||
|
|
||||||
|
import <%= component %> from './<%=
|
||||||
|
h.path.basename(path)
|
||||||
|
%>';
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user