tealish icon indicating copy to clipboard operation
tealish copied to clipboard

Add basic project scaffolding functionality via CLI

Open wenkanglu opened this issue 1 year ago • 1 comments

Summary

Just a simple WIP of scaffolding a new Tealish project with a template smart contract, test, and basic utility functions. This is achieved through a new CLI command called start (not entirely sold on the name but it's a start :wink:).

As part of the scaffold, there is a tealish.json file at the root level that contains configs. For now there is only a config for the name (and location) of the build directory that the _build() function builds to. If the config does not exist, the standard name and location is used (build directory at the location of the Tealish file).

Example Usage

  1. At the directory where you want to create a new Tealish project named my_tealish_project, run tealish start my_tealish_project --template=algosdk.
  2. cd into the project root directory.
  3. Install dependencies (optionally set up a virtual environment).
  4. Compile the template contracts via tealish compile contracts
  5. run the example test via python3 -m unittest (assumes algod, kmd, and indexer are running on default Sandbox ports)

Thoughts

  • Not entirely sure if scaffolding should be part of the Tealish CLI but it can be very helpful for devs to get started quick.
  • The actual template files should probably be in a different repo and pulled in when using start.
  • Not sold on using JSON for the config file but having some sort of way to configure Tealish would be beneficial.
  • I'm thinking that the layout of a project created from start should be enforced, e.g., build, contracts, tests directories, and config file all at root level. This makes it easier to reason about the location of certain files when creating new CLI features. However, the names of each directory should be configurable via the config file (like with the build directory).
  • It would be cool to create an Algojig template when Algojig is more accessible.
  • Used requirements.txt in the scaffold for the sake of simplicity but we can of course choose to support pyproject.toml instead.
  • Should there be templates for different testing frameworks too (unittest, pytest, etc.)?

wenkanglu avatar Mar 03 '23 15:03 wenkanglu