Skip to content

Commit c3538b9

Browse files
authored
publish(repo): Publish forked rrweb packages to NPM (#20)
This patch adds the necessary configuration around our rrweb fork to publish our own `@sentry-internal/rr*` packages. This includes: - prefixing packages with `@sentry-internal` - adjusting licences and the readme - adding a craft config and a version bump script - adding artifact upload to our build&test GHA - adding the Sentry create release GHA
1 parent ac67b09 commit c3538b9

Some content is hidden

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

48 files changed

+476
-402
lines changed

.craft.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
github:
2+
owner: getsentry
3+
repo: rrweb
4+
changelogPolicy: simple
5+
preReleaseCommand: bash scripts/craft-pre-release.sh
6+
requireNames:
7+
- /^sentry-internal-rrweb-snapshot-.*\.tgz$/
8+
- /^sentry-internal-rrweb-player-.*\.tgz$/
9+
- /^sentry-internal-rrweb-.*\.tgz$/
10+
- /^sentry-internal-rrdom-.*\.tgz$/
11+
targets:
12+
- name: github
13+
includeNames: /^sentry-.*.tgz$/
14+
- name: npm
15+
includeNames: /^sentry-.*.tgz$/

.github/workflows/ci-cd.yml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
name: Tests
1+
name: Build & Tests
22

3-
on: [pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release/**
8+
pull_request:
49

510
concurrency: ${{ github.workflow }}-${{ github.ref }}
611

712
jobs:
8-
release:
13+
job_test:
914
name: Tests
1015
runs-on: ubuntu-latest
1116
steps:
@@ -26,5 +31,31 @@ jobs:
2631

2732
- name: Run tests
2833
# Skip this for now, as it somehow always fails
29-
if: 1 == 2
30-
run: xvfb-run --server-args="-screen 0 1920x1080x24" yarn test
34+
if: 1 == 2
35+
run: xvfb-run --server-args="-screen 0 1920x1080x24" yarn test
36+
37+
job_artifacts:
38+
needs: job_test
39+
name: Upload Artifacts
40+
runs-on: ubuntu-latest
41+
# Build artifacts are only needed for releasing workflow.
42+
if: startsWith(github.ref, 'refs/heads/release/')
43+
steps:
44+
- name: Checkout Repo
45+
uses: actions/checkout@v3
46+
47+
- name: Set up Node
48+
uses: volta-cli/action@v3
49+
50+
- name: Install Dependencies
51+
run: yarn --frozen-lockfile
52+
53+
- name: Build Tarballs
54+
run: yarn build:tarball
55+
56+
- name: Upload Artifacts
57+
uses: actions/upload-artifact@v3
58+
with:
59+
name: ${{ github.sha }}
60+
path: |
61+
${{ github.workspace }}/packages/**/*.tgz

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Prepare Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: Version to release
7+
required: true
8+
force:
9+
description: Force a release even when there are release-blockers (optional)
10+
required: false
11+
merge_target:
12+
description: Target branch to merge into. Uses the default branch, sentry-v1, as a fallback (optional)
13+
required: false
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
name: 'Release a new version'
18+
steps:
19+
- uses: actions/checkout@v3
20+
with:
21+
token: ${{ secrets.GH_RELEASE_PAT }}
22+
fetch-depth: 0
23+
- name: Prepare release
24+
uses: getsentry/action-prepare-release@v1
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_PAT }}
27+
with:
28+
version: ${{ github.event.inputs.version }}
29+
force: ${{ github.event.inputs.force }}
30+
merge_target: ${{ github.event.inputs.merge_target }}

