Skip to content

Commit e47a3c0

Browse files
chore: update SDK settings
1 parent c39de14 commit e47a3c0

24 files changed

+93
-45
lines changed

.github/workflows/publish-npm.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to NPM in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/browser-use/browser-use-node/actions/workflows/publish-npm.yml
4+
name: Publish NPM
5+
on:
6+
workflow_dispatch:
7+
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
publish:
13+
name: publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '20'
23+
24+
- name: Install dependencies
25+
run: |
26+
yarn install
27+
28+
- name: Publish to NPM
29+
run: |
30+
bash ./bin/publish-npm
31+
env:
32+
NPM_TOKEN: ${{ secrets.BROWSER_USE_NPM_TOKEN || secrets.NPM_TOKEN }}

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21+
NPM_TOKEN: ${{ secrets.BROWSER_USE_NPM_TOKEN || secrets.NPM_TOKEN }}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 22
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browser-use%2Fbrowser-use-86040fd18419e7b4e0947660d9c0ff1abe21550528d2d2a549736cd16f85a92d.yml
33
openapi_spec_hash: 7c5de9d0f633db35fd9e250fcc834d1f
4-
config_hash: e9e473fb6dc7f3e6f44cf3e3156ca07d
4+
config_hash: 9ae623b132cbaa42505f45bb1db418ea

CONTRIBUTING.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ $ cd browser-use-node
5555
# With yarn
5656
$ yarn link
5757
$ cd ../my-package
58-
$ yarn link browser-use-node
58+
$ yarn link browser-use-sdk
5959

6060
# With pnpm
6161
$ pnpm link --global
6262
$ cd ../my-package
63-
$ pnpm link -—global browser-use-node
63+
$ pnpm link -—global browser-use-sdk
6464
```
6565

6666
## Running tests
@@ -91,3 +91,17 @@ To format and fix all lint issues automatically:
9191
```sh
9292
$ yarn fix
9393
```
94+
95+
## Publishing and releases
96+
97+
Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
98+
the changes aren't made through the automated pipeline, you may want to make releases manually.
99+
100+
### Publish with a GitHub workflow
101+
102+
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/browser-use/browser-use-node/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
103+
104+
### Publish manually
105+
106+
If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
107+
the environment.

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Browser Use TypeScript API Library
22

3-
[![NPM version](<https://img.shields.io/npm/v/browser-use-node.svg?label=npm%20(stable)>)](https://npmjs.org/package/browser-use-node) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/browser-use-node)
3+
[![NPM version](<https://img.shields.io/npm/v/browser-use-sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/browser-use-sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/browser-use-sdk)
44

55
This library provides convenient access to the Browser Use REST API from server-side TypeScript or JavaScript.
66

@@ -11,19 +11,16 @@ It is generated with [Stainless](https://www.stainless.com/).
1111
## Installation
1212

1313
```sh
14-
npm install git+ssh://[email protected]:browser-use/browser-use-node.git
14+
npm install browser-use-sdk
1515
```
1616

17-
> [!NOTE]
18-
> Once this package is [published to npm](https://www.stainless.com/docs/guides/publish), this will become: `npm install browser-use-node`
19-
2017
## Usage
2118

2219
The full API of this library can be found in [api.md](api.md).
2320

2421
<!-- prettier-ignore -->
2522
```js
26-
import BrowserUse from 'browser-use-node';
23+
import BrowserUse from 'browser-use-sdk';
2724

