chore: initiate monorepo migration (#9022)
This PR starts the monorepo migrations as per https://github.com/puppeteer/puppeteer/issues/8922. To scope migrations, we are only moving the `testserver` into a separate package. Further migrations will come later.
This commit is contained in:
parent
2a21896cf8
commit
c0c7878adc
6
lerna.json
Normal file
6
lerna.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||||
|
"useNx": true,
|
||||||
|
"useWorkspaces": true,
|
||||||
|
"version": "0.0.0"
|
||||||
|
}
|
9057
package-lock.json
generated
9057
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -90,6 +90,7 @@
|
|||||||
"@microsoft/api-documenter": "7.19.14",
|
"@microsoft/api-documenter": "7.19.14",
|
||||||
"@microsoft/api-extractor": "7.31.2",
|
"@microsoft/api-extractor": "7.31.2",
|
||||||
"@microsoft/api-extractor-model": "7.24.2",
|
"@microsoft/api-extractor-model": "7.24.2",
|
||||||
|
"@pptr/testserver": "*",
|
||||||
"@types/debug": "4.1.7",
|
"@types/debug": "4.1.7",
|
||||||
"@types/diff": "5.0.2",
|
"@types/diff": "5.0.2",
|
||||||
"@types/glob": "8.0.0",
|
"@types/glob": "8.0.0",
|
||||||
@ -128,6 +129,7 @@
|
|||||||
"gts": "4.0.0",
|
"gts": "4.0.0",
|
||||||
"husky": "8.0.1",
|
"husky": "8.0.1",
|
||||||
"jpeg-js": "0.4.4",
|
"jpeg-js": "0.4.4",
|
||||||
|
"lerna": "5.5.2",
|
||||||
"mime": "3.0.0",
|
"mime": "3.0.0",
|
||||||
"minimist": "1.2.6",
|
"minimist": "1.2.6",
|
||||||
"mitt": "2.1.0",
|
"mitt": "2.1.0",
|
||||||
@ -148,5 +150,8 @@
|
|||||||
"tsx": "3.9.0",
|
"tsx": "3.9.0",
|
||||||
"typescript": "4.8.3",
|
"typescript": "4.8.3",
|
||||||
"zod": "3.19.1"
|
"zod": "3.19.1"
|
||||||
}
|
},
|
||||||
|
"workspaces": [
|
||||||
|
"packages/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"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",
|
"author": "The Chromium Authors",
|
||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
@ -14,13 +14,27 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {readdirSync, readFileSync} from 'fs';
|
||||||
|
import {join} from 'path';
|
||||||
import packageJson from '../package.json';
|
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 allDeps = {...packageJson.dependencies, ...packageJson.devDependencies};
|
||||||
|
|
||||||
const invalidDeps = new Map<string, string>();
|
const invalidDeps = new Map<string, string>();
|
||||||
|
|
||||||
for (const [depKey, depValue] of Object.entries(allDeps)) {
|
for (const [depKey, depValue] of Object.entries(allDeps)) {
|
||||||
|
if (LOCAL_PACKAGE_NAMES.includes(depKey)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (/[0-9]/.test(depValue[0]!)) {
|
if (/[0-9]/.test(depValue[0]!)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -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')`.
|
- `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.
|
- `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.
|
- `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).
|
- `server`: a dummy test server instance (see `packages/testserver` for more).
|
||||||
- `httpsServer`: a dummy test server HTTPS instance (see `utils/testserver` for more).
|
- `httpsServer`: a dummy test server HTTPS instance (see `packages/testserver` for more).
|
||||||
- `isFirefox`: true if running in Firefox.
|
- `isFirefox`: true if running in Firefox.
|
||||||
- `isChrome`: true if running Chromium.
|
- `isChrome`: true if running Chromium.
|
||||||
- `isHeadless`: true if the test is in headless mode.
|
- `isHeadless`: true if the test is in headless mode.
|
||||||
|
@ -28,7 +28,7 @@ import {
|
|||||||
PuppeteerNode,
|
PuppeteerNode,
|
||||||
} from '../../lib/cjs/puppeteer/node/Puppeteer.js';
|
} from '../../lib/cjs/puppeteer/node/Puppeteer.js';
|
||||||
import puppeteer from '../../lib/cjs/puppeteer/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 {extendExpectWithToBeGolden} from './utils.js';
|
||||||
import * as Mocha from 'mocha';
|
import * as Mocha from 'mocha';
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import {getTestState} from './mocha-utils.js';
|
|||||||
import type {Server, IncomingMessage, ServerResponse} from 'http';
|
import type {Server, IncomingMessage, ServerResponse} from 'http';
|
||||||
import type {Browser} from '../../lib/cjs/puppeteer/api/Browser.js';
|
import type {Browser} from '../../lib/cjs/puppeteer/api/Browser.js';
|
||||||
import type {AddressInfo} from 'net';
|
import type {AddressInfo} from 'net';
|
||||||
import {TestServer} from '../../utils/testserver/lib/index.js';
|
import {TestServer} from '@pptr/testserver';
|
||||||
|
|
||||||
let HOSTNAME = os.hostname();
|
let HOSTNAME = os.hostname();
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"references": [
|
"references": [
|
||||||
{"path": "../src/tsconfig.cjs.json"},
|
{"path": "../src/tsconfig.cjs.json"},
|
||||||
{"path": "../utils/testserver/tsconfig.json"},
|
{"path": "../packages/testserver/tsconfig.json"},
|
||||||
{"path": "../utils/mochaRunner/tsconfig.json"}
|
{"path": "../utils/mochaRunner/tsconfig.json"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user