Skip to content

Commit

Permalink
✨ Added remaining plop scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
atapas committed Feb 16, 2022
1 parent ec79b37 commit ad25ed1
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
10 changes: 10 additions & 0 deletions plop-templates/component.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function {{component}}() {
return (
<div>
<h1>{{name}}</h1>
<p>{{description}}</p>
</div>
);
}

export default {{component}};
2 changes: 2 additions & 0 deletions plop-templates/exportPlay.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as {{component}} } from 'plays/{{folder}}/{{component}}';
//add export here
2 changes: 2 additions & 0 deletions plop-templates/importToMeta.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{component}},
//import play here
17 changes: 17 additions & 0 deletions plopfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ module.exports = plop => {
},
],
actions: [
{
type: 'add',
path: 'src/plays/{{folder}}/{{component}}.js',
templateFile: 'plop-templates/component.hbs',
},
{
type: 'modify',
path: 'src/plays/index.js',
pattern: /\/\/add export here/gi,
templateFile: 'plop-templates/exportPlay.hbs',
},
{
type: 'modify',
path: 'src/meta/play-meta.js',
pattern: /\/\/import play here/gi,
templateFile: 'plop-templates/importToMeta.hbs',
},
{
type: 'modify',
path: 'src/meta/play-meta.js',
Expand Down
3 changes: 2 additions & 1 deletion src/meta/play-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
BasicTree, CdTimerComp,
CurrentTimer,
MovieContainer,
WhyReact
WhyReact,
//import play here
} from "plays";

const plays = [
Expand Down
2 changes: 1 addition & 1 deletion src/plays/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export { default as CdTimerComp } from 'plays/date-time-counter/CdTimerComp';
export { default as BasicTree } from 'plays/family-tree/BasicTree';
export { default as MovieContainer } from 'plays/movies/MovieContainer';
export { default as WhyReact } from 'plays/why-react/WhyReact';

//add export here

0 comments on commit ad25ed1

Please sign in to comment.