fix(prepare): don't change package files on prepare (#11579)

This commit is contained in:
Pavel Feldman 2022-01-24 11:25:24 -08:00 committed by GitHub
parent 9542b007cf
commit 136fab7041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 45 additions and 52 deletions

View File

@ -23,6 +23,7 @@ jobs:
- run: npm ci
- run: npm run build
- run: npx playwright install-deps
- run: npx playwright install
- run: npm run lint
- name: Verify clean tree
run: |

View File

@ -1,40 +0,0 @@
/**
* Copyright 2017 Google Inc. All rights reserved.
* Modifications copyright (c) Microsoft Corporation.
*
* 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.
*/
// This file is only run when someone installs via the github repo
const { execSync } = require('child_process');
const path = require('path');
console.log(`Updating test runner...`);
try {
execSync('npm ci --save=false --fund=false --audit=false', {
stdio: ['inherit', 'inherit', 'inherit'],
cwd: path.join(__dirname, 'tests', 'playwright-test', 'stable-test-runner'),
});
} catch (e) {
process.exit(1);
}
console.log(`Downloading browsers...`);
const { installDefaultBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
installDefaultBrowsersForNpmInstall().catch(e => {
console.error(`Failed to install browsers, caused by\n${e.stack}`);
process.exit(1);
});
console.log(`Done. Use "npm run watch" to compile.`);

View File

@ -31,7 +31,6 @@
"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\"",
"clean": "rimraf packages/playwright-core/lib && rimraf packages/playwright-test/lib && rimraf packages/playwright-core/src/generated/",
"prepare": "node install-from-github.js",
"build": "node utils/build/build.js",
"watch": "node utils/build/build.js --watch --lint",
"test-types": "node utils/generate_types/ && npx -p typescript@3.7.5 tsc -p utils/generate_types/test/tsconfig.json && tsc -p ./tests/",

View File

@ -14,6 +14,13 @@
* limitations under the License.
*/
const { installBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
let install;
installBrowsersForNpmInstall(['chromium', 'ffmpeg']);
try {
install = require('playwright-core/lib/utils/registry').installBrowsersForNpmInstall;
} catch (e) {
// Dev build, don't install browsers by default.
}
if (install)
install(['chromium', 'ffmpeg']);

View File

@ -7,9 +7,6 @@
"engines": {
"node": ">=12"
},
"scripts": {
"prepare": "babel --config-file ../../babel.config.json -s --extensions \".ts\" --out-dir lib/utils/ src/utils"
},
"author": {
"name": "Microsoft Corporation"
},

View File

@ -14,6 +14,13 @@
* limitations under the License.
*/
const { installBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
let install;
installBrowsersForNpmInstall(['firefox']);
try {
install = require('playwright-core/lib/utils/registry').installBrowsersForNpmInstall;
} catch (e) {
// Dev build, don't install browsers by default.
}
if (install)
install(['firefox']);

View File

@ -14,6 +14,13 @@
* limitations under the License.
*/
const { installBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
let install;
installBrowsersForNpmInstall(['webkit']);
try {
install = require('playwright-core/lib/utils/registry').installBrowsersForNpmInstall;
} catch (e) {
// Dev build, don't install browsers by default.
}
if (install)
install(['webkit']);

View File

@ -14,6 +14,13 @@
* limitations under the License.
*/
const { installDefaultBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
let install;
installDefaultBrowsersForNpmInstall();
try {
install = require('playwright-core/lib/utils/registry').installDefaultBrowsersForNpmInstall;
} catch (e) {
// Dev build, don't install browsers by default.
}
if (install)
install();

View File

@ -153,6 +153,14 @@ function copyFile(file, from, to) {
fs.copyFileSync(file, destination);
}
// Update test runner.
steps.push({
command: 'npm',
args: ['ci', '--save=false', '--fund=false', '--audit=false'],
shell: true,
cwd: path.join(__dirname, '..', '..', 'tests', 'playwright-test', 'stable-test-runner'),
});
// Build injected scripts.
const webPackFiles = [
'packages/playwright-core/src/server/injected/webpack.config.js',