pkg-web-browser
Bundle a public website or a local web application to an executable and browse it through a web browser;
basically Pkg + Puppeteeer.
Installation
npm install -g pkg-web-browser
Recipees
Bundle a public website
pkg-web-browser http://website.org /path/to/the/executable-website
Bundle a local node application
Move into the node application to be bundled.
cd path/to/local/app
Install puppeteer-core package.
npm install --save-dev puppeteer-core
Bundle the local application indicating its entrypoint (usally index.js) as "pkg-entrypoint" argument.
pkg-web-browser --pkg-entrypoint=index.js http://localhost:80 localhost-app
Prepare a bundle for another architecture
See Pkg documentation in order to get the full architectures list.
pkg-web-browser --pkg-target=node16-win-x64 http://website.org website-binary.exe
Prepare a windows bundle for an existent chrome
pkg-web-browser --pkg-target=node16-win-x64 --browser-executable-path="C:\\\Program Files\\\Google\\\Chrome\\\Application\\\chrome.exe" --browser-user-data-dir="C:\\\Users\\\danie\\\AppData\\\Local\\\Google\\\Chrome\\\User Data" https://www.wikipedia.org/ wikipedia.exe
Documentation
The first two arguments without --
or -
prefixes are mandatory. The first indicates the url to be navigated while the second the output file path.
pkg-web-browser https://www.wikipedia.org/ wikipedia-app
To see the list of options:
pkg-web-browser --help
To define the program architecture (full list):
pkg-web-browser --pkg-target=node16-win-x64
To define the optional program local entrypoint (dedicated documentation):
pkg-web-browser --pkg-entrypoint=app.js
To define an existent browser executable path:
pkg-web-browser --browser-executable-path=/path/to/chromium
To define a browser user-data directory:
pkg-web-browser --browser-user-data-dir=/path/to/browser/user/data
To define the type of browser:
pkg-web-browser --browser-product=chrome
pkg-web-browser --browser-product=firefox
To set the browser build revision:
pkg-web-browser --browser-revision=1018312
pkg-web-browser --browser-revision=98.0a1
To define the browser arguments:
pkg-web-browser --browser-args=--kiosk
To ignore some of the default browser args:
pkg-web-browser --browser-ignore-default-args=--enable-automation