- Analyze .jsb3 build file
- Combine source files into packages
- Combine packages into builds
- Optionally compress output using YUI compressor
- Copy resources (css, images, doc, etc).
- Deploy all to target directory
The .jsb3 file is simply a JSON file that specifies what source files to include and in what order. An example file might look like this:
All paths are relative to the .jsb3 file. The corresponding file structure from the example above would look like this:
Building is as simple as invoking JSBuilder.sh:
./JSBuilder.sh -d “./animals” -p “./animals/animals.jsb3″
First the water and air packages are built and copied to the pkgs directory. Those packages are then combined into the specified builds. The second build is compressed using YUI compressor. The tool analyzes each file included in the build and will report any script errors in its output- handy if something strange made it through JSLint and/or unit testing.
So far maintaining the .jsb3 file has been a manual process. I haven’t had time to explore some of the more advanced features of the tool yet. It is supposed to be able to auto-generate a build file by simply analyzing the script includes of your application page. If we are diligent in using Ext.require in our code it should also be able to perform dependency analysis and create a smaller custom build of Ext4 as well. Hopefully there will be a Part 2 to this post in the future.
For the currently available dojo-based App SDK we used dojo’s build system.
What other JS build tools have you used? Pros/cons?