hirosystems / clarinet

Write, test and deploy high-quality smart contracts to the Stacks blockchain and Bitcoin.
https://hiro.so/clarinet
GNU General Public License v3.0
302 stars 136 forks source link

Add support for optional templates #341

Open moodmosaic opened 2 years ago

moodmosaic commented 2 years ago

Users should be able to (optionally) specify a template when scaffolding a new clarinet project.

Current usage of clarinet new is

clarinet new [OPTIONS] <NAME>

OPTIONS:
        --disable-telemetry    Do not provide developer usage telemetry for this project
    -h, --help                 Print help information

ARGS:
    <NAME>                     Project's name

Perhaps a template name could be specified in the options, e.g.:

clarinet new empty     # empty contract with clarinet test skeleton (current/default)
clarinet new react     # react frontend with some basic contract 
clarinet new fastcheck # basic contract with property-based tests
...

It should be possible for a user to list all templates via

clarinet new --list

It should be possible for a user to list all templates on web2/web3 via

clarinet new web --search
lgalabru commented 2 years ago

I like this! I've been thinking about the idea of having some sort of curated, open repository of patterns / recipes, where developers could get some templates for things like bitcoin bridging patterns or other.

moodmosaic commented 2 years ago

Exactly, and templates with contract testing patterns like this, this, and this, to help detect unexpected bugs. Encoding contract invariants with the help of such templates can be a decent pre-auditing phase.