Build Process & Deployment
Relevant source files
The following files were used as context for generating this wiki page:
The build process for the DXKB web application is centered around a JavaScript-heavy client-side architecture using the Dojo Toolkit. It utilizes a shell-based build script to orchestrate the compilation, optimization, and packaging of frontend assets, transforming source modules into a production-ready distribution. Deployment is managed via a branch-based strategy where different Git branches correspond to specific environments like production, beta, and internal preview.
Sources: buildClient.sh, CONTRIBUTING-old.md:31-40
Client Build Orchestration
The application uses buildClient.sh to automate the creation of optimized JavaScript bundles. This process involves the Dojo build system, which reads "profiles" to determine how to group modules, minify code, and handle dependencies.
Build Pipeline Flow
The build script performs several sequential steps to ensure a clean and optimized environment for the frontend assets.
This diagram illustrates the automated sequence from directory cleanup to the generation of optimized layers.
Sources: buildClient.sh:1-10
Build Script Configuration
The buildClient.sh script invokes the Dojo build tool with specific flags to control the output.
| Flag/Parameter | Description |
|---|---|
load=build | Loads the Dojo build system entry point. |
profile=p3.profile.js | Defines the specific layers and modules for the DXKB application. |
releaseDir | Specifies the target directory for compiled assets (public/js/release). |
action=release | Executes the full build and optimization cycle. |
Sources: buildClient.sh:10
Build Profiles and Optimization
The build process relies on Dojo Build Profiles to define how the application is structured for production. These profiles determine "layers"—bundles of multiple JavaScript files merged into a single file to reduce HTTP requests.
Layering and Minimization
Profiles like p3.profile.js and release.profile.js define the entry points for the application. The build system processes these to:
- Resolve Dependencies: Trace all
defineandrequirecalls to include necessary code. - Code Minimization: Strips whitespace and renames variables to reduce file size.
- Dead Code Removal: Filters out modules that are not explicitly required by the defined layers.
Sources: public/js/p3.profile.js, public/js/release.profile.js
Branching and Environment Deployment
The project follows a structured branching model where specific branches are mapped to deployment URLs. This allows for concurrent development, internal testing, and stable production releases.
The relationship between Git branches and target deployment environments.
Sources: CONTRIBUTING-old.md:31-45
Environment Mapping
| Branch | Environment | Deployment URL | Purpose |
|---|---|---|---|
master | Production | https://www.bv-brc.org | Stable production releases. |
develop | Beta | https://beta.bv-brc.org | Release-ready commits and bug fixes. |
preview | Alpha | https://alpha.bv-brc.org | Work-in-progress and internal feature reviews. |
Sources: CONTRIBUTING-old.md:31-40
Release Preparation
Preparing a release involves incrementing the application version and committing the final build artifacts. The version number in package.json serves as the primary identifier for the deployment.
Release Workflow
- Version Increment: Update the
versionfield inpackage.jsonusing semantic versioning. - Build Execution: Run the build scripts to generate updated assets in the
releasefolder. - Commit and Push: Stage all changes, including the updated
package.jsonand build artifacts, and push to thedevelopormasterbranch.
# Example release commands from documentation
edit ./package.json # increment "version"
git add --all
git commit -m 'release js'
git push
Sources: CONTRIBUTING-old.md:71-80, package.json:3
Deployment Infrastructure
The application is a Node.js-based web server (p3-web) that serves the compiled frontend assets. The package.json defines the entry point and necessary scripts for starting the service.
Server Execution
- Start Script:
node ./bin/p3-webinitializes the server. - Dependencies: The server relies on
expressfor routing and various clients likebvbrc_js_clientfor data interaction. - Post-Installation: A
postinstallscript (./post_install.sh) is automatically executed after dependency installation to perform environment-specific setup.
Sources: package.json:5-13
Conclusion
The build and deployment process for DXKB-web ensures that complex frontend dependencies are efficiently bundled and optimized through the Dojo Build System. By maintaining a strict mapping between Git branches and deployment environments (Alpha, Beta, Production), the project facilitates a stable release lifecycle while allowing for continuous integration of new features.