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

feat: add fastify install command #696

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthyk
Copy link

@matthyk matthyk commented Jan 9, 2024

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 matthyk changed the title first implementation feat: add fastify install command Jan 9, 2024
@matthyk matthyk mentioned this pull request Jan 9, 2024
2 tasks
@matthyk
Copy link
Author

matthyk commented Jan 17, 2024

@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

@mcollina
Copy link
Member

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

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are missing

'@fastify/url-data': '@fastify/url-data: Decorate the Request object with a method to access raw URL components. See https://github.com/fastify/fastify-url-data for more.',
'@fastify/view': '@fastify/view: Templates rendering (ejs, pug, handlebars, marko) plugin support for Fastify. See https://github.com/fastify/point-of-view for more.',
'@fastify/vite': '@fastify/vite: Integration with Vite, allows for serving SPA/MPA/SSR Vite applications. See https://github.com/fastify/fastify-vite for more.',
'@fastify/websocket': '@fastify/websocket: WebSocket support for Fastify. Built upon ws. See https://github.com/fastify/fastify-websocket for more.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be downloading this from a public resource, and not duplicate the data here. Otherwise maintaining this would be problematic.

cc @Fdawgs @Eomm, where do you think it would be better to have this metadata? Could it be part of the website?

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

Successfully merging this pull request may close these issues.

2 participants