Aegir is an opinionated JavaScript/TypeScript project management tool that streamlines build, test, lint, and release workflows. It provides pre-configured tooling for modern JS/TS development with minimal setup, targeting developers who want to ship working code without configuring individual build tools.
npm install aegirAegir is primarily used as a CLI tool, but also provides testing utilities:
// Testing utilities (programmatic use)
import { expect, assert } from 'aegir/chai';
import EchoServer from 'aegir/echo-server';
import loadFixtures from 'aegir/fixtures';
import getPort from 'aegir/get-port';
import resolve from 'aegir/resolve';
import { isNode, isBrowser } from 'aegir/env';CommonJS:
const { expect, assert } = require('aegir/chai');
const EchoServer = require('aegir/echo-server');
const loadFixtures = require('aegir/fixtures');
const getPort = require('aegir/get-port');
const resolve = require('aegir/resolve');
const { isNode, isBrowser } = require('aegir/env');# Build project
aegir build
# Run tests in multiple environments
aegir test
aegir test --target node
aegir test --target browser
# Lint code
aegir lint
# Generate documentation
aegir docs
# Release package
aegir releaseimport { expect } from 'aegir/chai';
import EchoServer from 'aegir/echo-server';
import { isNode } from 'aegir/env';
// Testing with enhanced Chai
expect('hello').to.be.a('string');
// HTTP testing server
const server = new EchoServer();
await server.start();
// Server available at http://127.0.0.1:3000
await server.stop();
// Environment detection
if (isNode) {
// Node.js specific code
}Aegir is built around several key components:
.aegir.js files or package.json propertiesBuild system with esbuild integration, TypeScript compilation, and browser bundle generation. Includes bundle size analysis and optimization features.
// CLI command: aegir build [options]
// Options: --bundle, --bundlesize, --typesMulti-environment test runner supporting Node.js, browsers, WebWorkers, Electron, and React Native. Includes coverage reporting and watch mode.
// CLI command: aegir test [options]
// Options: --target, --watch, --cov, --grep, --timeoutIntegrated linting with ESLint, spell checking, dependency validation, package.json validation, and project maintenance.
// CLI commands:
// aegir lint [options]
// aegir spell-check
// aegir dependency-check
// aegir lint-package-json
// aegir clean [files..]TypeDoc-based documentation generation with GitHub Pages publishing support.
// CLI command: aegir docs [options]
// Options: --publish, --entryPoint, --directoryAutomated semantic releases with version bumping, changelog generation, and npm publishing.
// CLI commands:
// aegir release [options]
// aegir release-rc [options]Pre-configured testing utilities including enhanced Chai assertions, HTTP echo server, fixture loading, and environment detection.
// Import paths:
// aegir/chai - Enhanced Chai with plugins
// aegir/echo-server - HTTP testing server
// aegir/fixtures - Test fixture loader
// aegir/get-port - Port finder utility
// aegir/resolve - Path resolution utility
// aegir/env - Environment detectionCommands for managing monorepo projects including cross-package command execution and dependency alignment.
// CLI commands:
// aegir exec <command>
// aegir run <script>
// aegir align-versions
// aegir test-dependantAegir supports configuration via .aegir.js files or aegir property in package.json:
interface Options {
debug: boolean;
build: BuildOptions;
test: TestOptions;
lint: LintOptions;
docs: DocsOptions;
release: ReleaseOptions;
// ... other command options
}Aegir provides pre-configured configuration files for common tools:
// TypeScript base configuration
import 'aegir/src/config/tsconfig.aegir.json';
// ESLint configuration (also documented in Code Quality section)
import aegirEslintConfig from 'aegir/eslint.config.js';Aegir enforces a specific project structure:
src/ directory with src/index.js or src/index.ts entry pointtest/ directory with .spec.js/.spec.ts filesdist/ directory for compiled code.aegir.js file or aegir property in package.json