o1-labs / zkapp-cli

CLI to create a zkApp (zero-knowledge app) for Mina Protocol
https://docs.minaprotocol.com/zkapps/how-to-write-a-zkapp
Apache License 2.0
114 stars 43 forks source link

Change the way sources are fetched during the project generation. #615

Closed shimkiv closed 3 months ago

shimkiv commented 5 months ago

At the moment, during new project generation, sources are fetched from the template folder of the zkapp-cli GitHub repository of the main branch. But in some rare cases of incompatible changes introduced in other branches we are hitting the issue when we simply forget the fact that the sources for newly generated project will be fetched from the main GH branch and thus they might (in case of breaking changes - will) be incompatible with the changes the project is generated for. Because of this we spend time to investigate the issue. It will be good to rethink the way we provide sources for generated projects. I'd say we should install template sources alongside with library itself and simply copy/paste (maybe unpacking first) sources locally instead of fetching anything from the network. In this case we also will be able to work offline-ish (we still rely on NPM to download dependencies).

shimkiv commented 3 months ago

Don't forget to also update CI: https://github.com/o1-labs/zkapp-cli/blob/f2159549c2fdffc48aefb161248ecbe85a2bca3c/.github/workflows/ci.yml#L84

mitschabaude commented 3 months ago

The downside is that now we have to install the latest zkapp CLI to get latest templates

shimkiv commented 3 months ago

@mitschabaude not sure it should be considered as the downside. It just becomes more strict but also will give more confidence and will be more similar to other software that scaffold the projects. Take npx create-next-app for example, you either use default and latest application or execute specific version by adding @14.2.3. Same with zkapp-cli, works via NPX just fine if one don't want/need to install specific version globally manually.

npx zkapp-cli@0.19.0 --version
0.19.0

And one will be sure that it will use correct project scaffolding specific for this particular zkapp-cli version not possibly incompatible that sits in "main" branch. And if one thinks they want to try latest and greatest then yes, they will need to upgrade zkapp-cli like in case of any other software I believe.