DEV Community

Discussion on: Raising the Limits on Developer Speed

Collapse
 
dawnmessier profile image
Dawn Messier

I love the scaffolding script. But I'm having difficulty implementing it. You say to add it to your package.json. I'm new to custom scripts there. I added "scripts" { "scaffold": "node scaffold.js" } to package.json. But when I run 'yarn run scaffold main statefulComponentTemplate' or 'yarn run scaffold statefulComponentTemplate', it tells me it's an 'unknown command'. What am I missing?

Collapse
 
hallamoore profile image
Halla Moore

So command is perhaps a bit misleading, but it's referring to the first argument to the scaffold script. The pattern is yarn run scaffold {command} {names}. The command argument has to be one of the cases defined in the switch statement on line 257 (gist.github.com/hallamoore/bf4e18e...), which are 'store', 'component', 'layout', 'screen', 'container', and 'model'. There's also a --stateful option which will use the stateful template, so you might want yarn run scaffold component statefulComponentTemplate --stateful. Hope this helps!

Collapse
 
hallamoore profile image
Halla Moore

Also, just to clarify, you can use any custom name rather than matching the name of the template. It's the command argument and --stateful option that determines which template will be used. E.g. yarn run scaffold component MyStatefulComponent --stateful will create a component named MyStatefulComponent with the statefulComponentTemplate, while yarn run scaffold model User will create User with the modelTemplate