Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
split out browser bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
GRVYDEV committed Jul 9, 2024
1 parent 0bb339f commit c08b0d3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc -p tsconfig.json",
"build:browser": "tsc -p tsconfig.browser.json",
"test": "tsx --test test/*"
},
"repository": {
Expand Down
7 changes: 5 additions & 2 deletions scripts/bundle.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash

npm run build
# NOTE: This script is used to bundle the recorder.js file for the browser.
# It is highly experimental and may not work as expected. Use at your own risk.

browserify dist/recorder/recorder.js -o dist/browser/bundle.js
npm run build:browser

browserify dist/browser/tsc/recorder.js -o dist/browser/bundle.js

# Use sed to insert the new string after the line containing the search string
sed -i '' "/exports.BrowserbaseCodeGenerator = BrowserbaseCodeGenerator;/a\\
Expand Down
11 changes: 11 additions & 0 deletions tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"outDir": "dist/browser/tsc",
"declaration": true,
"lib": ["ESNext", "DOM"],
"module": "NodeNext",
"target": "es2016",
"moduleResolution": "NodeNext"
},
"include": ["src/recorder/recorder.ts"]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"declaration": true,
"lib": ["ESNext", "DOM"],
"module": "NodeNext",
"target": "es2016",
"target": "ESNext",
"moduleResolution": "NodeNext"
},
"include": ["src/**/*.ts"]
Expand Down

0 comments on commit c08b0d3

Please sign in to comment.