| 1 |
# Filament for Web |
| 2 |
|
| 3 |
Filament is a mobile-first library for physically based rendering. It has a lightweight C++ core |
| 4 |
made available to web developers via a WebAssembly module. The WASM file is bundled with a |
| 5 |
first-class JavaScript API. |
| 6 |
|
| 7 |
See the [web docs](https://github.com/google/filament/tree/main/web/docs) for more information. |
| 8 |
|
| 9 |
## Publishing to npm |
| 10 |
|
| 11 |
See [Versioning.md](https://github.com/google/filament/blob/main/filament/docs/Versioning.md) |
| 12 |
for a description of Filament's three-tier versioning scheme. |
| 13 |
|
| 14 |
By pushing Filament's WebAssembly build to the npm registry, we can simplify the workflow for web |
| 15 |
developers due to tools like [yarn]. This also has the benefit of making Filament available on CDN |
| 16 |
servers like [unpkg] and [jsdelivr]. |
| 17 |
|
| 18 |
To publish a new package to npm, do the following. |
| 19 |
|
| 20 |
1. Follow the instructions in the toplevel README for installing Emscripten. |
| 21 |
2. Make sure you have an npm account and that your npm account belongs to the Google team. |
| 22 |
3. Edit the version number in `package.json`. You cannot publish the same version more than once. |
| 23 |
4. From the root folder in your Filament repo, do: |
| 24 |
``` |
| 25 |
./build.sh -ap webgl release |
| 26 |
./build.sh -ap all release |
| 27 |
``` |
| 28 |
5. Make a commit and a tag whose label is the 3-tiered version number prefixed with a `v`: |
| 29 |
``` |
| 30 |
git commit && git tag -a v{XX}.{YY}.{ZZ} |
| 31 |
``` |
| 32 |
6. Push your change to GitHub, then make a GitHub Release associated with your new tag. |
| 33 |
7. Perform a "dry run" of the npm packaging process: |
| 34 |
|
| 35 |
``` |
| 36 |
cd out/cmake-webgl-release/web/filament-js |
| 37 |
npm publish --dry-run |
| 38 |
``` |
| 39 |
8. If the output of the dry run looks okay to you (double check the version number!), then finally |
| 40 |
do `npm publish`. |
| 41 |
|
| 42 |
[yarn]: https://yarnpkg.com |
| 43 |
[unpkg]: https://unpkg.com |
| 44 |
[jsdelivr]: https://www.jsdelivr.com/ |