-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
core: restructure types for direct import and publishing #14441
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
271cf0c
start
adamraine 5710d82
env
adamraine 098806c
lhr
adamraine cb26da4
move more
adamraine 44b2a63
module
adamraine adc7ce9
ope
adamraine dbc8d7d
fix
adamraine 654d977
fix
adamraine 36c6acb
Merge branch 'main' into expose-types
adamraine 7832e4f
ope
adamraine b683d56
ope
adamraine 5c35f7c
d.ts again
adamraine ddd7f46
script
adamraine 92e9c53
Merge branch 'main' into expose-types
adamraine c26ad51
pipe
adamraine dd0843e
script
adamraine 67dd4b8
fix uf type import
adamraine 3f429a3
rest
adamraine d0de3a1
ope
adamraine 56e89e2
back
adamraine 01573f9
fix
adamraine f37ff2a
comments
adamraine df88711
gitignore
adamraine 464dea0
Merge branch 'main' into expose-types
adamraine 2231c19
Merge branch 'main' into expose-types
adamraine 773105e
Merge branch 'main' into expose-types
adamraine 31470cf
mv
adamraine 1cfb63c
Merge branch 'main' into expose-types
adamraine db59841
Merge branch 'main' into expose-types
adamraine f6e5f32
Merge branch 'main' into expose-types
adamraine 77866e0
clean types
adamraine 3ec52ee
build all
adamraine d4bdee9
prepack
adamraine 0f1e9c3
types dir
adamraine 32ea5d2
no export
adamraine ca6952b
comments
adamraine 4ea12f0
back artifacts
adamraine 326510c
comments
adamraine fa54814
Merge branch 'main' into expose-types
adamraine 687c219
fix puppeteer
adamraine 715b4f7
license
adamraine c542551
Merge branch 'main' into expose-types
adamraine d7477a7
import all
adamraine cb9d884
Merge branch 'main' into expose-types
adamraine 7955ec9
Merge branch 'main' into expose-types
adamraine 73936ff
Merge branch 'main' into expose-types
adamraine efb7d5e
warning
adamraine 14ca719
internal
adamraine ba3104f
add .js ext and LH to work with nodenext
adamraine 324012a
doc recipe and test
adamraine 9a8b537
update
adamraine c6761ee
Merge branch 'main' into expose-types
adamraine af34cd0
woah there partner
adamraine 05e8815
comments
adamraine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"install-all": "rm -rf /tmp/.junk && rm -f {auth,custom-gatherer-puppeteer,integration-test}/yarn.lock && yarn --cwd auth/ --cache-folder /tmp/.junk && yarn --cwd integration-test/ --cache-folder /tmp/.junk && yarn --cwd custom-gatherer-puppeteer/ --cache-folder /tmp/.junk", | ||
"install-all": "rm -rf /tmp/.junk && rm -f {auth,custom-gatherer-puppeteer,integration-test,type-checking}/yarn.lock && yarn --cwd auth/ --cache-folder /tmp/.junk && yarn --cwd integration-test/ --cache-folder /tmp/.junk && yarn --cwd custom-gatherer-puppeteer/ --cache-folder /tmp/.junk && yarn --cwd type-checking/ --cache-folder /tmp/.junk", | ||
"integration-test": "yarn --cwd integration-test/ test", | ||
"custom-gatherer-puppeteer-test": "yarn --cwd custom-gatherer-puppeteer/ test", | ||
"type-checking-test": "yarn --cwd type-checking/ test", | ||
"test": "sh test-recipes.sh" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ fi | |
yarn install-all | ||
yarn integration-test | ||
yarn custom-gatherer-puppeteer-test | ||
yarn type-checking-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"test": "tsc" | ||
}, | ||
"devDependencies": { | ||
"lighthouse": "file:../../../dist/lighthouse.tgz", | ||
"typescript": "^4.9.4" | ||
}, | ||
"dependencies": { | ||
"puppeteer": "^19.5.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Lighthouse type checking recipe | ||
|
||
This example project demonstrates how Lighthouse types can be imported into a node project. | ||
|
||
`use-types.ts` is a basic user flow script that takes advantage of Lighthouse types and integrates with the version of Puppeteer installed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"target": "esnext", | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"strict": true, | ||
}, | ||
"include": [ | ||
"./use-types.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @license Copyright 2023 The Lighthouse Authors. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
import {writeFileSync} from 'fs'; | ||
|
||
import * as lhApi from 'lighthouse'; | ||
adamraine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import puppeteer from 'puppeteer'; | ||
|
||
const browser = await puppeteer.launch(); | ||
const page = await browser.newPage(); | ||
|
||
const config: lhApi.Config = { | ||
extends: 'lighthouse:default', | ||
settings: { | ||
skipAudits: ['uses-http2'], | ||
}, | ||
}; | ||
|
||
// Lighthouse will accept a page from whatever Puppeteer version is installed. | ||
const flow: lhApi.UserFlow = await lhApi.startFlow(page, {config}); | ||
|
||
await flow.navigate('https://example.com'); | ||
|
||
await flow.startTimespan({name: 'Click button'}); | ||
await page.click('button'); | ||
await flow.endTimespan(); | ||
|
||
await flow.snapshot({name: 'New page state'}); | ||
adamraine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const report = await flow.generateReport(); | ||
writeFileSync('flow.report.html', report); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just better to do this earlier (failing sooner if types are bad), or was there some reason to move?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn type-check
is run as part ofyarn build-all
now, that would have madeyarn type-check
redundant and it would be confusing to receive type check errors as part of the build step.Now we do the type check before building which fails sooner and caches types for the build step.