Browse Source

Merge pull request #5127 from jabooth/npmdoc

Improvements to the npm build instructions
Mr.doob 11 years ago
parent
commit
31d72b6659
1 changed files with 41 additions and 12 deletions
  1. 41 12
      utils/npm/README.md

+ 41 - 12
utils/npm/README.md

@@ -1,13 +1,42 @@
-To build the npm modules:
-
-1. install nodejs.
-2. install npm (if it was not installed with nodejs)
-3. install npm module dependencies (see utils/build/package.json)
-4. determine the version of THREE that you want to publish (usually it is specified in src/Three.js as the REVISION)
-5. increment the fix number above what was previously published if you are re-publishing an existing Three.js version.
-6. add "-dev" to the version number if this is a development branch.
-7. run the follow to build both the three and three-math node modules
- * node build.js 0.54.3-dev
-8. npm publish node_modules/three
-9. npm publish node_modules/three-math
+#### Dependencies
+1. To build the npm modules you will need both `node` and `npm` installed.
+2. We can then use `npm` to resolve our remaining Javascript build dependences. These
+dependencies are specified in `utils/build/package.json`.
+3. Note that there are other dependences - in particular, the
+[closure compiler](https://developers.google.com/closure/compiler/)
+is invoked, so you will need to ensure that `java` points to a suitably
+up-to-date version of the JVM.
 
+#### Specifying the version
+
+To invoke the build script (which will build both the both the `three` and
+`three-math` node modules) we need to run a command like
+```
+> node build.js 0.54.3-dev
+ ```
+in this directory. Note how we have to provide the build script with the version
+number. The version number is of the form `major.minor.fix[-dev]`.
+The major/minor version numbers of the build should be taken from the
+`REVISION` parameter in `src/Three.js` (e.g. if `REVISION: '68'` choose `0.68`).
+
+Note that the following rules should be followed to determine the full version
+identifier:
+- Increment the fix number by `1` if you are re-publishing an existing Three.js
+version. If this is a new release the fix number should be `0`.
+- Add `-dev` to the version number if this is a development branch.
+
+As an example, to build r68, checkout the `r68` tag, follow the above, and then
+run
+```
+> node build.js 0.68.0
+ ```
+
+#### Publishing
+
+The built modules will be left in `node_modules` in this directory. To upload
+both `three` and `three-math` to `npm`, run
+```
+> npm publish node_modules/three
+> npm publish node_modules/three-math
+```
+in this directory.