CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-taze

A modern cli tool that keeps your deps fresh

Pending
Overview
Eval results
Files

configuration.mddocs/

Configuration

Comprehensive configuration system supporting file-based configuration, environment variables, and runtime options with intelligent defaults and full type safety.

Configuration Methods

File-based Configuration

Taze automatically discovers and loads configuration from several file formats:

// taze.config.js or taze.config.ts
export default {
  mode: "minor",
  recursive: true,
  include: ["react*"],
  exclude: ["legacy-*"]
};

// .tazerc.json
{
  "mode": "patch",
  "write": false,
  "interactive": true
}

// .tazerc (JSON format)
{
  "recursive": true,
  "sort": "diff-desc"
}

Programmatic Configuration

import { defineConfig, CheckPackages } from "taze";

const config = defineConfig({
  mode: "minor",
  include: ["@types/*"],
  depFields: {
    dependencies: true,
    devDependencies: true,
    peerDependencies: false
  }
});

await CheckPackages(config);

Configuration Options

Core Check Options

interface CheckOptions extends CommonOptions {
  /** Update mode determining version range changes */
  mode?: RangeMode;
  /** Write changes to package.json files */
  write?: boolean;
  /** Show all packages including up-to-date ones */
  all?: boolean;
  /** Sort results by specified criteria */
  sort?: SortOption;
  /** Enable interactive mode for selective updates */
  interactive?: boolean;
  /** Run package manager install after updating */
  install?: boolean;
  /** Run package manager update after updating */
  update?: boolean;
  /** Update global packages instead of local ones */
  global?: boolean;
  /** Number of concurrent requests to package registries */
  concurrency?: number;
  /** Group dependencies by source type in display */
  group?: boolean;
  /** Include locked dependencies and devDependencies */
  includeLocked?: boolean;
  /** Show time difference between current and updated versions */
  timediff?: boolean;
  /** Show package compatibility with current Node.js version */
  nodecompat?: boolean;
}

Common Options

interface CommonOptions {
  /** Current working directory */
  cwd?: string;
  /** Recursively search for package.json files */
  recursive?: boolean;
  /** Paths to ignore during recursive search */
  ignorePaths?: string | string[];
  /** Ignore package.json files in other workspaces */
  ignoreOtherWorkspaces?: boolean;
  /** Only check specified dependencies */
  include?: string | string[];
  /** Exclude specified dependencies from checks */
  exclude?: string | string[];
  /** Logging level */
  loglevel?: LogLevel;
  /** Exit with code 1 if outdated dependencies found */
  failOnOutdated?: boolean;
  /** Complete silent mode */
  silent?: boolean;
  /** Package.json fields to check for dependencies */
  depFields?: DepFieldOptions;
  /** Force fetching from server, bypass cache */
  force?: boolean;
  /** Include peerDependencies in update process */
  peer?: boolean;
  /** Override update mode for specific packages */
  packageMode?: { [name: string]: PackageMode };
  /** Custom addons for extending functionality */
  addons?: Addon[];
}

Configuration Types

Range Modes

type RangeMode = "default" | "major" | "minor" | "patch" | "latest" | "newest" | "next";
  • default: Respect existing version ranges (safe)
  • major: Allow major version updates (breaking changes)
  • minor: Allow minor version updates (new features)
  • patch: Allow patch version updates (bug fixes only)
  • latest: Update to latest stable version
  • newest: Update to newest version (including pre-release)
  • next: Update to next version tag

Package Modes

type PackageMode = Exclude<RangeMode, "default"> | "ignore";

Used in packageMode configuration to override the global mode for specific packages:

const config = defineConfig({
  mode: "minor",
  packageMode: {
    "react": "patch",      // Only patch updates for React
    "legacy-lib": "ignore", // Never update this package
    "typescript": "major"   // Allow major updates for TypeScript
  }
});

Dependency Field Options

type DepFieldOptions = Partial<Record<DepType, boolean>>;

type DepType =
  | "dependencies"
  | "devDependencies"
  | "peerDependencies"
  | "optionalDependencies"
  | "packageManager"
  | "pnpm.overrides"
  | "resolutions"
  | "overrides"
  | "pnpm-workspace";

Control which dependency fields are processed:

const config = defineConfig({
  depFields: {
    dependencies: true,        // Check production dependencies
    devDependencies: true,     // Check development dependencies
    peerDependencies: false,   // Skip peer dependencies
    optionalDependencies: true, // Check optional dependencies
    "pnpm.overrides": true     // Check pnpm overrides
  }
});

Sort Options

type SortOption = "diff-asc" | "diff-desc" | "name-asc" | "name-desc";
  • diff-asc: Sort by update significance (patch → minor → major)
  • diff-desc: Sort by update significance (major → minor → patch)
  • name-asc: Sort alphabetically by package name (A-Z)
  • name-desc: Sort alphabetically by package name (Z-A)

Log Levels

type LogLevel = "debug" | "info" | "warn" | "error" | "silent";

Default Configuration

const DEFAULT_CHECK_OPTIONS: CheckOptions = {
  cwd: "",
  loglevel: "info",
  failOnOutdated: false,
  silent: false,
  recursive: false,
  force: false,
  ignorePaths: "",
  ignoreOtherWorkspaces: true,
  include: "",
  exclude: "",
  depFields: {},
  mode: "default",
  write: false,
  global: false,
  interactive: false,
  install: false,
  update: false,
  all: false,
  sort: "diff-asc",
  group: true,
  includeLocked: false,
  nodecompat: true,
  concurrency: 10
};

Advanced Configuration

Custom Addons

interface Addon {
  /** Called after package resolution but before display */
  postprocess?: (pkg: PackageMeta, options: CheckOptions) => void | Promise<void>;
  /** Called before writing changes to package files */
  beforeWrite?: (pkg: PackageMeta, options: CheckOptions) => void | Promise<void>;
}

Example addon:

const customAddon: Addon = {
  postprocess: (pkg, options) => {
    // Custom processing after dependency resolution
    console.log(`Processed ${pkg.name} with ${pkg.resolved.length} changes`);
  },
  beforeWrite: (pkg, options) => {
    // Custom validation before writing
    if (pkg.resolved.some(dep => dep.diff === "major")) {
      console.warn(`Major updates detected in ${pkg.name}`);
    }
  }
};

const config = defineConfig({
  addons: [customAddon]
});

Workspace-specific Configuration

// In workspace root
const config = defineConfig({
  recursive: true,
  packageMode: {
    // Different update strategies per package
    "@my-org/core": "patch",
    "@my-org/utils": "minor",
    "@my-org/experimental": "major"
  },
  depFields: {
    dependencies: true,
    devDependencies: false  // Don't update devDeps in workspaces
  }
});

Environment-based Configuration

const config = defineConfig({
  mode: process.env.NODE_ENV === "production" ? "patch" : "minor",
  write: process.env.CI !== "true", // Don't write in CI
  interactive: process.stdout.isTTY, // Interactive only in terminal
  force: process.env.TAZE_FORCE_REFRESH === "true"
});

Configuration Resolution

Configuration is resolved in the following order (later sources override earlier ones):

  1. Default configuration values
  2. Configuration file (taze.config.js/ts, .tazerc.json, .tazerc)
  3. Command-line arguments
  4. Programmatic options passed to CheckPackages

Example Resolution

// .tazerc.json
{
  "mode": "minor",
  "write": false
}

// Command line: taze major --write
// Final configuration: { mode: "major", write: true }

Configuration Validation

Taze performs automatic validation of configuration options:

// Invalid configurations will throw helpful errors
const config = defineConfig({
  mode: "invalid-mode",    // Error: Invalid mode
  concurrency: -1,         // Error: Concurrency must be positive
  sort: "unknown-sort"     // Error: Invalid sort option
});

Best Practices

Project-specific Configuration

// taze.config.ts - Committed to repository
export default defineConfig({
  mode: "minor",
  recursive: true,
  include: ["@types/*", "eslint*", "prettier"],
  exclude: ["react"], // Pin React version
  depFields: {
    dependencies: true,
    devDependencies: true,
    peerDependencies: false
  }
});

CI/CD Configuration

// Separate config for automated environments
export default defineConfig({
  mode: "patch",           // Conservative updates in CI
  write: false,            // Never write in CI
  failOnOutdated: true,    // Fail build if outdated
  silent: true,            // Minimal output
  force: true              // Always fetch latest data
});

Development Workflow

// Development-friendly configuration
export default defineConfig({
  mode: "minor",
  interactive: true,       // Allow selective updates
  write: true,            // Save changes immediately
  install: true,          // Auto-install after updates
  group: true,            // Organized display
  timediff: true,         // Show age of updates
  nodecompat: true        // Show compatibility info
});

Install with Tessl CLI

npx tessl i tessl/npm-taze

docs

api-usage.md

cli-usage.md

configuration.md

index.md

tile.json