fastify-cli icon indicating copy to clipboard operation
fastify-cli copied to clipboard

feat: add `fastify install` command

Open matthyk opened this issue 1 year ago • 2 comments

First draft for a new fastify-cli command called install. This command can be used for any existing Fastify project to browse and install Fastify core plugins. Usage is as follows:

  • fastify install my-project: Launches an interactive CLI powered by Inquirer.js and the selected plugins will be installed in the folder my-project. A package.json must already exist in this folder.
  • fastify install my-project --search sql: The CLI searches for any core plugin matching the given word and let the user select from the found plugins
  • fastify help install shows:
Usage: fastify install <FOLDER>

Launches an interactive CLI application that allows you to browse and install Fastify plugins.
Requires an existing `package.json` file in the specified folder.

OPTS

  --search, -s
      search for plugins containing the given word

TODO's:

  • [ ] Add tests
  • [ ] update documentation
  • [ ] Optimize search functionality

Checklist

matthyk avatar Jan 09 '24 16:01 matthyk

@mcollina Is this approach feasible? Some points that still need to be clarified for me:

  • We have to use Inquirer version 8.x since later versions are ESM modules
  • Currently, the versions of the plugins are controlled via the devDependencies in package.json. I am open to other/better approaches

matthyk avatar Jan 17 '24 08:01 matthyk

use the latest version and switch the CLI to esm, there is no real need for the CLI to be CJS.

mcollina avatar Jan 17 '24 09:01 mcollina