TerraStackIO / terrastack

This project is archived, but the idea of Terrastack lives on in the Terraform CDK. - https://github.com/hashicorp/terraform-cdk
https://terrastack.io
74 stars 1 forks source link

Extract CLI and use oclif #9

Closed skorfmann closed 5 years ago

skorfmann commented 5 years ago

This extracts the CLI in a dedicated repo: https://github.com/TerraStackIO/terrastack-cli

Benefits:

Drawbacks:

littldr commented 5 years ago

Splitting cli from core logic seems first quite reasonable. But how our stack's package.json will look like with this splitted logic?

Currently we are adding terrastack as a dependency for the stack (see: example).

With this change we also need to install terrastack-cli to be able to execute the stack. So it makes working with Terrastack 'more' complex... Or I'm missing something?

skorfmann commented 5 years ago

With this change we also need to install terrastack-cli to be able to execute the stack. So it makes working with Terrastack 'more' complex... Or I'm missing something?

Yes, the general idea was to have the CLI separate, so it can be installed globally.

For the example folder, we could use npx for a quick start. For the development workflow of the CLI, it can be symlinked.

Anyway, as always, there are pros and cons. Perhaps we should talk about the strategy offline.

skorfmann commented 5 years ago

Drawbacks:

  • oclif is a bit slower than commander (~ 300ms vs 100ms printing the main help)

When it's actually installed and not linked, the difference becomes smaller (oclif: ~ 170ms)

skorfmann commented 5 years ago

Let's merge it and see how it works out (so far quite good for me, working like this for a few days already)

skorfmann commented 5 years ago

btw: One really good argument to exract the CLI is less dependencies. The complex example has now ~ 40 npm packages in production mode. That's practically nothing for Node ;)