prisma-labs / graphql-framework-experiment

Code-First Type-Safe GraphQL Framework
https://nexusjs.org
MIT License
673 stars 66 forks source link

Consider flat CLI commands #312

Open Weakky opened 4 years ago

Weakky commented 4 years ago

Description

We are currently using nested sub commands for our cli. This has a couple of drawbacks:

Proposal

Use a flat hierarchy of commands. Example:

GraphQL Santa - 🎄Delightful GraphQL Application Framework

Usage

  $ graphql-santa command [flags]

Commands

  dev                  Develop your application in watch mode
  build                Build a production-ready server
  generate             Generate the artifacts
  doctor               Check your project state for any problems

  create:app           Setup a ready-to-use graphql-santa
  create:plugin        Setup a plugin

  db:init              Initialize your database  
  db:migrate:plan      Generate a migration file
  db:migrate:apply     Apply a migration to your database
  db:migrate:rollback  Rollback a migration to your database

Examples

  Initialize files for a new graphql-santa project
  $ graphql-santa create:app

  Start developing and watch your changes locally
  $ graphql-santa dev

  Build a production-ready server
  $ graphql-santa build
jasonkuhrt commented 4 years ago

Agreed the proposal example rendering you show is a good direction.

I think the solution to the problem laid out here could also be:

  1. extract cli to lib with unit tests
  2. help should traverse its sub tree
jasonkuhrt commented 4 years ago

Agreed upon that I will show a proposed "help tree" mockup