From c2b0302b2b5ddcf8b09f0ecd1f1206ca15165ff2 Mon Sep 17 00:00:00 2001 From: Jack Franklin Date: Thu, 2 Apr 2020 11:30:45 +0100 Subject: [PATCH] Stop fetching the protocol file on install --- install.js | 15 +-------------- package.json | 3 ++- utils/protocol-types-generator/index.js | 3 ++- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/install.js b/install.js index 39a7127e96e12..ade7ce1d5960c 100644 --- a/install.js +++ b/install.js @@ -84,7 +84,6 @@ async function download() { // Do nothing if the revision is already downloaded. if (revisionInfo.local) { - generateProtocolTypesIfNecessary(false /* updated */, product); logPolitely(`${supportedProducts[product]} is already in ${revisionInfo.folderPath}; skipping download.`); return; } @@ -109,7 +108,7 @@ async function download() { logPolitely(`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`); localRevisions = localRevisions.filter(revision => revision !== revisionInfo.revision); const cleanupOldVersions = localRevisions.map(revision => browserFetcher.remove(revision)); - Promise.all([...cleanupOldVersions, generateProtocolTypesIfNecessary(true /* updated */, product)]); + Promise.all([...cleanupOldVersions]); } /** @@ -149,18 +148,6 @@ async function download() { return `${Math.round(mb * 10) / 10} Mb`; } - function generateProtocolTypesIfNecessary(updated, product) { - if (product !== 'chrome') - return; - const fs = require('fs'); - const path = require('path'); - if (!fs.existsSync(path.join(__dirname, 'utils', 'protocol-types-generator'))) - return; - if (!updated && fs.existsSync(path.join(__dirname, 'src', 'protocol.d.ts'))) - return; - return require('./utils/protocol-types-generator'); - } - function getFirefoxNightlyVersion(host) { const https = require('https'); const promise = new Promise((resolve, reject) => { diff --git a/package.json b/package.json index 1bf150f85a252..c1c95c8e6aae6 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "apply-next-version": "node utils/apply_next_version.js", "bundle": "npx browserify -r ./index.js:puppeteer -o utils/browser/puppeteer-web.js", "test-types": "node utils/doclint/generate_types && tsc --version && tsc -p utils/doclint/generate_types/test/", - "unit-bundle": "node utils/browser/test.js" + "unit-bundle": "node utils/browser/test.js", + "update-protocol-d-ts": "node utils/protocol-types-generator" }, "author": "The Chromium Authors", "license": "Apache-2.0", diff --git a/utils/protocol-types-generator/index.js b/utils/protocol-types-generator/index.js index 3c6e971489c9e..89568ee74cff2 100644 --- a/utils/protocol-types-generator/index.js +++ b/utils/protocol-types-generator/index.js @@ -72,9 +72,10 @@ declare global { export default Protocol; `; - const outputPath = path.join(__dirname, '..', '..', 'lib', 'protocol.d.ts'); + const outputPath = path.join(__dirname, '..', '..', 'src', 'protocol.d.ts'); require('fs').writeFileSync(outputPath, output); console.log(`Wrote protocol.d.ts for ${version} to ${path.relative(process.cwd(), outputPath)}`); + console.log(`You should commit the changes.`); }); /**