2825
const client = new BrowserUse({
2926
apiKey: process.env['BROWSER_USE_API_KEY'], // This is the default and can be omitted
@@ -40,7 +37,7 @@ This library includes TypeScript definitions for all request params and response
4037

4138
<!-- prettier-ignore -->
4239
```ts
43-
import BrowserUse from 'browser-use-node';
40+
import BrowserUse from 'browser-use-sdk';
4441

4542
const client = new BrowserUse({
4643
apiKey: process.env['BROWSER_USE_API_KEY'], // This is the default and can be omitted
@@ -162,7 +159,7 @@ The log level can be configured in two ways:
162159
2. Using the `logLevel` client option (overrides the environment variable if set)
163160

164161
```ts
165-
import BrowserUse from 'browser-use-node';
162+
import BrowserUse from 'browser-use-sdk';
166163

167164
const client = new BrowserUse({
168165
logLevel: 'debug', // Show all log messages
@@ -190,7 +187,7 @@ When providing a custom logger, the `logLevel` option still controls which messa
190187
below the configured level will not be sent to your logger.
191188

192189
```ts
193-
import BrowserUse from 'browser-use-node';
190+
import BrowserUse from 'browser-use-sdk';
194191
import pino from 'pino';
195192

196193
const logger = pino();
@@ -259,7 +256,7 @@ globalThis.fetch = fetch;
259256
Or pass it to the client:
260257

261258
```ts
262-
import BrowserUse from 'browser-use-node';
259+
import BrowserUse from 'browser-use-sdk';
263260
import fetch from 'my-fetch';
264261

265262
const client = new BrowserUse({ fetch });
@@ -270,7 +267,7 @@ const client = new BrowserUse({ fetch });
270267
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
271268

272269
```ts
273-
import BrowserUse from 'browser-use-node';
270+
import BrowserUse from 'browser-use-sdk';
274271

275272
const client = new BrowserUse({
276273
fetchOptions: {
@@ -287,7 +284,7 @@ options to requests:
287284
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
288285

289286
```ts
290-
import BrowserUse from 'browser-use-node';
287+
import BrowserUse from 'browser-use-sdk';
291288
import * as undici from 'undici';
292289

293290
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
@@ -301,7 +298,7 @@ const client = new BrowserUse({
301298
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
302299

303300
```ts
304-
import BrowserUse from 'browser-use-node';
301+
import BrowserUse from 'browser-use-sdk';
305302

306303
const client = new BrowserUse({
307304
fetchOptions: {
@@ -313,7 +310,7 @@ const client = new BrowserUse({
313310
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
314311

315312
```ts
316-
import BrowserUse from 'npm:browser-use-node';
313+
import BrowserUse from 'npm:browser-use-sdk';
317314

318315
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
319316
const client = new BrowserUse({

bin/check-release-environment

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
errors=()
44

5+
if [ -z "${NPM_TOKEN}" ]; then
6+
errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
7+
fi
8+
59
lenErrors=${#errors[@]}
610

711
if [[ lenErrors -gt 0 ]]; then

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default tseslint.config(
2525
{
2626
patterns: [
2727
{
28-
regex: '^browser-use-node(/.*)?',
28+
regex: '^browser-use-sdk(/.*)?',
2929
message: 'Use a relative import, not a package import.',
3030
},
3131
],

jest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const config: JestConfigWithTsJest = {
77
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
88
},
99
moduleNameMapper: {
10-
'^browser-use-node$': '<rootDir>/src/index.ts',
11-
'^browser-use-node/(.*)$': '<rootDir>/src/$1',
10+
'^browser-use-sdk$': '<rootDir>/src/index.ts',
11+
'^browser-use-sdk/(.*)$': '<rootDir>/src/$1',
1212
},
1313
modulePathIgnorePatterns: [
1414
'<rootDir>/ecosystem-tests/',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "browser-use-node",
2+
"name": "browser-use-sdk",
33
"version": "0.0.1",
44
"description": "The official TypeScript library for the Browser Use API",
55
"author": "Browser Use <[email protected]>",

scripts/build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ node scripts/utils/check-version.cjs
88

99
# Build into dist and will publish the package from there,
1010
# so that src/resources/foo.ts becomes <package root>/resources/foo.js
11-
# This way importing from `"browser-use-node/resources/foo"` works
11+
# This way importing from `"browser-use-sdk/resources/foo"` works
1212
# even with `"moduleResolution": "node"`
1313

1414
rm -rf dist; mkdir dist
@@ -42,8 +42,8 @@ node scripts/utils/postprocess-files.cjs
4242

4343
# make sure that nothing crashes when we require the output CJS or
4444
# import the output ESM
45-
(cd dist && node -e 'require("browser-use-node")')
46-
(cd dist && node -e 'import("browser-use-node")' --input-type=module)
45+
(cd dist && node -e 'require("browser-use-sdk")')
46+
(cd dist && node -e 'import("browser-use-sdk")' --input-type=module)
4747

4848
if [ -e ./scripts/build-deno ]
4949
then

0 commit comments

Comments
 (0)