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

Gatsby Plugin CLI #10294

Closed
wants to merge 1 commit into from
Closed

Gatsby Plugin CLI #10294

wants to merge 1 commit into from

Conversation

moonmeister
Copy link
Contributor

@moonmeister moonmeister commented Dec 5, 2018

See: gatsbyjs/rfcs#13 for discussion of feature and implementation details.

UI Tasks:

  • Add "add" Command to CLI
  • Add "remove" Command to CLI
  • Add "search" Command to CLI
  • Add "config" Command to CLI
  • Add Confirmation for add/remove actions before executing
  • On completion of add/remove log completion and plugin docs to console
  • On completion of config log new config to console and wait for confirmation before writing

Implementation Tasks:

  • "add <plugin..>" add to package.json and install from npm
  • "remove <plugin..>" remove from package.json and remove from node_modules
  • "search " command
  • extend gatsby API with 'onConfigPlugin' to add config to gatsby-config.js in progress: @moonmeister see: https://github.com/gatsbyjs/gatsby/tree/config-api
  • "config <plugin..>" command
  • add hooks for "add" to config added plugins
  • "remove" remove config from gatsby-config
  • auto search into add/remove/config
  • make library for code shared with "new" CLI (yarn choice and spawn)

Testing Tasks:

  • Test all the things

Docs/Community Tasks:

  • Document CLI
  • Document API Changes
  • Update plugins in the Gatsby repo to be compatible
  • Tutorial for plugin creators to make their plugins compatible with the configuration work flow
  • Blog post announcing this sweet sweet feature!

Happy to take PRs against this branch to complete tasks. Please comment if you're going to take a task so we know!

UPDATE [18-03-2019]: Crossed out things no longer being done on this PR. It's not that we don't like these ideas. We're just simplifying this PR.

@moonmeister moonmeister self-assigned this Dec 5, 2018
@moonmeister moonmeister requested a review from a team as a code owner December 5, 2018 02:55
@moonmeister
Copy link
Contributor Author

I'm going to break the API extension for configuring a plugin into a separate PR and will link when I open that PR. Reason being is I think it's functionality can go beyond this CLI extension. It could theoretically also be added to starters and themes. Then it could be triggered when any of things are installed.

@jlengstorf I'm starting to wonder if this api needs to be it's own RFC...Thoughts?

The code is available here: https://github.com/gatsbyjs/gatsby/tree/config-api

@jlengstorf
Copy link
Contributor

@moonmeister it seems to me that you can build it out for this use case, but make sure it's extendable for others. No need to solve all the problems at once. 😄

@wardpeet
Copy link
Contributor

wardpeet commented Feb 8, 2019

@moonmeister any chance you could pick this one up again? We would be ok to go forward with add & remove in this PR 👍

@wardpeet wardpeet added the status: awaiting author response Additional information has been requested from the author label Feb 8, 2019
@moonmeister
Copy link
Contributor Author

@wardpeet yeah, I've been thinking about it lately. Happy to finish it. Can you give me some feedback on the code as is? Add/remove are implemented in this currently. They probably need some finishing touches though.

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

I'm unsure on how to move forward with this PR. I love the idea but just installing a plugin with npm/yarn isn't a super big improvement on developer experience.. It would be cool to add it to gatsby-config.js aswell but I have no idea on how to do that on a consistent manner as gatsby-config can have so many forms.

packages/gatsby/package.json Outdated Show resolved Hide resolved
@moonmeister moonmeister removed the status: awaiting author response Additional information has been requested from the author label Mar 19, 2019
@moonmeister moonmeister added the status: awaiting reviewer response A pull request that is currently awaiting a reviewer's response label Mar 22, 2019
@moonmeister moonmeister changed the title [WIP] Gatsby Plugin CLI Gatsby Plugin CLI Mar 23, 2019
@moonmeister
Copy link
Contributor Author

moonmeister commented Apr 17, 2019

@wardpeet @DSchau where we at on this. Related config API work is moving forward in other PRs. Given our conversation about breaking up large projects it seems reasonable to merge this partial one. I will say the code probably needs a little more work and I may have some changes to merge in from my configapi branch that can happen now. Thoughts?

@moonmeister moonmeister added the topic: cli Related to the Gatsby CLI label Apr 22, 2019
@moonmeister moonmeister force-pushed the plugin-cli branch 2 times, most recently from b9f9f09 to 876749c Compare April 23, 2019 13:30
@moonmeister
Copy link
Contributor Author

@sidharthachatterjee Okay, updated the code from my other branch and rebased. I still need to figure out the Yarn vs NPM using the new "standard" way. Are there docs or a PR you can point me to get me on my way?

@DSchau
Copy link
Contributor

DSchau commented May 22, 2019

Hey Alex!

First of all--just wanted to convey how much we appreciate this PR and our appreciation of the excellent work you've done thus far.

We think the work you've done will be foundational in our future work to make doing "Gatsby things" more automated and easier--and we see this type of work as crucial in making Gatsby more friendly and more accessible to developers of all skill levels. This is something we care about deeply, and we love that you've been working on making certain Gatsby actions easier to do and automated.

That being said--I don't think we want to merge this in its current state. Why?

The PR is clearly foundational, and sets the stage for more impactful and valuable work in the future. For instance, it sets up the ability to do something like gatsby plugin add gatsby-source-contentful, which currently will install the plugin with npm/yarn. However -- in its current state, that's not really a valuable outcome, and just adds some indirection and confusion to the developer (e.g. why would I run that vs. just yarn add). I know you've worked on other aspects of it (e.g. parsing the AST to add plugin(s) in #12822), but those additional, more useful tasks are blocked by us as we further investigate this space and formulate how we best want to establish building blocks to support these kinds of features--for example a plugin validation API and other Gatsby Core API-level implementations. Additionally, the separate, more meaningful features are quite a bit more complex and we want to ensure that we establish the right level of helpers/API to ensure we can roll these out as a first-class CLI integration without brittleness and flakiness.

From this basis, let's close this PR out as it's not in a mergeable state currently--which is every bit our fault for not giving more direction before and as you began the implementation of the PR.

Again -- we appreciate your work here more than you know; thanks for sticking around and being diligent about keeping this up to date! I fully anticipate we'll revisit this type of work in the future, and we'd love your assistance, insight, and expertise when we do so. We'll be in touch!

@DSchau DSchau closed this May 22, 2019
@jmolivas
Copy link

Hey @DSchau Symfony had something called Flex

https://flex.symfony.com/

It is based on Symfony Recipes, which are a set of automated instructions to integrate third-party packages into Symfony applications.

Those are configuration recipes that got added via a post-script once you add you package

I added a comment since this issue and link appeared on a recent conversation on discord

@MichaelDeBoey MichaelDeBoey deleted the plugin-cli branch January 20, 2020 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting reviewer response A pull request that is currently awaiting a reviewer's response topic: cli Related to the Gatsby CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants