Skip to content

Commit 90943d1

Browse files
authored
feat: NodeJS SDK (#3723)
* Move gulp over to TS and use src for builds * Fix gulpfiles * WIP: Move to @browserless.io/browserless for self-packages * WIP: Moving to more npm like imports * Fix npm run build * Fixes for object init * WIP: Dev build * Consolidate build tools, remove gulp, cleanup root * Fix links and docker builds * Fix final build scripts * Fix bad build command * Fix puppeteer on latest, clean npm fixes and building functions * More work on enabling better NodeJS SDK devex * Dev command done! * Fix module import in browserless * WIP Docker for sdk * Remove pw install path from app_dir * Move playwright browsers into accessible location * Updating SDK dockerfile * Add prepare task to build project for npm * Move to prepack vs prepare * 2.0.0-beta-1 * Add in Token class, build upon docker commands, arg parsing * Import any token overrides * Refactor out router to be extensible, private -> protected members * Refactor to make route modules more elegant, docs * 2.0.0-beta-2 * Fix file:/ in package.json * 2.0.0-beta-3 * Re-fix baseURL for downstream packages * 2.0.0-beta-4 * Fix exporting @browserless.io namespace * 2.0.0-beta-5 * Drop nodemon * Drop nodemon from package-lock * Make scanning for routes recursive * Refactor to Class-based syntax for Routes + docs and scaffolding * More work on docs for SDK * More work on docs and READMEs * 2.0.0-beta-6 * Add types and update package dependency * Make sure to use the included version of the package.json * Fix npm install promises not awaiting * 2.0.0-beta-7 * Enable debugging for CLI usage by default * 2.0.0-beta-8 * Add link in main readme to SDK README
1 parent 3e862d0 commit 90943d1

File tree

98 files changed

+4008
-7406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4008
-7406
lines changed

.env.test

-5
This file was deleted.

.eslintrc

-42
This file was deleted.

.github/workflows/docker-chromium.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
run: docker build --build-arg VERSION=latest -f ./docker/chrome/Dockerfile -t ghcr.io/browserless/chrome:latest .
1616

1717
- name: Test the Chrome image
18-
run: docker run --ipc=host -e CI=true --entrypoint ./test.sh ghcr.io/browserless/chrome:latest
18+
run: docker run --ipc=host -e CI=true --entrypoint ./scripts/test.sh ghcr.io/browserless/chrome:latest

.github/workflows/docker-firefox.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
run: docker build --build-arg VERSION=latest -f ./docker/firefox/Dockerfile -t ghcr.io/browserless/firefox:latest .
1616

1717
- name: Test the Firefox image
18-
run: docker run --ipc=host -e CI=true --entrypoint ./test.sh ghcr.io/browserless/firefox:latest
18+
run: docker run --ipc=host -e CI=true --entrypoint ./scripts/test.sh ghcr.io/browserless/firefox:latest

.github/workflows/docker-multi.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
run: docker build --build-arg VERSION=latest -f ./docker/multi/Dockerfile -t ghcr.io/browserless/multi:latest .
1616

1717
- name: Test the multi image
18-
run: docker run --ipc=host -e CI=true --entrypoint ./test.sh ghcr.io/browserless/multi:latest
18+
run: docker run --ipc=host -e CI=true --entrypoint ./scripts/test.sh ghcr.io/browserless/multi:latest

.github/workflows/docker-webkit.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
run: docker build --build-arg VERSION=latest -f ./docker/webkit/Dockerfile -t ghcr.io/browserless/webkit:latest .
1616

1717
- name: Test the Webkit image
18-
run: docker run --ipc=host -e CI=true --entrypoint ./test.sh ghcr.io/browserless/webkit:latest
18+
run: docker run --ipc=host -e CI=true --entrypoint ./scripts/test.sh ghcr.io/browserless/webkit:latest

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ browser.json
66
metrics.json
77
extensions/ublock
88

9+
# npm pack
10+
browserless.io-browserless-*.tgz
11+
912
# MAC
1013
.DS_Store
1114

NOTICE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Browserless
2-
(c) 2022, browserless.io
2+
(c) 2023, browserless.io
33

44
This project includes code from GitHub user "wanhose", from their "Cookie
55
Dialog Monster" project, under the MIT License.

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Browserless allows remote clients to connect and execute headless work, all insi
1515

1616
We take care of common issues such as missing system-fonts, missing external libraries, and performance improvements, along with edge-cases like downloading files and managing sessions. For details, check out the documentation site built into the project which includes Open API docs.
1717

18-
If you've been struggling to deploy headless browsers without running into issues or bloated resource requirements, then Browserless was built for you. Run the browsers in [our cloud](https://browserless.io/) or your own, [free for non-commercial uses](https://github.com/browserless/browserless#licensing).
18+
If you've been struggling to deploy headless browsers without running into issues or bloated resource requirements, then Browserless was built for you. Run the browsers in [our cloud](https://browserless.io/) or your own, [free for non-commercial uses](https://github.com/browserless/browserless#licensing).
1919
# Table of Contents
2020

2121
1. [Features](#features)
@@ -24,8 +24,9 @@ If you've been struggling to deploy headless browsers without running into issue
2424
4. [Hosting](#hosting-providers)
2525
5. [Puppeteer](#puppeteer)
2626
6. [Playwright](#playwright)
27-
7. [Licensing](#licensing)
28-
8. [Changelog](https://github.com/browserless/chrome/blob/master/CHANGELOG.md)
27+
7. [Extending with NodeJS SDK](#extending-nodejs-skd)
28+
8. [Licensing](#licensing)
29+
9. [Changelog](https://github.com/browserless/chrome/blob/master/CHANGELOG.md)
2930

3031
## External links
3132

@@ -102,6 +103,10 @@ const browser = await pw.chromium.connectOverCDP('ws://localhost:3000');
102103

103104
After that, the rest of your code remains the same with no other changes required.
104105

106+
# Extending (NodeJS SKD)
107+
108+
Browserless comes with built-in extension capabilities, and allows for extending nearly any aspect of the system (for Version 2+). For more details on how to write your own routes, build docker images, and more, [see our SDK README.md](/bin/scaffold/README.md) or simply run "npx @browserless.io/browserless create" in a terminal and follow the onscreen prompts.
109+
105110
# Usage with other libraries
106111

107112
Most libraries allow you to specify a remote instance of Chrome to interact with. They are either looking for a websocket endpoint, a host and port, or some address. Browserless supports these by default, however if you're having issues please make an issue in this project and we'll try and work with the library authors to get them integrated with browserless. Please note that in V2 we no longer support selenium or webdriver integrations.

0 commit comments

Comments
 (0)