Description
Context
The goal of components is to share, between your own projects and with other community members. However, a big challenge is doing so in a generic enough way that components satisfy enough needs to be useful, without being too opinionated. This can be discouraging to would be component authors, as they they need to address their own requirements first, and may not have enough time to think about and implement the needs of others.
Proposal
Follow the approach of shadcn/ui by actually generating source code into ones project, rather than importing a library.
Once the Gomponent is generated, the project author can use it as is, or modify it as required.
Almost like vendoring Go packages like we did back in the day.
Approach
- Define an acceptable repository structure for one or more Gomponents, along with their tests (if any). This should include some metadata in a known format. Or alternatively have a central Awesome mono repo that contributors send PR's to.
- Produce a simple CLI tool that accepts a Gomponent repo url, and a sub command, eg
list
(display metadata) andpull <gomponent-name>
The CLI simply grabs the Gomponent sources and related tests, and places them into your project. Perhaps there are some overrides on path and package. But in the first instance, follow @markuswustenberg convention of path html
package html
From here, the project owner uses the Gomponent as is, or makes whatever modification they feel are needed (usually style adjustments)
This allows Gomponent authors to focus on functionality and ignore style concerns. Hopefully motivating them to share.
IE: I would rather tweak an existing Gomponent that almost fits my needs, than build from scratch. And a streamlined copy paste mechanism would be useful.