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

misc(build): use prepack script to build report #13261

Merged
merged 2 commits into from
Oct 27, 2021
Merged

misc(build): use prepack script to build report #13261

merged 2 commits into from
Oct 27, 2021

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented Oct 25, 2021

This is a minor change.

prepack is run by yarn before yarn pack, and is meant to be used to build things that will be needed in the published package.

  1. This offers a safety net when we publish, so that we never accidentally publish with these files being stale. I don't think this is likely given our release process, but still nice
  2. This allows other projects to use Lighthouse at a specific commit referenced via the git/filesystem protocol: when yarn downloads the specific revision, it packs the package (and thus runs prepack).

https://yarnpkg.com/advanced/lifecycle-scripts

@connorjclark connorjclark requested a review from a team as a code owner October 25, 2021 22:58
@connorjclark connorjclark requested review from adamraine and removed request for a team October 25, 2021 22:58
@google-cla google-cla bot added the cla: yes label Oct 25, 2021
@connorjclark
Copy link
Collaborator Author

connorjclark commented Oct 25, 2021

the same is true (wrt prepack) for npm pack, fyi. https://docs.npmjs.com/cli/v7/using-npm/scripts#life-cycle-scripts

@brendankenny
Copy link
Member

@connorjclark not sure if this worked. I yarn added lighthouse from git as a dep and I still got Error: ENOENT: no such file or directory, open '~/tmp/node_modules/lighthouse/report/generator/../../dist/report/flow.js'

@connorjclark
Copy link
Collaborator Author

Shrug. Did I misread the docs?

@brendankenny
Copy link
Member

if you did I did too :)

@connorjclark
Copy link
Collaborator Author

yarnpkg/yarn#5047

kyliau pushed a commit to kyliau/lighthouse-stack-packs that referenced this pull request Nov 16, 2021
During npm install, the Lighthouse package which is installed from GitHub
(@master branch) triggers the newly added `prepack` script [1], but due to
a bug in NPM [2] the devDependencies are not available when the script
is run, thus making the installation fail.

[1]: GoogleChrome/lighthouse#13261
[2]: npm/cli#1865
kyliau pushed a commit to kyliau/lighthouse-stack-packs that referenced this pull request Nov 16, 2021
During npm install, the Lighthouse package which is installed from GitHub
(@master branch) triggers the newly added `prepack` script [1], but due to
a bug in NPM [2] the devDependencies are not available when the script
is run, thus making the installation fail.

[1]: GoogleChrome/lighthouse#13261
[2]: npm/cli#1865
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.

3 participants