[data-reveal]{opacity:1!important;transform:none!important}
Core

Configuration

Overview

The @antelopejs/interface-core/config module exports TypeScript types and the defineConfig helper for defining AntelopeJS project configurations. These types describe module sources, logging settings, environment overrides, and test configurations.

Import

import { defineConfig } from "@antelopejs/interface-core/config";
import type {
  AntelopeConfig,
  AntelopeModuleConfig,
  AntelopeLogging,
  ModuleSource,
  ModuleSourceLocal,
  ModuleSourceGit,
  ModuleSourcePackage,
  ModuleSourceLocalFolder,
} from "@antelopejs/interface-core/config";

defineConfig

The defineConfig function provides type-safe configuration definition. It accepts either a static configuration object or a function that receives a context and returns a configuration.

import { defineConfig } from "@antelopejs/interface-core/config";

// Static configuration
export default defineConfig({
  name: "my-project",
  modules: {
    database: "@antelopejs/database",
    auth: {
      version: "1.0.0",
      source: { type: "package", package: "@antelopejs/auth", version: "1.0.0" },
      config: { secret: "my-secret" },
    },
  },
});
// Dynamic configuration based on environment
export default defineConfig((ctx) => {
  return {
    name: "my-project",
    modules: {
      database: {
        source: { type: "package", package: "@antelopejs/database", version: "1.0.0" },
        config: {
          host: ctx.env === "production" ? "db.prod.internal" : "localhost",
        },
      },
    },
  };
});

AntelopeConfig

The root configuration object for an AntelopeJS project.

PropertyTypeDescription
namestringProject name
cacheFolderstringOptional custom cache directory
modulesRecord<string, string | AntelopeModuleConfig>Module definitions (shorthand or full)
loggingAntelopeLoggingOptional logging configuration
envOverridesRecord<string, string | string[]>Optional environment variable overrides
environmentsRecord<string, Partial<AntelopeConfig>>Optional per-environment config overrides
testAntelopeTestConfigOptional test configuration

Module sources

Each module source type specifies how to locate and load the module code.

Local source

Load a module from a local file path:

const config: AntelopeModuleConfig = {
  source: {
    type: "local",
    path: "./modules/my-module",
    main: "index.ts",
    watchDir: "src",
    installCommand: "pnpm install",
    reloadCommand: "pnpm build",
  },
};

The optional reloadCommand runs instead of installCommand on hot reload, letting you configure a faster command chain (for example, skipping pnpm install).

Git source

Load a module from a Git repository:

const config: AntelopeModuleConfig = {
  source: {
    type: "git",
    remote: "https://github.com/org/module.git",
    branch: "main",
    installCommand: "pnpm install",
  },
};

Package source

Load a module from an npm package:

const config: AntelopeModuleConfig = {
  source: {
    type: "package",
    package: "@antelopejs/database",
    version: "1.0.0",
  },
};

Local folder source

Load a module from a local folder with optional file watching:

const config: AntelopeModuleConfig = {
  source: {
    type: "local-folder",
    path: "./packages/shared",
    watchDir: ["src", "lib"],
    installCommand: ["pnpm install", "pnpm build"],
    reloadCommand: "pnpm build",
  },
};

Like the local source, local-folder also accepts an optional reloadCommand that runs in place of installCommand on hot reload.

AntelopeModuleConfig

Full module configuration within the project config.

PropertyTypeDescription
versionstringOptional version constraint
sourceModuleSource*Source definition (local, git, package, local-folder)
configunknownOptional runtime configuration
importOverridesImportOverride[] | Record<string, string>Optional import path redirections
disabledExportsstring[]Optional list of exports to disable

AntelopeLogging

Logging configuration within the project config.

PropertyTypeDescription
enabledbooleanEnable or disable logging
moduleTrackingobjectTrack module-level logging with includes/excludes
channelFilterRecord<string, number | string>Filter log output by channel and level
formatterRecord<string, string>Custom formatters per channel
dateFormatstringDate format string for log timestamps

AntelopeTestConfig

Test configuration for the project.

PropertyTypeDescription
folderstringOptional test folder path
setupFunctionOptional async setup function returning partial config
cleanupFunctionOptional async cleanup function

Next steps