mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-28 09:23:42 +03:00
chore: migrate to Node 18 lockFileVersion 3 (#29051)
This commit is contained in:
parent
a217d6a08d
commit
03815b9eb1
9112
package-lock.json
generated
9112
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -33,10 +33,10 @@
|
||||
"tsc": "tsc -p .",
|
||||
"build-installer": "babel -s --extensions \".ts\" --out-dir packages/playwright-core/lib/utils/ packages/playwright-core/src/utils",
|
||||
"doc": "node utils/doclint/cli.js",
|
||||
"lint": "npm run eslint && npm run tsc && npm run doc && npm run check-deps && node utils/generate_channels.js && node utils/generate_types/ --check-clean && npm run lint-tests && npm run test-types && npm run lint-packages",
|
||||
"lint": "npm run eslint && npm run tsc && npm run doc && npm run check-deps && node utils/generate_channels.js && node utils/generate_types/ && npm run lint-tests && npm run test-types && npm run lint-packages",
|
||||
"lint-packages": "node utils/workspace.js --ensure-consistent",
|
||||
"lint-tests": "node utils/lint_tests.js",
|
||||
"flint": "concurrently \"npm run eslint\" \"npm run tsc\" \"npm run doc\" \"npm run check-deps\" \"node utils/generate_channels.js\" \"node utils/generate_types/ --check-clean\" \"npm run lint-tests\" \"npm run test-types\" \"npm run lint-packages\"",
|
||||
"flint": "concurrently \"npm run eslint\" \"npm run tsc\" \"npm run doc\" \"npm run check-deps\" \"node utils/generate_channels.js\" \"node utils/generate_types/\" \"npm run lint-tests\" \"npm run test-types\" \"npm run lint-packages\"",
|
||||
"clean": "node utils/build/clean.js",
|
||||
"build": "node utils/build/build.js",
|
||||
"watch": "node utils/build/build.js --watch --lint",
|
||||
@ -64,7 +64,7 @@
|
||||
"@types/babel__core": "^7.20.2",
|
||||
"@types/codemirror": "^5.60.7",
|
||||
"@types/formidable": "^2.0.4",
|
||||
"@types/node": "^16.18.34",
|
||||
"@types/node": "^18.15.3",
|
||||
"@types/react": "^18.0.12",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
"@types/resize-observer-browser": "^0.1.7",
|
||||
|
@ -225,7 +225,7 @@ export abstract class BrowserType extends SdkObject {
|
||||
},
|
||||
});
|
||||
async function closeOrKill(timeout: number): Promise<void> {
|
||||
let timer: NodeJS.Timer;
|
||||
let timer: NodeJS.Timeout;
|
||||
try {
|
||||
await Promise.race([
|
||||
gracefullyClose(),
|
||||
|
@ -480,7 +480,7 @@ export class Frame extends SdkObject {
|
||||
private _childFrames = new Set<Frame>();
|
||||
_name = '';
|
||||
_inflightRequests = new Set<network.Request>();
|
||||
private _networkIdleTimer: NodeJS.Timer | undefined;
|
||||
private _networkIdleTimer: NodeJS.Timeout | undefined;
|
||||
private _setContentCounter = 0;
|
||||
readonly _detachedScope = new LongStandingScope();
|
||||
private _raceAgainstEvaluationStallingEventsPromises = new Set<ManualPromise<any>>();
|
||||
|
@ -217,7 +217,7 @@ export async function validateDependenciesLinux(sdkLanguage: string, linuxLddDir
|
||||
}
|
||||
}
|
||||
|
||||
const maybeSudo = (process.getuid() !== 0) && os.platform() !== 'win32' ? 'sudo ' : '';
|
||||
const maybeSudo = process.getuid?.() && os.platform() !== 'win32' ? 'sudo ' : '';
|
||||
const dockerInfo = readDockerVersionSync();
|
||||
const errorLines = [
|
||||
`Host system is missing dependencies to run browsers.`,
|
||||
@ -366,7 +366,7 @@ function quoteProcessArgs(args: string[]): string[] {
|
||||
}
|
||||
|
||||
export async function transformCommandsForRoot(commands: string[]): Promise<{ command: string, args: string[], elevatedPermissions: boolean}> {
|
||||
const isRoot = process.getuid() === 0;
|
||||
const isRoot = process.getuid?.() === 0;
|
||||
if (isRoot)
|
||||
return { command: 'sh', args: ['-c', `${commands.join('&& ')}`], elevatedPermissions: false };
|
||||
const sudoExists = await spawnAsync('which', ['sudo']);
|
||||
|
@ -21,7 +21,7 @@ export class TimeoutRunnerError extends Error {}
|
||||
|
||||
type TimeoutRunnerData = {
|
||||
lastElapsedSync: number,
|
||||
timer: NodeJS.Timer | undefined,
|
||||
timer: NodeJS.Timeout | undefined,
|
||||
timeoutPromise: ManualPromise<any>,
|
||||
};
|
||||
|
||||
|
@ -54,7 +54,7 @@ const cacheDir = process.env.PWTEST_CACHE_DIR || (() => {
|
||||
// since `os.userInfo()` is not always available.
|
||||
// Note: `process.geteuid()` is not available on windows.
|
||||
// See https://github.com/microsoft/playwright/issues/22721
|
||||
return path.join(os.tmpdir(), `playwright-transform-cache-` + process.geteuid());
|
||||
return path.join(os.tmpdir(), `playwright-transform-cache-` + process.geteuid?.());
|
||||
})();
|
||||
|
||||
const sourceMaps: Map<string, string> = new Map();
|
||||
|
@ -29,6 +29,7 @@
|
||||
"noEmit": true,
|
||||
"noImplicitOverride": true,
|
||||
"useUnknownInCatchVariables": false,
|
||||
"skipLibCheck": true,
|
||||
},
|
||||
"compileOnSave": true,
|
||||
"include": ["packages"],
|
||||
|
@ -613,12 +613,10 @@ class TypesGenerator {
|
||||
const existing = fs.readFileSync(filePath, 'utf8');
|
||||
if (existing === content)
|
||||
return;
|
||||
hadChanges = true;
|
||||
console.error(`Writing //${path.relative(PROJECT_DIR, filePath)}`);
|
||||
fs.writeFileSync(filePath, content, 'utf8');
|
||||
}
|
||||
|
||||
let hadChanges = false;
|
||||
const coreTypesDir = path.join(PROJECT_DIR, 'packages', 'playwright-core', 'types');
|
||||
if (!fs.existsSync(coreTypesDir))
|
||||
fs.mkdirSync(coreTypesDir)
|
||||
@ -629,7 +627,7 @@ class TypesGenerator {
|
||||
writeFile(path.join(coreTypesDir, 'types.d.ts'), await generateCoreTypes(false), true);
|
||||
writeFile(path.join(playwrightTypesDir, 'test.d.ts'), await generateTestTypes(false), true);
|
||||
writeFile(path.join(playwrightTypesDir, 'testReporter.d.ts'), await generateReporterTypes(false), true);
|
||||
process.exit(hadChanges && process.argv.includes('--check-clean') ? 1 : 0);
|
||||
process.exit(0);
|
||||
})().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const child_process = require('child_process');
|
||||
|
||||
const readJSON = async (filePath) => JSON.parse(await fs.promises.readFile(filePath, 'utf8'));
|
||||
const writeJSON = async (filePath, json) => {
|
||||
@ -33,7 +34,6 @@ class PWPackage {
|
||||
this.name = descriptor.name;
|
||||
this.path = descriptor.path;
|
||||
this.files = descriptor.files;
|
||||
this.noConsistent = descriptor.noConsistent;
|
||||
this.packageJSONPath = path.join(this.path, 'package.json');
|
||||
this.packageJSON = JSON.parse(fs.readFileSync(this.packageJSONPath, 'utf8'));
|
||||
this.isPrivate = !!this.packageJSON.private;
|
||||
@ -107,13 +107,8 @@ class Workspace {
|
||||
await fs.promises.copyFile(fromPath, toPath);
|
||||
}
|
||||
|
||||
// 2. Make sure package-lock and package's package.json are consistent.
|
||||
// All manual package-lock management is a workaround for
|
||||
// https://github.com/npm/cli/issues/3940
|
||||
const pkgLockEntry = packageLock['packages']['packages/' + path.basename(pkg.path)];
|
||||
const depLockEntry = packageLock['dependencies'][pkg.name];
|
||||
// 2. Make sure package's package.jsons are consistent.
|
||||
if (!pkg.isPrivate) {
|
||||
pkgLockEntry.version = version;
|
||||
pkg.packageJSON.version = version;
|
||||
pkg.packageJSON.repository = workspacePackageJSON.repository;
|
||||
pkg.packageJSON.engines = workspacePackageJSON.engines;
|
||||
@ -122,16 +117,7 @@ class Workspace {
|
||||
pkg.packageJSON.license = workspacePackageJSON.license;
|
||||
}
|
||||
|
||||
if (pkg.noConsistent)
|
||||
continue;
|
||||
|
||||
for (const otherPackage of this._packages) {
|
||||
if (pkgLockEntry.dependencies && pkgLockEntry.dependencies[otherPackage.name])
|
||||
pkgLockEntry.dependencies[otherPackage.name] = version;
|
||||
if (pkgLockEntry.devDependencies && pkgLockEntry.devDependencies[otherPackage.name])
|
||||
pkgLockEntry.devDependencies[otherPackage.name] = version;
|
||||
if (depLockEntry.requires && depLockEntry.requires[otherPackage.name])
|
||||
depLockEntry.requires[otherPackage.name] = version;
|
||||
if (pkg.packageJSON.dependencies && pkg.packageJSON.dependencies[otherPackage.name])
|
||||
pkg.packageJSON.dependencies[otherPackage.name] = version;
|
||||
if (pkg.packageJSON.devDependencies && pkg.packageJSON.devDependencies[otherPackage.name])
|
||||
@ -139,7 +125,9 @@ class Workspace {
|
||||
}
|
||||
await maybeWriteJSON(pkg.packageJSONPath, pkg.packageJSON);
|
||||
}
|
||||
await maybeWriteJSON(packageLockPath, packageLock);
|
||||
|
||||
// Re-run npm i to make package-lock dirty.
|
||||
child_process.execSync('npm i');
|
||||
return hasChanges;
|
||||
}
|
||||
}
|
||||
@ -248,6 +236,14 @@ async function parseCLI() {
|
||||
const hasChanges = await workspace.ensureConsistent();
|
||||
if (hasChanges)
|
||||
die(`\n ERROR: workspace is inconsistent! Run '//utils/workspace.js --ensure-consistent' and commit changes!`);
|
||||
// check that there are no dirty git files.
|
||||
const gitStatus = child_process.execSync('git status --porcelain').toString();
|
||||
if (gitStatus.trim())
|
||||
die(`\n ERROR: some git files are dirty, run build and commit changes!\n${gitStatus}`);
|
||||
// Ensure lockfileVersion is 3
|
||||
const packageLock = require(ROOT_PATH + '/package-lock.json');
|
||||
if (packageLock.lockfileVersion !== 3)
|
||||
die(`\n ERROR: package-lock.json lockfileVersion must be 3`);
|
||||
},
|
||||
'--list-public-package-paths': () => {
|
||||
for (const pkg of workspace.packages()) {
|
||||
|
Loading…
Reference in New Issue
Block a user