Skip to content

Commit 18c27ba

Browse files
committed
use playwright-firefox such that npm install does not download other browsers
1 parent 97f6735 commit 18c27ba

File tree

7 files changed

+31
-30
lines changed

7 files changed

+31
-30
lines changed

Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ FROM ubuntu:jammy
77
# https://github.com/hadolint/hadolint/wiki/DL4006
88
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
99
ARG DEBIAN_FRONTEND=noninteractive
10-
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD true
1110

12-
# Install up-to-date node & npm, deps for virtual screen & noVNC, browser, pip for apprise.
13-
# Playwright needs --with-deps for firefox.
11+
# Install up-to-date node & npm, deps for virtual screen & noVNC, firefox, pip for apprise.
1412
RUN apt-get update \
1513
&& apt-get install --no-install-recommends -y curl ca-certificates \
1614
&& curl -fsSL https://deb.nodesource.com/setup_19.x | bash - \
@@ -50,8 +48,11 @@ RUN pip install apprise
5048
WORKDIR /fgc
5149
COPY package*.json ./
5250

53-
# If firefox is installed (~/.cache/ms-playwright/firefox-*) before `npm install` it may be a newer version than in package.json and playwright will not find it; system deps are installed sep. via apt above to avoid having to pin the version there.
54-
RUN npm install && npx playwright install firefox
51+
# Playwright installs patched firefox to ~/.cache/ms-playwright/firefox-*
52+
# Requires some system deps to run (see install-deps above).
53+
RUN npm install
54+
# Old: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD + install firefox (had to be done after `npm install` to get the correct version). Now: playwright-firefox as npm dep and `npm install` will only install that.
55+
# RUN npx playwright install firefox
5556

5657
COPY . .
5758

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ Data (including json files with claimed games, codes to redeem, screenshots) is
3131

3232
1. [Install Node.js](https://nodejs.org/en/download)
3333
2. Clone/download this repository and `cd` into it in a terminal
34-
3. Run `npm install && npx playwright install firefox`
34+
3. Run `npm install`
3535
4. Run `pip install apprise` to install [apprise](https://github.com/caronc/apprise) if you want notifications
3636

37-
This downloads Firefox to a cache in home ([doc](https://playwright.dev/docs/browsers#managing-browser-binaries)).
37+
During `npm install` Playwright will download its Firefox to a cache in home ([doc](https://playwright.dev/docs/browsers#managing-browser-binaries)).
3838
If you are missing some dependencies for the browser on your system, you can use `sudo npx playwright install firefox --with-deps`.
3939

4040
If you don't want to use Docker for quasi-headless mode, you could run inside a virtual machine, on a server, or you wake your PC at night to avoid being interrupted.

epic-games.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { firefox } from 'playwright'; // stealth plugin needs no outdated playwright-extra
1+
import { firefox } from 'playwright-firefox'; // stealth plugin needs no outdated playwright-extra
22
import { authenticator } from 'otplib';
33
import path from 'path';
44
import { existsSync, writeFileSync } from 'fs';

gog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { firefox } from 'playwright'; // stealth plugin needs no outdated playwright-extra
1+
import { firefox } from 'playwright-firefox'; // stealth plugin needs no outdated playwright-extra
22
import path from 'path';
33
import { jsonDb, datetime, filenamify, prompt, notify, html_game_list } from './util.js';
44
import { cfg } from './config.js';

package-lock.json

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"enquirer": "^2.3.6",
1616
"lowdb": "^5.1.0",
1717
"otplib": "^12.0.1",
18-
"playwright": "^1.31.0",
18+
"playwright-firefox": "^1.31.0",
1919
"puppeteer-extra-plugin-stealth": "^2.11.1"
2020
},
2121
"repository": {

prime-gaming.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { firefox } from 'playwright'; // stealth plugin needs no outdated playwright-extra
1+
import { firefox } from 'playwright-firefox'; // stealth plugin needs no outdated playwright-extra
22
import { authenticator } from 'otplib';
33
import path from 'path';
44
import { jsonDb, datetime, stealth, filenamify, prompt, notify, html_game_list } from './util.js';

0 commit comments

Comments
 (0)