Skip to content

Commit

Permalink
chore: initiate monorepo migration (#9022)
Browse files Browse the repository at this point in the history
This PR starts the monorepo migrations as per
#8922. To scope migrations,
we are only moving the `testserver` into a separate package. Further
migrations will come later.
  • Loading branch information
jrandolf committed Sep 29, 2022
1 parent 2a21896 commit c0c7878
Show file tree
Hide file tree
Showing 15 changed files with 14,200 additions and 5,130 deletions.
6 changes: 6 additions & 0 deletions lerna.json
@@ -0,0 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useNx": true,
"useWorkspaces": true,
"version": "0.0.0"
}
19,291 changes: 14,168 additions & 5,123 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion package.json
Expand Up @@ -90,6 +90,7 @@
"@microsoft/api-documenter": "7.19.14",
"@microsoft/api-extractor": "7.31.2",
"@microsoft/api-extractor-model": "7.24.2",
"@pptr/testserver": "*",
"@types/debug": "4.1.7",
"@types/diff": "5.0.2",
"@types/glob": "8.0.0",
Expand Down Expand Up @@ -128,6 +129,7 @@
"gts": "4.0.0",
"husky": "8.0.1",
"jpeg-js": "0.4.4",
"lerna": "5.5.2",
"mime": "3.0.0",
"minimist": "1.2.6",
"mitt": "2.1.0",
Expand All @@ -148,5 +150,8 @@
"tsx": "3.9.0",
"typescript": "4.8.3",
"zod": "3.19.1"
}
},
"workspaces": [
"packages/*"
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/puppeteer/puppeteer/tree/main/utils/testserver"
"url": "https://github.com/puppeteer/puppeteer/tree/main/packages/testserver"
},
"author": "The Chromium Authors",
"license": "Apache-2.0"
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions scripts/ensure-pinned-deps.ts
Expand Up @@ -14,13 +14,27 @@
* limitations under the License.
*/

import {readdirSync, readFileSync} from 'fs';
import {join} from 'path';
import packageJson from '../package.json';

const LOCAL_PACKAGE_NAMES = [];
const packagesDir = join(__dirname, '..', 'packages');
for (const package of readdirSync(packagesDir)) {
const {name} = JSON.parse(
readFileSync(join(packagesDir, package, 'package.json'), 'utf8')
);
LOCAL_PACKAGE_NAMES.push(name);
}

const allDeps = {...packageJson.dependencies, ...packageJson.devDependencies};

const invalidDeps = new Map<string, string>();

for (const [depKey, depValue] of Object.entries(allDeps)) {
if (LOCAL_PACKAGE_NAMES.includes(depKey)) {
continue;
}
if (/[0-9]/.test(depValue[0]!)) {
continue;
}
Expand Down
4 changes: 2 additions & 2 deletions test/README.md
Expand Up @@ -11,8 +11,8 @@ You can use the `getTestState` function to read state. It exposes the following
- `puppeteer`: an instance of the Puppeteer library. This is exactly what you'd get if you ran `require('puppeteer')`.
- `puppeteerPath`: the path to the root source file for Puppeteer.
- `defaultBrowserOptions`: the default options the Puppeteer browser is launched from in test mode, so tests can use them and override if required.
- `server`: a dummy test server instance (see `utils/testserver` for more).
- `httpsServer`: a dummy test server HTTPS instance (see `utils/testserver` for more).
- `server`: a dummy test server instance (see `packages/testserver` for more).
- `httpsServer`: a dummy test server HTTPS instance (see `packages/testserver` for more).
- `isFirefox`: true if running in Firefox.
- `isChrome`: true if running Chromium.
- `isHeadless`: true if the test is in headless mode.
Expand Down
2 changes: 1 addition & 1 deletion test/src/mocha-utils.ts
Expand Up @@ -28,7 +28,7 @@ import {
PuppeteerNode,
} from '../../lib/cjs/puppeteer/node/Puppeteer.js';
import puppeteer from '../../lib/cjs/puppeteer/puppeteer.js';
import {TestServer} from '../../utils/testserver/lib/index.js';
import {TestServer} from '@pptr/testserver';
import {extendExpectWithToBeGolden} from './utils.js';
import * as Mocha from 'mocha';

Expand Down
2 changes: 1 addition & 1 deletion test/src/proxy.spec.ts
Expand Up @@ -21,7 +21,7 @@ import {getTestState} from './mocha-utils.js';
import type {Server, IncomingMessage, ServerResponse} from 'http';
import type {Browser} from '../../lib/cjs/puppeteer/api/Browser.js';
import type {AddressInfo} from 'net';
import {TestServer} from '../../utils/testserver/lib/index.js';
import {TestServer} from '@pptr/testserver';

let HOSTNAME = os.hostname();

Expand Down
2 changes: 1 addition & 1 deletion test/tsconfig.json
Expand Up @@ -10,7 +10,7 @@
"include": ["src"],
"references": [
{"path": "../src/tsconfig.cjs.json"},
{"path": "../utils/testserver/tsconfig.json"},
{"path": "../packages/testserver/tsconfig.json"},
{"path": "../utils/mochaRunner/tsconfig.json"}
]
}

0 comments on commit c0c7878

Please sign in to comment.