doc: improve contributor experience (#1024)

This commit is contained in:
Samuel Berthe
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 3c0f773456
commit d2a9b5d962
2 changed files with 24 additions and 8 deletions

View File

@@ -23,6 +23,18 @@ We actively welcome your pull requests.
We use GitHub issues to track public bugs. Please ensure your description is We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue. clear and has sufficient instructions to be able to reproduce the issue.
## Run locally
- Install dependencies: `yarn`
- Run recorder on a website: `yarn repl`
- Run a cobrowsing/mirroring session locally: `yarn live-stream`
- Test: `yarn test` or `yarn test:watch`
- Lint: `yarn lint`
## Coding style
See [documentation](docs/development/coding-style.md)
## License ## License
rrweb is [MIT licensed](https://github.com/rrweb-io/rrweb/blob/master/LICENSE). rrweb is [MIT licensed](https://github.com/rrweb-io/rrweb/blob/master/LICENSE).

View File

@@ -21,7 +21,7 @@ void (async () => {
const code = getCode(); const code = getCode();
let events = []; let events = [];
await start(); await start('https://react-redux.realworld.io');
const fakeGoto = async (page, url) => { const fakeGoto = async (page, url) => {
const intercept = async (request) => { const intercept = async (request) => {
@@ -38,17 +38,21 @@ void (async () => {
page.off('request', intercept); page.off('request', intercept);
}; };
async function start() { async function start(defaultURL) {
events = []; events = [];
const { url } = await inquirer.prompt([ let { url } = await inquirer.prompt([
{ {
type: 'input', type: 'input',
name: 'url', name: 'url',
message: message:
'Enter the url you want to record, e.g https://react-redux.realworld.io: ', `Enter the url you want to record, e.g [${defaultURL}]: `,
}, },
]); ]);
if (url === '') {
url = defaultURL;
}
console.log(`Going to open ${url}...`); console.log(`Going to open ${url}...`);
await record(url); await record(url);
console.log('Ready to record. You can do any interaction on the page.'); console.log('Ready to record. You can do any interaction on the page.');
@@ -92,7 +96,7 @@ void (async () => {
]); ]);
if (shouldRecordAnother) { if (shouldRecordAnother) {
start(); start(url);
} else { } else {
process.exit(); process.exit();
} }
@@ -207,9 +211,9 @@ void (async () => {
<script> <script>
/*<!--*/ /*<!--*/
const events = ${JSON.stringify(events).replace( const events = ${JSON.stringify(events).replace(
/<\/script>/g, /<\/script>/g,
'<\\/script>', '<\\/script>',
)}; )};
/*-->*/ /*-->*/
const replayer = new rrweb.Replayer(events, { const replayer = new rrweb.Replayer(events, {
UNSAFE_replayCanvas: true UNSAFE_replayCanvas: true