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

docs(plugins): update recipe example's lighthouse peer dependency version #9653

Merged
merged 7 commits into from Sep 17, 2019
Merged

Conversation

alabiaga
Copy link
Contributor

@alabiaga alabiaga commented Sep 11, 2019

Summary

update to lighthouse version that supports plugins
@alabiaga alabiaga changed the title update lighthouse peerDependency version plugin(docs): Update plugin recipe example lighthouse peer dependency version Sep 11, 2019
@alabiaga
Copy link
Contributor Author

cc\ @brendankenny

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

thanks @alabiaga!

docs/recipes/lighthouse-plugin-example/package.json Outdated Show resolved Hide resolved
docs/recipes/lighthouse-plugin-example/readme.md Outdated Show resolved Hide resolved
Co-Authored-By: Patrick Hulce <patrick.hulce@gmail.com>
@vercel vercel bot temporarily deployed to staging September 11, 2019 12:59 Inactive
Co-Authored-By: Patrick Hulce <patrick.hulce@gmail.com>
@vercel vercel bot temporarily deployed to staging September 11, 2019 13:00 Inactive
docs/recipes/lighthouse-plugin-example/readme.md Outdated Show resolved Hide resolved
1. Install the plugin as a (peer) dependency, parallel to `lighthouse`.
1. Install `lighthouse` v5 or later.
2. Install the plugin as a (peer) dependency, parallel to `lighthouse`.
3. Run `npx lighthouse lighthouse https://example.com --plugins=lighthouse-plugin-example --view`
Copy link
Collaborator

Choose a reason for hiding this comment

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

hm so trying the npx -p lighthouse method it seems to force install lighthouse everytime which is not what we want

on npx@6.4.1 running the original npx lighthouse https://example.com seems to work just fine. @connorjclark are you able to still reproduce that bug you filed?

Copy link
Member

Choose a reason for hiding this comment

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

on npx@6.4.1 running the original npx lighthouse https://example.com seems to work just fine. @connorjclark are you able to still reproduce that bug you filed?

hmm, on npx@6.9.0 I am getting the problems. It does sort of run lighthouse, but if you include flags (some flags?) it messes things up.

@patrickhulce are you able to run npx lighthouse https://example.com --plugins=lighthouse-plugin-not-a-real-plugin and get a Runtime error encountered: Unable to locate plugin message?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

well I would say it's a bug introduced in a later version of npx but @connorjclark's original report was for 6.4.1 as well...

Copy link
Collaborator

Choose a reason for hiding this comment

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

image
didnt work for me for 6.9.0. It instead runs the other bin script which just launches chrome.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wasn't reading the context of this PR just answering the npx question :) yeeea if we expect lighthouse to be installed in the folder then npx lighthouse ... is the way to go.

Unfortunate that there's this bifurcation in behavior ..

Copy link
Member

Choose a reason for hiding this comment

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

what was the end result of this?

The npx lighthouse lighthouse ... call in the current commit doesn't work for me (it runs the same as the old npx lighthouse) but npx -p lighthouse lighthouse... does work. It seems like @connorjclark your advice to not check in a folder with lighthouse installed in it is to replicate the broken behavior...for the -p version it should work whether it's installed locally or not :)

I say we go with the -p since it works and at worst it just reinstalls lighthouse...but if you're really running a plugin (not just trying out an example plugin) you likely already have a way to run lighthouse (global install, local call within the repo, etc) and so won't be using npx.

Copy link
Collaborator

Choose a reason for hiding this comment

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

the -p lighthouse lighthouse format sgtm. afaict the downside is that it always bypasses the local project's defined package versions and installation, and links the package and its deps in a tmp folder for every run. I killed my connection and verified it at least uses npm's global cache.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah I'm pretty sure npx lighthouse lighthouse is just a typo from copying my suggestion of npx -p lighthouse lighthouse so I don't think anyone wants that one :) 👍

I really dislike reinstalling every time and npx -p lighthouse lighthouse <url> when run in a project that has lighthouse and lighthouse-plugin-foo installed does not recognize and use the locally available plugin on 6.4.1. I'm assuming because it's doing some global reinstall and not using the local build. Since this is the context of the guide here, I would strongly prefer to not give out a known broken command. At this point I would just rather list both, npx does more harm than good

./node_modules/.bin/lighthouse --plugins=...

or

npm install -g lighthouse lighthouse-plugin-...
lighthouse

:( I wish it weren't broken but that just seems worse

Copy link
Contributor Author

@alabiaga alabiaga Sep 16, 2019

Choose a reason for hiding this comment

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

Apologies for not being responsive as I've been working on the actual development of my plugin. So is the preferred documentation here just to use

./node_modules/.bin/lighthouse --plugins=...

Co-Authored-By: Patrick Hulce <patrick.hulce@gmail.com>
@connorjclark connorjclark changed the title plugin(docs): Update plugin recipe example lighthouse peer dependency version docs(plugins): update recipe example's lighthouse peer dependency version Sep 13, 2019
@paulirish
Copy link
Member

I started looking into this and think we have bigger problems to make new plugin dev straightforward and easy. I'll followup with a PR.

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

in the meantime, these changes seem a slight improvement.

@alabiaga
Copy link
Contributor Author

thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants