It is assumed that you know a little about node.js and git. If not, here's some help to get started with git and here’s some help to get started with node.js.
Clone your forked repo
Go into the three.js directory.
cd ./three.js
Install the dependencies
npm install
As per the npm standard, ‘start’ is the place to begin the package.
npm start
This script will start a local server similar to threejs.org, but instead will be hosted on your local machine. Browse to http://localhost:8080/ to check it out. It also automatically creates the ‘build/three.module.js’ script anytime there is a change within your three.js directory.
The next most important script runs all the appropriate testing. The E-2-E testing is intended to be run by GitHub Actions.
Run this command from the root folder to install test dependencies.
npm install --prefix test
And run tests.
npm test
The linting is there to keep a consistent code style across all of the code and the testing is there to help catch bugs and check that the code behaves as expected. It is important that neither of these steps comes up with any errors due to your changes.
Many linting errors can be fixed automatically by running
npm lint-fix
If you’d like to make a minified version of the build files i.e. ‘build/three.min.js’ run:
npm run build
When you’ve decided to make changes, start with the following:
Update your local repo
git pull https://github.com/mrdoob/three.js.git git push
Make a new branch from the dev branch
git checkout dev git branch [mychangesbranch] git checkout [mychangesbranch]
Add your changes to your commit.
Push the changes to your forked repo.
Open a Pull Request (PR)
This project is currently contributed mostly via everyone's spare time. Please keep that in mind as it may take some time for the appropriate feedback to get to you. If you are unsure about adding a new feature, it might be better to ask first to see whether other people think it's a good idea.