use npm prepare

This commit is contained in:
Joel 2020-01-20 22:33:13 +00:00 committed by Joel Einbinder
parent 1d884c5a52
commit f8c193e51f
2 changed files with 3 additions and 2 deletions

View file

@ -19,7 +19,7 @@
"debug-unit": "node --inspect-brk test/test.js",
"test-doclint": "node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js",
"test": "npm run lint --silent && npm run coverage && npm run test-doclint && node utils/testrunner/test/test.js",
"install": "node -e \"try { require('./install-development.js'); } catch(e) { }\"",
"prepare": "node prepare.js",
"lint": "([ \"$CI\" = true ] && eslint --quiet -f codeframe --ext js,ts ./src || eslint --ext js,ts ./src) && npm run tsc && npm run doc",
"doc": "node utils/doclint/cli.js",
"coverage": "cross-env COVERAGE=true npm run unit",

View file

@ -15,7 +15,7 @@
* limitations under the License.
*/
// This file is only run when someone clones the github repo for development
// This file is only run when someone installs via the github repo
try {
console.log('Building playwright...');
@ -56,6 +56,7 @@ async function downloadAndCleanup(browser) {
// Remove previous revisions.
const playwright = require('.')[browser];
const fetcher = playwright._createBrowserFetcher();
const localRevisions = await fetcher.localRevisions();
const cleanupOldVersions = localRevisions.filter(revision => revision !== revisionInfo.revision).map(revision => fetcher.remove(revision));
await Promise.all([...cleanupOldVersions]);