0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 21:49:51 +01:00

chore(recordings): bundle recorder.js in posthog-js (#14121)

This commit is contained in:
Alex Gyujin Kim 2023-02-15 07:50:52 -05:00 committed by GitHub
parent 18c27227f7
commit 76396d18c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 15 deletions

9
bin/copy-posthog-js Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
set -e
# This script copies the following built files from posthog-js so that they can served on Posthog's CDN
cp node_modules/posthog-js/dist/array.js* frontend/dist/
cp node_modules/posthog-js/dist/array.full.js* frontend/dist/
cp node_modules/posthog-js/dist/recorder.js* frontend/dist/

View File

@ -1,12 +0,0 @@
#!/bin/sh
set -e
cp node_modules/rrweb/dist/record/rrweb-record.min.js frontend/dist/recorder.js
cp node_modules/rrweb/dist/record/rrweb-record.min.js.map frontend/dist/recorder.js.map
sed -i -e s/rrweb-record.min.js.map/recorder.js.map/ frontend/dist/recorder.js
cat node_modules/rrweb/dist/plugins/console-record.min.js >> frontend/dist/recorder.js
cp node_modules/rrweb/dist/plugins/console-record.min.js.map frontend/dist/console-record.min.js.map
sed -i -e 's/\/\/\# sourceMappingURL=recorder/window.rrweb = {record: rrwebRecord}\n\/\/# sourceMappingURL=recorder/g' frontend/dist/recorder.js

View File

@ -17,9 +17,7 @@
},
"packageManager": "pnpm@7.14.2",
"scripts": {
"copy-scripts": "mkdir -p frontend/dist/ && pnpm copy-scripts:array && pnpm copy-scripts:recorder",
"copy-scripts:array": "cp node_modules/posthog-js/dist/array.js* frontend/dist/",
"copy-scripts:recorder": "./bin/copy-scripts-recorder",
"copy-scripts": "mkdir -p frontend/dist/ && ./bin/copy-posthog-js",
"test": "pnpm test:unit && pnpm test:visual-regression",
"test:unit": "jest --testPathPattern=frontend/",
"test:visual-regression": "docker compose -f docker-compose.playwright.yml run --rm -it --build playwright pnpm test:visual-regression:legacy:docker && pnpm test:visual-regression:stories:docker",