Skip to content

Commit

Permalink
doc: improve contributor experience (#1024)
Browse files Browse the repository at this point in the history
  • Loading branch information
samber authored Oct 16, 2022
1 parent 7edfefe commit 1ec4413
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
20 changes: 12 additions & 8 deletions packages/rrweb/scripts/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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.');
Expand Down Expand Up @@ -92,7 +96,7 @@ void (async () => {
]);

if (shouldRecordAnother) {
start();
start(url);
} else {
process.exit();
}
Expand Down Expand Up @@ -207,9 +211,9 @@ void (async () => {
<script>
/*<!--*/
const events = ${JSON.stringify(events).replace(
/<\/script>/g,
'<\\/script>',
)};
/<\/script>/g,
'<\\/script>',
)};
/*-->*/
const replayer = new rrweb.Replayer(events, {
UNSAFE_replayCanvas: true
Expand Down

0 comments on commit 1ec4413

Please sign in to comment.