Skip to content

Commit 9327187

Browse files
authored
misc: rename lighthouse-(core,cli) folders (#14242)
1 parent 2511b06 commit 9327187

File tree

1,212 files changed

+33589
-33609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,212 files changed

+33589
-33609
lines changed

.eslintignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
**/third_party/**
33
**/source-maps/**
44

5-
lighthouse-cli/test/fixtures/byte-efficiency/bundle.js
5+
cli/test/fixtures/byte-efficiency/bundle.js
66

77
/dist/**
88

99
coverage/**
1010

1111
!.eslintrc.cjs
1212

13-
lighthouse-core/scripts/legacy-javascript/variants
13+
core/scripts/legacy-javascript/variants
1414

1515
third-party/**
1616

.eslintrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ module.exports = {
8282
},
8383
overrides: [
8484
{
85-
files: ['lighthouse-cli/test/smokehouse/test-definitions/*.js'],
85+
files: ['cli/test/smokehouse/test-definitions/*.js'],
8686
rules: {
8787
'max-len': 0,
8888
},

.github/scripts/bump-nightly-version.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ set -euxo pipefail
1010

1111
DATE=$(date --date=yesterday '+%Y%m%d')
1212
PATCH=$(node -e "console.log(require('./package.json').version)")
13-
node lighthouse-core/scripts/release/bump-versions.js "$PATCH-dev.$DATE"
13+
node core/scripts/release/bump-versions.js "$PATCH-dev.$DATE"

.github/scripts/generate-devtools-hash.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ LH_ROOT="$SCRIPT_DIR/../.."
1515
cd "$LH_ROOT"
1616
bash .github/scripts/print-devtools-relevant-commits.sh
1717
md5sum \
18-
lighthouse-core/test/devtools-tests/* \
18+
core/test/devtools-tests/* \
1919
third-party/devtools-tests/e2e/**/*.*

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v2
1919
with:
2020
fetch-depth: 100
21-
- run: bash lighthouse-core/scripts/github-actions-commit-range.sh
21+
- run: bash core/scripts/github-actions-commit-range.sh
2222
env:
2323
GITHUB_CONTEXT_PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
2424
GITHUB_CONTEXT_BASE_SHA: ${{ github.event.before }}
@@ -36,7 +36,7 @@ jobs:
3636
run: echo "CHROME_PATH=/home/runner/chrome-linux-tot/chrome" >> $GITHUB_ENV
3737
- name: Install Chrome ToT
3838
working-directory: /home/runner
39-
run: bash $GITHUB_WORKSPACE/lighthouse-core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
39+
run: bash $GITHUB_WORKSPACE/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
4040

4141
# Run tests that require headfull Chrome.
4242
- run: sudo apt-get install xvfb
@@ -57,7 +57,7 @@ jobs:
5757
- run: yarn test-legacy-javascript
5858
- run: yarn i18n:checks
5959
- run: yarn dogfood-lhci
60-
- run: bash lighthouse-core/scripts/copy-util-commonjs.sh
60+
- run: bash core/scripts/copy-util-commonjs.sh
6161

6262
# Fail if any changes were written to any source files or generated untracked files (ex, from: build/build-cdt-lib.js).
6363
- run: git add -A && git diff --cached --exit-code

.github/workflows/devtools.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ jobs:
5959
working-directory: ${{ github.workspace }}/lighthouse
6060

6161
- name: Download depot tools
62-
run: bash $GITHUB_WORKSPACE/lighthouse/lighthouse-core/test/devtools-tests/download-depot-tools.sh
62+
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/download-depot-tools.sh
6363
- name: Download DevTools Frontend
64-
run: bash $GITHUB_WORKSPACE/lighthouse/lighthouse-core/test/devtools-tests/download-devtools.sh
64+
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/download-devtools.sh
6565

6666
- name: Roll Lighthouse + build DevTools
67-
run: bash $GITHUB_WORKSPACE/lighthouse/lighthouse-core/test/devtools-tests/roll-devtools.sh
67+
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/roll-devtools.sh
6868

6969
- name: Cache build artifacts
7070
id: devtools-build-artifacts
@@ -98,7 +98,7 @@ jobs:
9898
run: echo "$DEPOT_TOOLS_PATH" >> $GITHUB_PATH
9999
# For vpython.
100100
- name: Download depot tools
101-
run: bash $GITHUB_WORKSPACE/lighthouse/lighthouse-core/test/devtools-tests/download-depot-tools.sh
101+
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/download-depot-tools.sh
102102

103103
- name: Load build artifacts
104104
id: devtools-build-artifacts
@@ -111,7 +111,7 @@ jobs:
111111
key: devtools-build-artifacts-${{ github.run_id }}
112112

113113
- name: Run e2e tests
114-
run: bash $GITHUB_WORKSPACE/lighthouse/lighthouse-core/test/devtools-tests/run-e2e-tests.sh
114+
run: bash $GITHUB_WORKSPACE/lighthouse/core/test/devtools-tests/run-e2e-tests.sh
115115

116116
smoke:
117117
needs: [build]
@@ -156,7 +156,7 @@ jobs:
156156
run: echo "CHROME_PATH=/home/runner/chrome-linux-tot/chrome" >> $GITHUB_ENV
157157
- name: Install Chrome ToT
158158
working-directory: /home/runner
159-
run: bash ${{ github.workspace }}/lighthouse/lighthouse-core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
159+
run: bash ${{ github.workspace }}/lighthouse/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
160160

161161
- run: mkdir latest-run
162162
working-directory: ${{ github.workspace }}/lighthouse

.github/workflows/package-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- run: yarn build-report
2424
- run: sudo apt-get install xvfb
2525

26-
- run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/lighthouse-core/scripts/release/package-test.sh
26+
- run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/core/scripts/release/package-test.sh
2727

2828
# Fail if any changes were written to source files.
2929
- run: git diff --exit-code
@@ -45,7 +45,7 @@ jobs:
4545
- run: yarn build-report
4646
- run: sudo apt-get install xvfb
4747

48-
- run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/lighthouse-core/scripts/release/package-test.sh --legacy-navigation
48+
- run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/core/scripts/release/package-test.sh --legacy-navigation
4949

5050
# Fail if any changes were written to source files.
5151
- run: git diff --exit-code

.github/workflows/smoke.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: Install Chrome ToT
4545
if: matrix.chrome-channel == 'ToT'
4646
working-directory: /home/runner
47-
run: bash $GITHUB_WORKSPACE/lighthouse-core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
47+
run: bash $GITHUB_WORKSPACE/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
4848

4949
- run: yarn install --frozen-lockfile --network-timeout 1000000
5050
- run: yarn build-report
@@ -96,7 +96,7 @@ jobs:
9696

9797
# Chrome Stable is already installed by default.
9898
- name: Install Chrome ToT
99-
run: bash ${env:GITHUB_WORKSPACE}\lighthouse-core\scripts\download-chrome.sh
99+
run: bash ${env:GITHUB_WORKSPACE}\core\scripts\download-chrome.sh
100100

101101
- run: yarn install --frozen-lockfile --network-timeout 1000000
102102
- run: yarn build-report
@@ -146,7 +146,7 @@ jobs:
146146

147147
- name: Install Chrome ToT
148148
working-directory: /home/runner
149-
run: bash $GITHUB_WORKSPACE/lighthouse-core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
149+
run: bash $GITHUB_WORKSPACE/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
150150

151151
- run: sudo apt-get install xvfb
152152
- name: yarn smoke --fraggle-rock
@@ -193,7 +193,7 @@ jobs:
193193

194194
- name: Install Chrome ToT
195195
working-directory: /home/runner
196-
run: bash $GITHUB_WORKSPACE/lighthouse-core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
196+
run: bash $GITHUB_WORKSPACE/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
197197

198198
- run: sudo apt-get install xvfb
199199
- name: yarn test-bundle
@@ -240,7 +240,7 @@ jobs:
240240

241241
- name: Install Chrome ToT
242242
working-directory: /home/runner
243-
run: bash $GITHUB_WORKSPACE/lighthouse-core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
243+
run: bash $GITHUB_WORKSPACE/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
244244

245245
- run: sudo apt-get install xvfb
246246
- name: yarn test-bundle

.github/workflows/unit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run: echo "CHROME_PATH=/home/runner/chrome-linux-tot/chrome" >> $GITHUB_ENV
5353
- name: Install Chrome ToT
5454
working-directory: /home/runner
55-
run: bash $GITHUB_WORKSPACE/lighthouse-core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
55+
run: bash $GITHUB_WORKSPACE/core/scripts/download-chrome.sh && mv chrome-linux chrome-linux-tot
5656

5757
- run: yarn test-proto # Run before unit-core because the roundtrip json is needed for proto tests.
5858

.gitignore

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ lcov.info
1313
.nyc_output
1414
*.lcov
1515

16-
lighthouse-cli/results
16+
cli/results
1717
results.html
1818
last-run-results.html
1919
/lighthouse-plugin-simple
@@ -28,16 +28,16 @@ last-run-results.html
2828
*.artifacts.log
2929
*.ctc.json
3030

31-
!lighthouse-core/test/results/artifacts/*.trace.json
32-
!lighthouse-core/test/results/artifacts/*.devtoolslog.json
33-
!lighthouse-core/test/fixtures/artifacts/**/*.trace.json
34-
!lighthouse-core/test/fixtures/artifacts/**/*.devtoolslog.json
35-
!lighthouse-core/test/fixtures/traces/**/*.trace.json
36-
!lighthouse-core/test/fixtures/traces/**/*.devtoolslog.json
37-
!lighthouse-core/test/fixtures/config/**/node_modules
31+
!core/test/results/artifacts/*.trace.json
32+
!core/test/results/artifacts/*.devtoolslog.json
33+
!core/test/fixtures/artifacts/**/*.trace.json
34+
!core/test/fixtures/artifacts/**/*.devtoolslog.json
35+
!core/test/fixtures/traces/**/*.trace.json
36+
!core/test/fixtures/traces/**/*.devtoolslog.json
37+
!core/test/fixtures/config/**/node_modules
3838

39-
lighthouse-core/scripts/legacy-javascript/variants
40-
lighthouse-core/scripts/gcp-collection/gcp-data
39+
core/scripts/legacy-javascript/variants
40+
core/scripts/gcp-collection/gcp-data
4141

4242
latest-run
4343
lantern-data

.npmignore

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@ coverage/
99
proto/
1010
docs/
1111

12-
lighthouse-core/lib/sd-validation/
13-
lighthouse-core/scripts/*
14-
lighthouse-core/test/
12+
core/lib/sd-validation/
13+
core/scripts/*
14+
core/test/
1515
viewer/
1616
treemap/
1717
clients/
18-
lighthouse-cli/results/
18+
cli/results/
1919
lighthouse-logger/
2020

2121
# keep a few scripts useful for CI
22-
!lighthouse-core/scripts/manual-chrome-launcher.js
23-
!lighthouse-core/scripts/download-chrome.sh
24-
!lighthouse-core/scripts/package.json
22+
!core/scripts/manual-chrome-launcher.js
23+
!core/scripts/download-chrome.sh
24+
!core/scripts/package.json
2525

2626
# Exclude the CLI smoketests but keep the smoketest runner that is used
2727
# by downstream projects (e.g. publisher ads).
28-
lighthouse-cli/test/*
29-
!lighthouse-cli/test/smokehouse/
30-
lighthouse-cli/test/smokehouse/test-definitions/
28+
cli/test/*
29+
!cli/test/smokehouse/
30+
cli/test/smokehouse/test-definitions/
3131

3232
results/
3333
lantern-data/

CONTRIBUTING.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ If proposing a new audit for Lighthouse, see the [new audit proposal guide](./do
3333

3434
A PR for a new audit or changing an existing audit almost always needs the following:
3535

36-
1. If new, add the audit to the [default config file](lighthouse-core/config/default-config.js) (or, rarely, one of the other config files) so Lighthouse will run it.
36+
1. If new, add the audit to the [default config file](core/config/default-config.js) (or, rarely, one of the other config files) so Lighthouse will run it.
3737

38-
1. **Unit tests**: in the matching test file (e.g. tests for `lighthouse-core/audits/my-swell-audit.js` go in `lighthouse-core/test/audits/my-swell-audit-test.js`).
38+
1. **Unit tests**: in the matching test file (e.g. tests for `core/audits/my-swell-audit.js` go in `core/test/audits/my-swell-audit-test.js`).
3939

40-
1. **Smoke (end-to-end) tests**: search through the [existing test expectations](lighthouse-cli/test/smokehouse/test-definitions/) to see if there's a logical place to add a check for your change, or (as a last resort) add a new smoke test.
40+
1. **Smoke (end-to-end) tests**: search through the [existing test expectations](cli/test/smokehouse/test-definitions/) to see if there's a logical place to add a check for your change, or (as a last resort) add a new smoke test.
4141

42-
1. Run `yarn update:sample-json` to update the [sample Lighthouse result JSON](lighthouse-core/test/results/sample_v2.json) kept in the repo for testing. This will also pull any strings needed for localization into the correct files.
42+
1. Run `yarn update:sample-json` to update the [sample Lighthouse result JSON](core/test/results/sample_v2.json) kept in the repo for testing. This will also pull any strings needed for localization into the correct files.
4343

4444
### Audit `description` Guidelines
4545

@@ -68,13 +68,13 @@ It can be tempting to serialize the entire state of the world into the artifact
6868

6969
A PR adding or changing a gatherer almost always needs to include the following:
7070

71-
1. If new, add the gatherer to the [default config file](lighthouse-core/config/default-config.js) (or, rarely, one of the other config files) so Lighthouse will run it.
71+
1. If new, add the gatherer to the [default config file](core/config/default-config.js) (or, rarely, one of the other config files) so Lighthouse will run it.
7272

7373
1. **Unit tests**: gatherer execution often takes place mostly on the browser side, either through protocol functionality or executing javascript in the test page. This makes gatherers difficult to unit test without extensive mocking, ending up mostly exercising the mocks instead of the actual gatherer.
7474

75-
As a result, we mostly rely on smoke testing for gatherers. However, if there are parts of a gatherer that naturally lend themselves to unit testing, the new tests would go in the matching test file (e.g. tests for `lighthouse-core/gather/gatherers/reap.js` go in `lighthouse-core/test/gather/gatherers/reap-test.js`).
75+
As a result, we mostly rely on smoke testing for gatherers. However, if there are parts of a gatherer that naturally lend themselves to unit testing, the new tests would go in the matching test file (e.g. tests for `core/gather/gatherers/reap.js` go in `core/test/gather/gatherers/reap-test.js`).
7676

77-
1. **Smoke (end-to-end) tests**: search through the [existing test expectations](lighthouse-cli/test/smokehouse/test-definitions/) to see if there's a logical place to add a check for your change, or (as a last resort) add a new smoke test if one is required.
77+
1. **Smoke (end-to-end) tests**: search through the [existing test expectations](cli/test/smokehouse/test-definitions/) to see if there's a logical place to add a check for your change, or (as a last resort) add a new smoke test if one is required.
7878

7979
It's most important to get true end-to-end coverage, so be sure that audits that consume the new gatherer output are in the expectations. Artifacts can also have expectations for those intermediate results.
8080

@@ -87,7 +87,7 @@ A PR adding or changing a gatherer almost always needs to include the following:
8787

8888
This command works for updating `yarn update:sample-artifacts devtoolsLogs` or `traces` as well, but the resulting `sample_v2.json` churn may be extensive and you might be better off editing manually.
8989

90-
1. Run `yarn update:sample-json` to update the [sample Lighthouse result JSON](lighthouse-core/test/results/sample_v2.json) kept in the repo for testing. This will also pull any strings needed for localization into the correct files.
90+
1. Run `yarn update:sample-json` to update the [sample Lighthouse result JSON](core/test/results/sample_v2.json) kept in the repo for testing. This will also pull any strings needed for localization into the correct files.
9191

9292
## Protobuf errors
9393

@@ -128,13 +128,13 @@ accept your pull requests.
128128

129129
## Tracking Errors
130130

131-
We track our errors in the wild with Sentry. In general, do not worry about wrapping your audits or gatherers in try/catch blocks and reporting every error that could possibly occur; `lighthouse-core/runner.js` and `lighthouse-core/gather/gather-runner.js` already catch and report any errors that occur while running a gatherer or audit, including errors fatal to the entire run. However, there are some situations when you might want to explicitly handle an error and report it to Sentry or wrap it to avoid reporting. Generally, you can interact with Sentry simply by requiring the `lighthouse-core/lib/sentry.js` file and call its methods. The module exports a delegate that will correctly handle the error reporting based on the user's opt-in preference and will simply no-op if they haven't so you don't need to check.
131+
We track our errors in the wild with Sentry. In general, do not worry about wrapping your audits or gatherers in try/catch blocks and reporting every error that could possibly occur; `core/runner.js` and `core/gather/gather-runner.js` already catch and report any errors that occur while running a gatherer or audit, including errors fatal to the entire run. However, there are some situations when you might want to explicitly handle an error and report it to Sentry or wrap it to avoid reporting. Generally, you can interact with Sentry simply by requiring the `core/lib/sentry.js` file and call its methods. The module exports a delegate that will correctly handle the error reporting based on the user's opt-in preference and will simply no-op if they haven't so you don't need to check.
132132

133133

134134
#### If you have an expected error that is recoverable but want to track how frequently it happens, *use Sentry.captureException*.
135135

136136
```js
137-
const Sentry = require('./lighthouse-core/lib/sentry');
137+
const Sentry = require('./core/lib/sentry');
138138

139139
try {
140140
doRiskyThing();
@@ -152,7 +152,7 @@ try {
152152
NOTE: If the message you're capturing is dynamic/based on user data or you need a stack trace, then create a fake error instead and use `Sentry.captureException` so that the instances will be grouped together in Sentry.
153153

154154
```js
155-
const Sentry = require('./lighthouse-core/lib/sentry');
155+
const Sentry = require('./core/lib/sentry');
156156

157157
if (networkRecords.length === 1) {
158158
Sentry.captureMessage('Site only had 1 network request', {level: 'info'});

build/build-bundle.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import {rollup} from 'rollup';
2121
// import PubAdsPlugin from 'lighthouse-plugin-publisher-ads/plugin.js';
2222

2323
import * as rollupPlugins from './rollup-plugins.js';
24-
import {Runner} from '../lighthouse-core/runner.js';
24+
import {Runner} from '../core/runner.js';
2525
import {LH_ROOT} from '../root.js';
26-
import {readJson} from '../lighthouse-core/test/test-utils.js';
26+
import {readJson} from '../core/test/test-utils.js';
2727

2828
const require = createRequire(import.meta.url);
2929

@@ -98,7 +98,7 @@ async function buildBundle(entryPath, distPath, opts = {minify: true}) {
9898

9999
/** @type {Record<string, string>} */
100100
const shimsObj = {
101-
[require.resolve('../lighthouse-core/gather/connections/cri.js')]:
101+
[require.resolve('../core/gather/connections/cri.js')]:
102102
'export const CriConnection = {}',
103103
[require.resolve('../package.json')]: `export const version = '${pkg.version}';`,
104104
};
@@ -167,7 +167,7 @@ async function buildBundle(entryPath, distPath, opts = {minify: true}) {
167167
...shimsObj,
168168
// Allows for plugins to import lighthouse.
169169
'lighthouse': `
170-
import {Audit} from '${require.resolve('../lighthouse-core/audits/audit.js')}';
170+
import {Audit} from '${require.resolve('../core/audits/audit.js')}';
171171
export {Audit};
172172
`,
173173
'url': `

build/build-cdt-lib.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {LH_ROOT} from '../root.js';
2323
* @property {string[]} variablesToRemove
2424
*/
2525

26-
const outDir = `${LH_ROOT}/lighthouse-core/lib/cdt/generated`;
26+
const outDir = `${LH_ROOT}/core/lib/cdt/generated`;
2727

2828
/** @type {Modification[]} */
2929
const modifications = [

build/build-cdt-strings.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {LH_ROOT} from '../root.js';
1010

1111
// eslint-disable-next-line max-len
1212
const inFile = `${LH_ROOT}/node_modules/chrome-devtools-frontend/front_end/models/issues_manager/DeprecationIssue.ts`;
13-
const outFile = `${LH_ROOT}/lighthouse-core/lib/deprecations-strings.js`;
13+
const outFile = `${LH_ROOT}/core/lib/deprecations-strings.js`;
1414

1515
const code = fs.readFileSync(inFile, 'utf-8');
1616

build/build-extension.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {rollup} from 'rollup';
1212

1313
import * as rollupPlugins from './rollup-plugins.js';
1414
import {LH_ROOT} from '../root.js';
15-
import {readJson} from '../lighthouse-core/test/test-utils.js';
15+
import {readJson} from '../core/test/test-utils.js';
1616

1717
const argv = process.argv.slice(2);
1818
const browserBrand = argv[0];

build/build-lightrider-bundles.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function buildReportGenerator() {
5050

5151
async function buildStaticServerBundle() {
5252
const bundle = await rollup({
53-
input: 'lighthouse-cli/test/fixtures/static-server.js',
53+
input: 'cli/test/fixtures/static-server.js',
5454
plugins: [
5555
rollupPlugins.nodeResolve(),
5656
],

0 commit comments

Comments
 (0)