LICENSE

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
MIT License
1+
Copyright (c) 2023 Sentry (https://sentry.io) and individual contributors. All rights reserved.
22

3-
Copyright (c) 2018 Contributors (https://github.com/rrweb-io/rrweb/graphs/contributors) and SmartX Inc.
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
5+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
6+
persons to whom the Software is furnished to do so, subject to the following conditions:
47

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
8+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
9+
Software.
1110

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
13+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 20 additions & 152 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,28 @@
11
<p align="center">
2-
<img width="100px" height="100px" src="https://www.rrweb.io/favicon.png">
3-
</p>
4-
<p align="center">
5-
<a href="https://www.rrweb.io/" style="font-weight: bold">Try rrweb</a>
2+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
3+
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
4+
</a>
65
</p>
76

8-
# rrweb
9-
10-
**[The rrweb documentary (in Chinese, with English subtitles)](https://www.bilibili.com/video/BV1wL4y1B7wN?share_source=copy_web)**
11-
12-
[![Join the chat at slack](https://img.shields.io/badge/[email protected]?logo=slack)](https://join.slack.com/t/rrweb/shared_invite/zt-siwoc6hx-uWay3s2wyG8t5GpZVb8rWg)
13-
[![Twitter Follow](https://img.shields.io/badge/twitter-@rrweb__io-teal.svg?logo=twitter)](https://twitter.com/rrweb_io)
14-
![total gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/rrweb@latest/dist/rrweb.min.js?compression=gzip&label=total%20gzip%20size)
15-
![recorder gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/rrweb@latest/dist/record/rrweb-record.min.js?compression=gzip&label=recorder%20gzip%20size)
16-
[![](https://data.jsdelivr.com/v1/package/npm/rrweb/badge)](https://www.jsdelivr.com/package/npm/rrweb)
17-
18-
[中文文档](./README.zh_CN.md)
19-
20-
> I have joined Github Sponsors and highly appreciate your sponsorship.
21-
22-
rrweb refers to 'record and replay the web', which is a tool for recording and replaying users' interactions on the web.
23-
24-
## Guide
25-
26-
[**📚 Read the rrweb guide here. 📚**](./guide.md)
27-
28-
[**🍳 Recipes 🍳**](./docs/recipes/index.md)
29-
30-
## Project Structure
31-
32-
rrweb is mainly composed of 3 parts:
33-
34-
- **[rrweb-snapshot](https://github.com/rrweb-io/rrweb/tree/master/packages/rrweb-snapshot/)**, including both snapshot and rebuilding features. The snapshot is used to convert the DOM and its state into a serializable data structure with a unique identifier; the rebuilding feature is to rebuild the snapshot into corresponding DOM.
35-
- **[rrweb](https://github.com/rrweb-io/rrweb)**, including two functions, record and replay. The record function is used to record all the mutations in the DOM; the replay is to replay the recorded mutations one by one according to the corresponding timestamp.
36-
- **[rrweb-player](https://github.com/rrweb-io/rrweb/tree/master/packages/rrweb-player/)**, is a player UI for rrweb, providing GUI-based functions like pause, fast-forward, drag and drop to play at any time.
37-
38-
## Roadmap
39-
40-
- rrdom: an ad-hoc DOM for rrweb session data [#419](https://github.com/rrweb-io/rrweb/issues/419)
41-
- storage engine: do deduplication on a large number of rrweb sessions
42-
- more end-to-end tests
43-
- compact mutation data in common patterns
44-
- provide plugins via the new plugin API, including:
45-
- XHR plugin
46-
- fetch plugin
47-
- GraphQL plugin
48-
- ...
7+
# Sentry rrweb Fork
498

50-
## Internal Design
9+
This repo is a fork of [rrweb](https://github.com/rrweb-io/rrweb). The purpose is to apply patches and bugfixes to rrweb and release Sentry-internal packages with our patches included. All credits and attribution for rrweb go to the original creators of the library and all its contributors.
5110

52-
- [serialization](./docs/serialization.md)
53-
- [incremental snapshot](./docs/observer.md)
54-
- [replay](./docs/replay.md)
55-
- [sandbox](./docs/sandbox.md)
11+
From this monorepo, Sentry maintains and publishes the following NPM packages:
5612

57-
## Contribute Guide
13+
- `@sentry-internal/rrweb` (corresponds to the [original `rrweb` package](https://www.npmjs.com/package/rrweb))
14+
- `@sentry-internal/rrdom` (corresponds to the [original `rrdom` package](https://www.npmjs.com/package/rrdom))
15+
- `@sentry-internal/rrweb-player` (corresponds to the [original `rrweb-player` package](https://www.npmjs.com/package/rrweb-player))
16+
- `@sentry-internal/rrweb-snapshot` (corresponds to the [original `rrweb-snapshot` package](https://www.npmjs.com/package/rrweb-snapshot))
5817

59-
Since we want the record and replay sides to share a strongly typed data structure, rrweb is developed with typescript which provides stronger type support.
60-
61-
[Typescript handbook](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)
62-
63-
1. Fork this repository.
64-
2. Run `yarn install` in the root to install required dependencies for all sub-packages (note: `npm install` is _not_ recommended).
65-
3. Run `yarn dev` in the root to get auto-building for all the sub-packages whenever you modify anything.
66-
4. Navigate to one of the sub-packages (in the `packages` folder) where you'd like to make a change.
67-
5. Patch the code and run `yarn test` to run the tests, make sure they pass before you commit anything.
68-
6. Push the code and create a pull request.
69-
70-
Protip: You can run `yarn test` in the root folder to run all the tests.
71-
72-
In addition to adding integration tests and unit tests, rrweb also provides a REPL testing tool.
73-
74-
[Using the REPL tool](./guide.md#REPL-tool)
75-
76-
## Core Team Members
77-
78-
<table>
79-
<tr>
80-
<td align="center">
81-
<a href="https://github.com/Yuyz0112">
82-
<img
83-
src="https://avatars.githubusercontent.com/u/13651389?s=100"
84-
width="100px;"
85-
alt=""
86-
/>
87-
<br /><sub><b>Yuyz0112</b></sub>
88-
</a>
89-
</td>
90-
<td align="center">
91-
<a href="https://github.com/Mark-Fenng">
92-
<img
93-
src="https://avatars.githubusercontent.com/u/27533910?s=100"
94-
width="100px;"
95-
alt=""
96-
/>
97-
<br /><sub><b>Mark-Fenng</b></sub>
98-
</a>
99-
</td>
100-
<td align="center">
101-
<a href="https://github.com/eoghanmurray">
102-
<img
103-
src="https://avatars.githubusercontent.com/u/156780?s=100"
104-
width="100px;"
105-
alt=""
106-
/>
107-
<br /><sub><b>eoghanmurray</b></sub>
108-
</a>
109-
</td>
110-
<td align="center">
111-
<a href="https://github.com/Juice10">
112-
<img
113-
src="https://avatars.githubusercontent.com/u/4106?s=100"
114-
width="100px;"
115-
alt=""
116-
/>
117-
<br /><sub><b>Juice10</b></sub>
118-
</a>
119-
</td>
120-
</tr>
121-
</table>
122-
123-
## Who's using rrweb
18+
# rrweb
12419

125-
<table>
126-
<tr>
127-
<td align="center">
128-
<a href="http://www.smartx.com/" target="_blank">
129-
<img width="195px" src="https://www.rrweb.io/logos/smartx.png">
130-
</a>
131-
</td>
132-
<td align="center">
133-
<a href="https://posthog.com?utm_source=rrweb&utm_medium=sponsorship&utm_campaign=open-source-sponsorship" target="_blank">
134-
<img width="195px" src="https://www.rrweb.io/logos/posthog.png">
135-
</a>
136-
</td>
137-
<td align="center">
138-
<a href="https://statcounter.com/session-replay/" target="_blank">
139-
<img width="195px" src="https://statcounter.com/images/logo-statcounter-arc-blue.svg">
140-
</a>
141-
</td>
142-
<td align="center">
143-
<a href="https://cux.io" target="_blank">
144-
<img style="padding: 8px" alt="The first ever UX automation tool" width="195px" src="https://static.cux.io/logo.svg">
145-
</a>
146-
</td>
147-
</tr>
148-
<tr>
149-
<td align="center">
150-
<a href="https://recordonce.com/" target="_blank">
151-
<img width="195px" src="https://uploads-ssl.webflow.com/5f3d133183156245630d4446/5f3d1940abe8db8612c23521_Record-Once-logo-554x80px.svg">
152-
</a>
153-
</td>
154-
<td align="center">
155-
<a href="https://remsupp.com" target="_blank">
156-
<img style="padding: 8px" alt="Remote Access & Co-Browsing" width="195px" src="https://remsupp.com/images/logo.png">
157-
</a>
158-
</td>
159-
</tr>
160-
</table>
20+
<p align="center">
21+
<img width="100px" height="100px" src="https://www.rrweb.io/favicon.png">
22+
</p>
23+
<p align="center">
24+
<a href="https://github.com/rrweb-io/rrweb" style="font-weight: bold">Check out the original rrweb Repo</a>
25+
</p>
26+
<p align="center">
27+
<a href="https://rrweb.io" style="font-weight: bold">rrweb.io</a>
28+
</p>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"test:watch": "yarn lerna run test:watch --parallel",
3131
"dev": "yarn lerna run dev --parallel",
3232
"repl": "cd packages/rrweb && npm run repl",
33-
"postinstall": "node node_modules/puppeteer/install.js"
33+
"postinstall": "node node_modules/puppeteer/install.js",
34+
"build:tarball": "yarn lerna run build:tarball"
3435
},
3536
"volta": {
3637
"node": "12.22.12",

packages/rrdom/LICENSE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright (c) 2023 Sentry (https://sentry.io) and individual contributors. All rights reserved.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
5+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
6+
persons to whom the Software is furnished to do so, subject to the following conditions:
7+
8+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
9+
Software.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
13+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

packages/rrdom/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
2-
"name": "rrdom",
2+
"name": "@sentry-internal/rrdom",
33
"version": "0.1.2",
44
"scripts": {
55
"dev": "rollup -c -w",
66
"bundle": "rollup --config",
77
"bundle:es-only": "cross-env ES_ONLY=true rollup --config",
88
"test": "jest",
9-
"prepublish": "npm run bundle"
9+
"prepublish": "npm run bundle",
10+
"build:tarball": "npm pack"
1011
},
1112
"keywords": [
1213
"rrweb",
@@ -33,7 +34,7 @@
3334
"rollup": "^2.56.3",
3435
"rollup-plugin-terser": "^7.0.2",
3536
"rollup-plugin-typescript2": "^0.30.0",
36-
"rrweb-snapshot": "^1.1.14",
37+
"@sentry-internal/rrweb-snapshot": "^1.1.14",
3738
"ts-jest": "^27.0.5",
3839
"tslib": "^2.3.1",
3940
"typescript": "^3.9.5"

packages/rrdom/rollup.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ for (let config of baseConfigs) {
5555
name: config.name,
5656
format: 'iife',
5757
file: pkg.unpkg.replace(pkg.name, config.path),
58+
extend: true,
5859
},
5960
],
6061
},
@@ -67,6 +68,7 @@ for (let config of baseConfigs) {
6768
format: 'iife',
6869
file: toMinPath(pkg.unpkg).replace(pkg.name, config.path),
6970
sourcemap: true,
71+
extend: true,
7072
},
7173
],
7274
},

packages/rrdom/src/document-nodejs.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { INode, NodeType, serializedNodeWithId } from 'rrweb-snapshot';
1+
import {
2+
INode,
3+
NodeType,
4+
serializedNodeWithId,
5+
} from '@sentry-internal/rrweb-snapshot';
26
import { NWSAPI } from 'nwsapi';
37
import { parseCSSText, camelize, toCSSText } from './style';
48
const nwsapi = require('nwsapi');

0 commit comments

Comments
 (0)