From ed7f2859def6e518be985a34730d47801142d604 Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Sat, 15 Oct 2022 19:15:46 +0200 Subject: [PATCH] doc: improve contributor experience --- CONTRIBUTING.md | 12 ++++++++++++ packages/rrweb/scripts/repl.js | 20 ++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7a0df1668..d5b2014ae5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,18 @@ We actively welcome your pull requests. 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. +## 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 rrweb is [MIT licensed](https://github.com/rrweb-io/rrweb/blob/master/LICENSE). diff --git a/packages/rrweb/scripts/repl.js b/packages/rrweb/scripts/repl.js index 5319bcf9f9..4edb07a3c3 100644 --- a/packages/rrweb/scripts/repl.js +++ b/packages/rrweb/scripts/repl.js @@ -21,7 +21,7 @@ void (async () => { const code = getCode(); let events = []; - await start(); + await start('https://react-redux.realworld.io'); const fakeGoto = async (page, url) => { const intercept = async (request) => { @@ -38,17 +38,21 @@ void (async () => { page.off('request', intercept); }; - async function start() { + async function start(defaultURL) { events = []; - const { url } = await inquirer.prompt([ + let { url } = await inquirer.prompt([ { type: 'input', name: 'url', 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}...`); await record(url); console.log('Ready to record. You can do any interaction on the page.'); @@ -92,7 +96,7 @@ void (async () => { ]); if (shouldRecordAnother) { - start(); + start(url); } else { process.exit(); } @@ -207,9 +211,9 @@ void (async () => {