Skip to content

Commit d1b07af

Browse files
authored
Merge pull request #948 from adi-ray/doc-update
Update reference generation instructions for p5.js 2.0 fork workflow
2 parents 8083af1 + 4d3f64a commit d1b07af

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/content/contributor-docs/en/contributing_to_the_p5js_reference.mdx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -380,21 +380,35 @@ Class constructors are defined with the `@class` tag and the `@constructor` tag.
380380

381381
The p5.js repository is set up so that you can generate and preview the reference without needing to build and run the p5.js website as well.
382382

383-
* The main command to generate the reference from the reference comments in the source code is to run the following command.
383+
To do so, make sure you have committed and pushed your changes to a branch of your fork of p5.js.
384+
385+
**Important:** Make sure you're working with compatible branches:
386+
387+
- Use the `2.0` branch of p5.js-website with the `dev-2.0` branch of p5.js
388+
- Use the `main` branch of p5.js-website with the `main` branch of p5.js
389+
390+
* First, ensure you have the necessary dependencies installed in the p5.js-website repository:
384391

385392
```
386-
npm run docs
393+
npm install
387394
```
388395

389-
This will generate the necessary preview files and the main `docs/reference/data.json` file, which is the same file (after minification) that will be used to render the reference page on the website.
390-
391-
* For continuous work on the reference, you can run the following command.
396+
* Then, in the p5.js-website repo, run the following command, using the URL of your fork of p5 before the `#`, and the name of your branch after the `#`:
392397

393398
```
394-
npm run docs:dev
399+
npm run custom:dev https://github.com/yourUsername/p5.js.git#yourBranch
395400
```
396401

397-
This will launch a live preview of the rendered reference that will update each time you make changes (you will need to refresh the page after making changes to see them appear). This is useful, especially for previewing example code running in the browser.
402+
This will build the reference from your branch and start a development preview of the website. A URL will be logged in the console that you can go to in your browser to test out your changes.
403+
404+
If everything is working correctly, your terminal output should look similar to this:
405+
![Terminal output showing successful npm run custom:dev execution](src/content/contributor-docs/images/custom-dev-terminal-output.png)
406+
407+
* When you're done, you can run this command to reset your changes:
408+
409+
```
410+
npm run custom:cleanup
411+
```
398412

399413
* The main template files are stored in the `docs/` folder and, in most cases, you should not make changes directly to files in this folder, except to add new asset files in the `docs/yuidoc-p5-theme/assets` folder.
400414

36.7 KB
Loading

0 commit comments

Comments
 (0)