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

@@ -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 () => {
<script>
/*<!--*/
const events = ${JSON.stringify(events).replace(
/<\/script>/g,
'<\\/script>',
)};
/<\/script>/g,
'<\\/script>',
)};
/*-->*/
const replayer = new rrweb.Replayer(events, {
UNSAFE_replayCanvas: true