Skip to content

Development Infrastructure

OpenLayers maintains a comprehensive development infrastructure that encompasses build systems, development tools, testing frameworks, and documentation generation. This infrastructure supports the library's development workflow from source code to distribution packages, examples, and API documentation.

Infrastructure Overview

The development infrastructure consists of multiple interconnected systems that handle different aspects of the development lifecycle.

SVG
100%

Development Infrastructure Architecture

Sources: package.json12-34

Core Dependencies and Structure

OpenLayers has a minimal set of runtime dependencies and a comprehensive set of development dependencies.

Core Dependencies

The library has only a few direct dependencies for runtime functionality:

DependencyPurpose
rbushSpatial indexing
earcutPolygon triangulation
geotiffGeoTIFF parsing
pbfProtocol buffer parsing

Development Dependencies

The development dependencies include tools for building, testing, and documentation:

  • Build Tools: Webpack, Rollup, TypeScript
  • Testing Tools: Karma, Mocha, Puppeteer
  • Documentation Tools: JSDoc

Build Process Flow

The build process in OpenLayers follows a series of steps defined in npm scripts, transforming source code into distributable formats.

SVG
100%

Transpilation Process

The transpilation process is the first step in the build pipeline:

  1. Clean the build directory
  2. Create a new build directory structure
  3. Copy source code from src/ol to build/ol
  4. Process web workers
  5. Set the library version

Command: npm run transpile

Building the Index

The index build process creates the main entry point for the library:

  1. Remove any existing index.js file
  2. Run the transpilation
  3. Generate the index file

Command: npm run build-index

Full Build

The full build creates bundled versions of the library using Rollup:

  1. Clean the full build directory
  2. Run the index build
  3. Bundle the library with Rollup

Command: npm run build-full

Package Build

The package build prepares the distribution package:

  1. Create the full build
  2. Copy CSS files
  3. Generate TypeScript declaration files
  4. Prepare the package

Command: npm run build-package

Testing Framework

OpenLayers has a comprehensive testing suite that includes browser tests, Node.js tests, and rendering tests.

SVG
100%

Browser Testing

Browser tests run in a headless Chrome browser using Karma:

  1. Configure Karma with Webpack
  2. Set up headless Chrome with Puppeteer
  3. Run tests with source map support

Command: npm run test-browser

Node Testing

Node.js tests run with Mocha:

  1. Run tests recursively in the test/node directory
  2. Test Node.js-specific functionality

Command: npm run test-node

Rendering Tests

Rendering tests ensure consistent visual output:

  1. Build the full library
  2. Render test cases
  3. Compare with expected images

Command: npm run test-rendering

Development Workflow

The development workflow includes tools for serving examples, checking code quality, and generating documentation.

Serving Examples

For development, a Webpack dev server serves examples with live reloading:

Command: npm start or npm run serve-examples

Type Checking and Linting

Code quality is ensured with TypeScript and ESLint:

  • TypeScript: npm run typecheck, npm run typecheck-strict
  • ESLint: npm run lint

Documentation Generation

API documentation is generated with JSDoc:

Command: npm run apidoc

Build Outputs

The build process produces several artifacts:

  • build/ol: Transpiled source code
  • build/full: Bundled library
  • build/examples: Built examples
  • build/apidoc: API documentation

Version Management

OpenLayers tracks version information in the package.json file and updates it during the build process. This allows for precise version control and ensures that built artifacts correctly reflect the current version.

The current version is specified as 10.5.1-dev, indicating development progress toward the next release.

Conclusion

The OpenLayers build system provides a comprehensive and flexible workflow for development, testing, and distribution. It leverages modern JavaScript tools to ensure code quality, compatibility across different environments, and efficient building processes. This infrastructure enables the team to maintain the library effectively and deliver high-quality releases.