add root scripts and update contribution guide (#750)

This commit is contained in:
Justin Halsall
2026-04-01 12:00:00 +08:00
committed by GitHub
parent ba2c8d740c
commit ef28761aca
4 changed files with 15 additions and 4 deletions

View File

@@ -59,10 +59,14 @@ Since we want the record and replay sides to share a strongly typed data structu
[Typescript handbook](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)
1. Fork the rrweb component repository you want to patch.
2. Run `yarn install` to install required dependencies.
3. Patch the code and pass all the tests.
4. Push the code and create a pull request.
1. Fork this repository.
2. Run `yarn install` in the root to install required dependencies for all sub-packages (note: `npm install` is _not_ recommended).
3. Run `yarn dev` in the root to get auto-building for all the sub-packages whenever you modify anything.
4. Navigate to one of the sub-packages (in the `packages` folder) where you'd like to make a change.
5. Patch the code and run `yarn test` to run the tests, make sure they pass before you commit anything.
6. Push the code and create a pull request.
Protip: You can run `yarn test` in the root folder to run all the tests.
In addition to adding integration tests and unit tests, rrweb also provides a REPL testing tool.

View File

@@ -24,6 +24,10 @@
},
"scripts": {
"lerna": "lerna",
"build:all": "yarn lerna run prepublish",
"test": "yarn lerna run test",
"test:watch": "yarn lerna run test:watch --parallel",
"dev": "yarn lerna run dev --parallel",
"repl": "cd packages/rrweb && npm run repl"
}
}

View File

@@ -6,8 +6,10 @@
"prepare": "npm run prepack",
"prepack": "npm run bundle && npm run typings",
"test": "jest",
"test:watch": "jest --watch",
"bundle": "rollup --config",
"bundle:es-only": "cross-env ES_ONLY=true rollup --config",
"dev": "yarn bundle:es-only --watch",
"typings": "tsc -d --declarationDir typings",
"prepublish": "npm run typings && npm run bundle"
},

View File

@@ -9,6 +9,7 @@
"test:headless": "npm run bundle:browser && PUPPETEER_HEADLESS=true jest",
"test:watch": "PUPPETEER_HEADLESS=true npm run test -- --watch",
"repl": "npm run bundle:browser && node scripts/repl.js",
"dev": "yarn bundle:browser --watch",
"bundle:browser": "cross-env BROWSER_ONLY=true rollup --config",
"bundle": "rollup --config",
"typings": "tsc -d --declarationDir typings",