Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new CLI interface #10

Closed
zvictor opened this issue Nov 28, 2020 · 2 comments
Closed

new CLI interface #10

zvictor opened this issue Nov 28, 2020 · 2 comments

Comments

@zvictor
Copy link
Owner

zvictor commented Nov 28, 2020

I have the impression that the cli commands need to be better designed.

Ideally, a developer should not need to know how things work internally (pull/push/define). Instead, they should intuitively know what commands to call for their most basic operations and that intuition should come from standard procedures of other workflows, such as build and deploy.

In some ways the dev command tries to do that but it's just not good enough.

Proposal

--- first level commands: ---
  build [directory]                                        [NEW]
  deploy [directory]                                       [NEW]
  dev [directory]                                          [???]
  reset                                                    [KEEP, but add possibility to choose what parts
                                                                  should be reset (optional)]
  
--- second level commands: ---
  define-functions [pattern]                               [KEEP]
  define-indexes [pattern]                                 [KEEP]
  define-roles [pattern]                                   [KEEP]
  pull-schema [output]                                     [KEEP]
  push-schema [pattern]                                    [KEEP]
  generate-types [pattern] [output]                        [REMOVE - it doesn't seem to be useful after all]
  build-sdk [schema-pattern] [documents-pattern] [output]  [KEEP]

--- others: ---
  help [command]                                           [FIX - it has never worked]
  1. The build cmd would only run local operations (for a start, it would only call build-sdk) and provide the resources needed in the development workflow.
    1.1. No side-effects to the database allowed;
    1.2. Therefore, no need to have a secret key and thus it could be used in any regular build script (e.g. npm prepare)
  2. The deploy cmd would run all the operations that result in changes in the database, currently define-* and push-schema.
  3. Both build and deploy would have the option to flag with --watch to become more developer-friendly.
  4. The generate-types is cool, but what use case does it cover? The sdk is already covering all practical use cases I can think of. Only in a case of extreme modularization and code reuse is that I could envision some use for this. It's time to kill it.

Challenges

Questions

  • How can we make a clear distinction between first and second levels?
    I thought on grouping "second level commands" as subcommands (e.g. wrapping them all under run as in npx faugra run define-functions [pattern]), but it doesn't look sexy enough.

  • What should be done with the dev cmd? If both build and deploy have the --watch option, what is the point of dev other than just putting both cmds together?

@zvictor
Copy link
Owner Author

zvictor commented Jul 5, 2022

This task has been partially completed in the 0.0.51 release.

  • All the define-* commands plus push-schema became deploy-*
  • a top deploy command was added to orchestrate the call of every single deploy-* ones, as a top command.
  • build-sdk has been renamed to build. More still has to be done in regards to obtain the expanded schema without importing it to fauna  #1.
  • generate-types has been removed.

This is how it looks right now:

build [schemas-pattern] [documents-pattern] [output]
dev [directory]                                     
deploy [types]                                      
deploy-schemas [pattern]                            
deploy-functions [pattern]                          
deploy-indexes [pattern]                            
deploy-roles [pattern]                              
pull-schema [output]                                
reset [types]                                       
help [command]                                      

Once I finish the improvements in the build command I plan to revisit this task and possibly close it, moving remaining tasks to a new issue.

@zvictor
Copy link
Owner Author

zvictor commented Jul 9, 2022

All concerns have been covered besides the third point (having --watch in the build and more places) in the latest release (v0.0.52).

If you believe that having more --watch options is important to you, feel free to open a new issue describing your needs.

@zvictor zvictor closed this as completed Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant