From b85a2b9475f0316d6cb7758e9ec6840bb9e0cf5f Mon Sep 17 00:00:00 2001
From: FatumaA <67555014+FatumaA@users.noreply.github.com>
Date: Thu, 11 Apr 2024 17:12:02 +0300
Subject: [PATCH] docs: add directions to run docs and benchmarks
---
CONTRIBUTING.md | 63 +++++++++++++++++++++++++++++++++++++------------
1 file changed, 48 insertions(+), 15 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7a910263bd1..7e0f07f25f4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,19 +1,25 @@
# Contributing to Undici
-* [Guides](#guides)
- * [Update `llhttp`](#update-llhttp)
- * [Lint](#lint)
- * [Test](#test)
- * [Coverage](#coverage)
- * [Update `WPTs`](#update-wpts)
- * [Building for externally shared node builtins](#external-builds)
-* [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin)
- * [Moderation Policy](#moderation-policy)
+- [Guides](#guides)
+ - [Update `llhttp`](#update-llhttp)
+ - [Lint](#lint)
+ - [Test](#test)
+ - [Coverage](#coverage)
+ - [Update `WPTs`](#update-wpts)
+ - [Building for externally shared node builtins](#external-builds)
+ - [Benchmarks](#benchmarks)
+ - [Documentation](#documentation)
+- [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin)
+ - [Moderation Policy](#moderation-policy)
+
## Guides
+This is a collection of guides on how to run and update `undici`, and how to run different parts of the project.
+
+
### Update `llhttp`
The HTTP parser used by `undici` is a WebAssembly build of [`llhttp`](https://github.com/nodejs/llhttp).
@@ -35,6 +41,7 @@ git clone git@github.com:nodejs/llhttp.git
cd llhttp
```
+
#### Checkout a `llhttp` release
```bash
@@ -84,6 +91,7 @@ npm run build:wasm
Create a commit which includes all of the updated files in lib/llhttp.
+
### Update `WPTs`
`undici` runs a subset of the [`web-platform-tests`](https://github.com/web-platform-tests/wpt).
@@ -108,6 +116,7 @@ git sparse-checkout add /mimesniff
git sparse-checkout add /storage
git sparse-checkout add /service-workers
```
+
#### Sparse-clone the [wpt](https://github.com/web-platform-tests/wpt) repo
@@ -153,6 +162,7 @@ npm run lint
```
+
### Test
```bash
@@ -160,13 +170,17 @@ npm run test
```
+
### Coverage
```bash
npm run coverage
```
+
+
+
### Building for externally shared node builtins
If you are packaging `undici` for a distro, this might help if you would like to use
@@ -176,15 +190,34 @@ To enable this, pass `EXTERNAL_PATH=/path/to/global/node_modules/undici` to `bui
You shall also pass this path to `--shared-builtin-undici/undici-path` in Node.js's `configure.py`.
+
+### Benchmarks
+
+```bash
+cd benchmarks && npm i && npm run bench
+```
+
+The benchmarks will be available at `http://localhost:3042`.
+
+
+
+### Documentation
+
+```bash
+cd docs && npm i && npm run serve
+```
+
+The documentation will be available at `http://localhost:3000`.
+
## Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
-* (a) The contribution was created in whole or in part by me and I
+- (a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
-* (b) The contribution is based upon previous work that, to the best
+- (b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
@@ -192,20 +225,20 @@ By making a contribution to this project, I certify that:
permitted to submit under a different license), as indicated
in the file; or
-* (c) The contribution was provided directly to me by some other
+- (c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
-* (d) I understand and agree that this project and the contribution
+- (d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
+
### Moderation Policy
The [Node.js Moderation Policy] applies to this project.
-[Node.js Moderation Policy]:
-https://github.com/nodejs/admin/blob/main/Moderation-Policy.md
+[Node.js Moderation Policy]: https://github.com/nodejs/admin/blob/main/Moderation-Policy.md