plentico / plenti

Static Site Generator with Go backend and Svelte frontend
https://plenti.co
Apache License 2.0
1k stars 48 forks source link

Add component CLI command #227

Closed jimafisk closed 1 year ago

jimafisk commented 1 year ago

Format: plenti new component <mycomp>

This should automatically: 1) create a content/_components folder if it doesn't already exist 2) create a subfolder for the component name provided, e.g. content/_components/mycomp 3) create a defaults file with empty json {} inside, e.g. content/_components/mycomp/_defaults.json 4) create a schema file with empty json {} inside, e.g. content/_components/mycomp/_schema.json

The plenti build breaks if it finds an invalid JSON file, so a blank JSON file breaks the build, thus adding {} inside defaults and schema.

This should be very similar to the plenti new type <mytype> command: https://github.com/plentico/plenti/blob/84f6461d3c5a1485d76f2d5fe1fe5dd7349ae815/cmd/type.go

jimafisk commented 1 year ago

This has been available since v0.5.17. Thanks for adding this @hlanderdev!