From 64cf9db602c3f3639ffc5ba9bf21a64b7c4944c3 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Thu, 16 Mar 2023 08:16:44 +0100 Subject: [PATCH] chore: rename browsers folders and files (#9866) --- packages/browsers/package.json | 4 ++-- packages/browsers/src/CLI.ts | 4 ++-- packages/browsers/src/CacheStructure.ts | 2 +- .../browsers.ts => browser-data/browser-data.ts} | 0 .../browsers/src/{browsers => browser-data}/chrome.ts | 0 .../browsers/src/{browsers => browser-data}/firefox.ts | 0 packages/browsers/src/{browsers => browser-data}/types.ts | 0 packages/browsers/src/detectPlatform.ts | 2 +- packages/browsers/src/fetch.ts | 6 +++++- packages/browsers/src/launcher.ts | 4 ++-- packages/browsers/src/{browsers.ts => main-cli.ts} | 0 packages/browsers/src/main.ts | 3 ++- packages/browsers/test/src/chrome-data.spec.ts | 8 +++++--- packages/browsers/test/src/firefox-data.spec.ts | 4 ++-- 14 files changed, 22 insertions(+), 15 deletions(-) rename packages/browsers/src/{browsers/browsers.ts => browser-data/browser-data.ts} (100%) rename packages/browsers/src/{browsers => browser-data}/chrome.ts (100%) rename packages/browsers/src/{browsers => browser-data}/firefox.ts (100%) rename packages/browsers/src/{browsers => browser-data}/types.ts (100%) rename packages/browsers/src/{browsers.ts => main-cli.ts} (100%) diff --git a/packages/browsers/package.json b/packages/browsers/package.json index e7a3aafb..13ff335c 100644 --- a/packages/browsers/package.json +++ b/packages/browsers/package.json @@ -9,7 +9,7 @@ "test": "wireit" }, "bin": { - "@puppeteer/browsers": "lib/cjs/browsers.js" + "@puppeteer/browsers": "lib/cjs/main-cli.js" }, "main": "./lib/cjs/main.js", "exports": { @@ -20,7 +20,7 @@ }, "wireit": { "build": { - "command": "tsc -b && chmod a+x lib/cjs/browsers.js lib/esm/browsers.js", + "command": "tsc -b && chmod a+x lib/cjs/main-cli.js lib/esm/main-cli.js", "files": [ "src/**/*.ts", "tsconfig.json" diff --git a/packages/browsers/src/CLI.ts b/packages/browsers/src/CLI.ts index 4fc6d75e..06b3ca3a 100644 --- a/packages/browsers/src/CLI.ts +++ b/packages/browsers/src/CLI.ts @@ -18,12 +18,12 @@ import ProgressBar from 'progress'; import yargs from 'yargs'; import {hideBin} from 'yargs/helpers'; -import {resolveBuildId} from './browsers/browsers.js'; import { + resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, -} from './browsers/types.js'; +} from './browser-data/browser-data.js'; import {detectBrowserPlatform} from './detectPlatform.js'; import {fetch} from './fetch.js'; import { diff --git a/packages/browsers/src/CacheStructure.ts b/packages/browsers/src/CacheStructure.ts index 9120f7d9..998d0967 100644 --- a/packages/browsers/src/CacheStructure.ts +++ b/packages/browsers/src/CacheStructure.ts @@ -16,7 +16,7 @@ import path from 'path'; -import {Browser, BrowserPlatform} from './browsers/types.js'; +import {Browser, BrowserPlatform} from './browser-data/browser-data.js'; /** * The cache used by Puppeteer relies on the following structure: diff --git a/packages/browsers/src/browsers/browsers.ts b/packages/browsers/src/browser-data/browser-data.ts similarity index 100% rename from packages/browsers/src/browsers/browsers.ts rename to packages/browsers/src/browser-data/browser-data.ts diff --git a/packages/browsers/src/browsers/chrome.ts b/packages/browsers/src/browser-data/chrome.ts similarity index 100% rename from packages/browsers/src/browsers/chrome.ts rename to packages/browsers/src/browser-data/chrome.ts diff --git a/packages/browsers/src/browsers/firefox.ts b/packages/browsers/src/browser-data/firefox.ts similarity index 100% rename from packages/browsers/src/browsers/firefox.ts rename to packages/browsers/src/browser-data/firefox.ts diff --git a/packages/browsers/src/browsers/types.ts b/packages/browsers/src/browser-data/types.ts similarity index 100% rename from packages/browsers/src/browsers/types.ts rename to packages/browsers/src/browser-data/types.ts diff --git a/packages/browsers/src/detectPlatform.ts b/packages/browsers/src/detectPlatform.ts index f18a9861..8ecee194 100644 --- a/packages/browsers/src/detectPlatform.ts +++ b/packages/browsers/src/detectPlatform.ts @@ -16,7 +16,7 @@ import os from 'os'; -import {BrowserPlatform} from './browsers/browsers.js'; +import {BrowserPlatform} from './browser-data/browser-data.js'; export function detectBrowserPlatform(): BrowserPlatform | undefined { const platform = os.platform(); diff --git a/packages/browsers/src/fetch.ts b/packages/browsers/src/fetch.ts index b1bfea4b..fd54b129 100644 --- a/packages/browsers/src/fetch.ts +++ b/packages/browsers/src/fetch.ts @@ -20,7 +20,11 @@ import {mkdir, unlink} from 'fs/promises'; import os from 'os'; import path from 'path'; -import {Browser, BrowserPlatform, downloadUrls} from './browsers/browsers.js'; +import { + Browser, + BrowserPlatform, + downloadUrls, +} from './browser-data/browser-data.js'; import {CacheStructure} from './CacheStructure.js'; import {debug} from './debug.js'; import {detectBrowserPlatform} from './detectPlatform.js'; diff --git a/packages/browsers/src/launcher.ts b/packages/browsers/src/launcher.ts index 2f2bd31a..6bac43e6 100644 --- a/packages/browsers/src/launcher.ts +++ b/packages/browsers/src/launcher.ts @@ -25,8 +25,8 @@ import { BrowserPlatform, executablePathByBrowser, resolveSystemExecutablePath, -} from './browsers/browsers.js'; -import {ChromeReleaseChannel} from './browsers/types.js'; + ChromeReleaseChannel, +} from './browser-data/browser-data.js'; import {CacheStructure} from './CacheStructure.js'; import {debug} from './debug.js'; import {detectBrowserPlatform} from './detectPlatform.js'; diff --git a/packages/browsers/src/browsers.ts b/packages/browsers/src/main-cli.ts similarity index 100% rename from packages/browsers/src/browsers.ts rename to packages/browsers/src/main-cli.ts diff --git a/packages/browsers/src/main.ts b/packages/browsers/src/main.ts index 01282266..e9c85243 100644 --- a/packages/browsers/src/main.ts +++ b/packages/browsers/src/main.ts @@ -27,4 +27,5 @@ export { Browser, BrowserPlatform, ChromeReleaseChannel, -} from './browsers/browsers.js'; +} from './browser-data/browser-data.js'; +export {CLI} from './CLI.js'; diff --git a/packages/browsers/test/src/chrome-data.spec.ts b/packages/browsers/test/src/chrome-data.spec.ts index 60ed13d2..491d2d48 100644 --- a/packages/browsers/test/src/chrome-data.spec.ts +++ b/packages/browsers/test/src/chrome-data.spec.ts @@ -17,13 +17,15 @@ import assert from 'assert'; import path from 'path'; -import {BrowserPlatform} from '../../lib/cjs/browsers/browsers.js'; +import { + BrowserPlatform, + ChromeReleaseChannel, +} from '../../lib/cjs/browser-data/browser-data.js'; import { resolveDownloadUrl, relativeExecutablePath, resolveSystemExecutablePath, -} from '../../lib/cjs/browsers/chrome.js'; -import {ChromeReleaseChannel} from '../../lib/cjs/browsers/types.js'; +} from '../../lib/cjs/browser-data/chrome.js'; describe('Chrome', () => { it('should resolve download URLs', () => { diff --git a/packages/browsers/test/src/firefox-data.spec.ts b/packages/browsers/test/src/firefox-data.spec.ts index a085a7e8..ef9b2b6b 100644 --- a/packages/browsers/test/src/firefox-data.spec.ts +++ b/packages/browsers/test/src/firefox-data.spec.ts @@ -21,12 +21,12 @@ import path from 'path'; import rimraf from 'rimraf'; -import {BrowserPlatform} from '../../lib/cjs/browsers/browsers.js'; +import {BrowserPlatform} from '../../lib/cjs/browser-data/browser-data.js'; import { createProfile, relativeExecutablePath, resolveDownloadUrl, -} from '../../lib/cjs/browsers/firefox.js'; +} from '../../lib/cjs/browser-data/firefox.js'; describe('Firefox', () => { it('should resolve download URLs', () => {