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(command-init): recommend build plugins #1836

Merged
merged 14 commits into from
Mar 16, 2021
Merged

Conversation

erezrokah
Copy link
Contributor

@erezrokah erezrokah commented Feb 2, 2021

- Summary

Fixes #1832 pending netlify/framework-info#123 and netlify/next-runtime#93

- Test plan

image

Going to do some more testing once the blocking issues are completed

- Description for the changelog

Recommend plugins during ntl init command and let the user choose if to install them

- A picture of a cute animal (not mandatory but encouraged)

image

TODO

  • Get site Node.js runtime version and pass to framework-info
  • Maybe use plugin names instead of package names?

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Feb 2, 2021
@verythorough
Copy link
Contributor

This is cool, @erezrokah! Is it possible to add an explanatory line before the question prompt?

@erezrokah
Copy link
Contributor Author

This is cool, @erezrokah! Is it possible to add an explanatory line before the question prompt?

Great idea! Of course we can

@verythorough
Copy link
Contributor

This is cool, @erezrokah! Is it possible to add an explanatory line before the question prompt?

Great idea! Of course we can

🎉 @rstavchansky Can you work with @erezrokah to develop an appropriate message? Since this functionality will be used for multiple frameworks/plugins, I'm guessing this will need to be a more general message, like, "Based on the technology used in your site, we recommend the following plugin(s):"

@rstavchansky
Copy link
Contributor

rstavchansky commented Feb 5, 2021

After some discussion in Slack to understand the mode of detection, I'm making this recommendation:

Single recommended plugin flow

Seems like this is a {detected framework} site. 
Recommended Build Plugin: {list single plugin}
Install {single plugin name}?

Multiple recommended plugins flow

Seems like this is a {detected framework} site. 
Recommended Build Plugins: {list multiple plugins}
Which plugins to install?

One thing to consider - Is it possible to add a link to the plugin's readme so people can see what they're installing? (I supposed you’d have to get that link from the plugins.json file, though, unless you could predict it programmatically.)

A note on capitalization from the Style Guide: Build Plugins is capitalized since it's a formal feature name. plugins is not.

@erezrokah
Copy link
Contributor Author

One thing to consider - Is it possible to add a link to the plugin's readme so people can see what they're installing? (I supposed you’d have to get that link from the plugins.json file, though, unless you could predict it programmatically.)

Sure we can add the link

@erezrokah
Copy link
Contributor Author

Update

  • Single plugin:
    image

  • Multiple plugins:
    image

This is pending a decision if to use plugin package names or plugins names.
I also opened netlify/framework-info#133 so we can show a pretty title of the framework.
Also I'm not sure where we can fit a README link (unless we shorten them, I think @eduardoboucas had that idea a while back).

@verythorough
Copy link
Contributor

This is pending a decision if to use plugin package names or plugins names.

If the human-readable names are available, I think those are best.

@erezrokah
Copy link
Contributor Author

Latest version:

Single plugin

image

Multiple plugins

Pre-selection

image

Post-selection

image

@erezrokah erezrokah force-pushed the feat/recommend_plugins branch 2 times, most recently from 238ba5f to b80e574 Compare February 11, 2021 11:49
@erezrokah erezrokah marked this pull request as ready for review February 11, 2021 11:53
@erezrokah erezrokah requested a review from a team as a code owner February 11, 2021 11:53
@erezrokah erezrokah force-pushed the feat/recommend_plugins branch 4 times, most recently from 28dee85 to 8f021c6 Compare February 17, 2021 13:59
}

test('netlify init existing site', async (t) => {
const initQuestions = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Figured it's time for us to be able to test the CLI input prompts. If you think of a better way to do this please let me know.

Copy link
Member

Choose a reason for hiding this comment

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

This is great! 🎉

Copy link
Member

@JGAntunes JGAntunes left a comment

Choose a reason for hiding this comment

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

👍 🚀

const getFrameworkInfo = async ({ siteRoot, nodeVersion }) => {
const frameworks = await listFrameworks({ projectDir: siteRoot, nodeVersion })
if (frameworks.length !== 0) {
const [
Copy link
Member

Choose a reason for hiding this comment

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

Are we only considering the first element of the array on purpose (i.e. the framework-info lib is only returning one framework for the time being)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might detect a few frameworks - the first one has higher priority based on the order in https://github.com/netlify/framework-info/blob/32c58bb8de2f86874a61bdc7abab059c4c638f6c/src/frameworks/main.js#L4.

Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't mind having a comment here just highlighting that (we pick the first as its the highest priority). Not critical though, happy to move forward if you feel like it doesn't make sense @erezrokah 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. I'll add it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in e1a410e

}

test('netlify init existing site', async (t) => {
const initQuestions = [
Copy link
Member

Choose a reason for hiding this comment

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

This is great! 🎉

@erezrokah
Copy link
Contributor Author

erezrokah commented Feb 17, 2021

FYI, this is pending the release of netlify/next-runtime#94 (it was merged but not released). cc @lindsaylevine

@iKristy
Copy link
Member

iKristy commented Feb 17, 2021

Just a suggestion, and please show me the door if you think this is crazy or stupid, but wondering if some iconography (utilizing emojis) might help to grok this (since the message is a bit longer than the other one-liner prompts), as well kind of indent the text under the first line.

So... something like this, maybe?

Seems like this is a {detected framework} site.
❇️ Recommended Build Plugin: {list single plugin}
➡️ Install {single plugin name}?

Again, totally a non-blocking suggestion! Feel free to ignore.

@lindsaylevine
Copy link

FYI, this is pending the release of netlify/netlify-plugin-nextjs#94 (it was merged but not released). cc @lindsaylevine

released to npm, pending this PR to plugins netlify/plugins#222

@erezrokah erezrokah enabled auto-merge (squash) March 16, 2021 10:12
@erezrokah erezrokah disabled auto-merge March 16, 2021 10:12
@erezrokah erezrokah enabled auto-merge (squash) March 16, 2021 10:13
@erezrokah erezrokah merged commit 6a28c04 into master Mar 16, 2021
@erezrokah erezrokah deleted the feat/recommend_plugins branch March 16, 2021 10:28
This was referenced Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: recommend/auto-install build plugins when initializing a site
6 participants