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
307 stars 141 forks source link

Create `clarinet devnet ...` commands #1101

Open MicaiahReid opened 1 year ago

MicaiahReid commented 1 year ago

I'll attempt to summarize my discussion with @lgalabru on a vision for expanding clarinet integrate into a few new commands. Here are the main efforts this will entail:


Add clarinet devnet start command / Remove clarinet integrate

The clarinet integrate command isn't really self-explanatory in terms of what it actually does, and it doesn't fit the usual pattern for clarinet commands: clarinet noun verb. Changing to clarinet devnet start fits this pattern and clearly indicates that a devnet will be started.

Add the clarinet devnet package command

This idea originally came from #1059. This command will essentially package up all of the pieces of a project that are required to start a devnet and put them in one JSON file. This will make it easy for the platform team to extract the relevant data from a user's project to hand off to the devnet API. It will also make the next option possible.

Note: We also were considering clarinet devnet export rather than package, please comment if you have any opinions on the command name

Add the clarinet devnet start --package=Package.json startup option

This new --package flag will allow a user to start a devnet using only a clarinet project package (created from clarinet devnet package). The user can then start a devnet without having to run clarinet integrate from a specific directory - they just need the package file, and it has everything they need.

sabbyanandan commented 1 year ago

@MicaiahReid: Woot! I love the thoughtful thinking behind aligning on the clarinet <noun> <verb> conventions—big fan. Doing these as part of v2.0 would be a great way to consolidate and tighten up the related loose DevEx.

As a suggestion, perhaps, we can consider not removing clarinet integrate right away but deprecating it for a few minor releases on the v2.x line. The additional time can make it is easy for developers to migrate their scripts and automation with the v2.0 upgrade. Being more empathetic on this could be helpful to developers.

Aside from being vocal and transparent about these changes in the release notes, blogs, etc., we can share the deprecation more directly as part of the CLI DevEx. For instance, after upgrading to v2.x, if a dev continues to rely on clarinet integrate, we could spit out a WARN message .. something like:

╭─sabbyanandan ~/hiro
╰─$ clarinet --version
clarinet 2.0.0

╭─sabbyanandan ~/hiro
╰─$ clarinet integrate

WARN: The use of `clarinet integrate` is not recommended, given this command is deprecated in v2.x and will be removed soon. Please switch to `clarinet devnet start` instead. You can read more about the reasoning and benefits in the documentation at: https://docs.hiro.so/clarinet/awesome-sauce.
...
...
Computing deployment plan
note: using existing deployments/default.devnet-plan.yaml
...
...
MicaiahReid commented 1 year ago

@sabbyanandan Yes, I'm definitely a fan of giving devs notice! Waiting until v3 to remove clarinet integrate sounds like a great plan.