Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve contributor experience #1024

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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