taze

repository·main·Indexed 26 days ago

https://github.com/antfu-collective/taze

A modern CLI tool for keeping dependencies fresh in repositories and monorepos. It supports safe version bumping (major, minor, patch), recursive scanning for monorepos, and advanced filtering via maturity periods and regex-based inclusion/exclusion. Features include an interactive selection mode, JSON output for CI/CD, and a configuration file (taze.config.js). It also includes built-in addons, such as addonVSCode for synchronizing engines.vscode with @types/vscode versions.

Tokens
8K
Snippets
11
Records
62
Agent score
88%

What's inside taze

  1. Run Taze to update dependencies

    main

    You can run taze without installation using npx. By default, it only bumps versions within the ranges specified in your package.json (e.g., respecting ^ or ~).

    To bypass the specified ranges and check for higher updates, use specific bumping modes:

    • taze major: Check for all changes including breaking changes.
    • taze minor: Bump to the latest minor changes within the same major version.
    • taze patch: Bump to the latest patch updates.
  2. Configure Taze via taze.config.js

    main

    You can create a taze.config.js file to persist your configuration. The available options include:

    • exclude: Array of package names to ignore.
    • force: Boolean to fetch latest package info without cache.
    • retry: Number of retries or a fine-grained control object.
    • write: Boolean to write changes to package.json.
    • install: Boolean to run npm install or yarn install after bumping.
    • ignorePaths: Array of paths to ignore when looking for package.json.
    • ignoreOtherWorkspaces: Boolean to ignore package.json in other workspaces.
    • packageMode: Object to override bumping modes per package (e.g., major, minor, patch, latest, ignore).
    • maturityPeriodExclude: Array of packages to exclude from the maturity filter.
    • depFields: Object to configure which dependency fields to check (e.g., { overrides: false }).
    import { defineConfig } from 'taze'
    
    export default defineConfig({
      exclude: [
        'webpack'
      ],
      force: true,
      retry: 4,
      write: true,
      install: true,
      ignorePaths: [
        '**/node_modules/**',
        '**/test/**',
      ],
      ignoreOtherWorkspaces: true,
      packageMode: {
        'typescript': 'major',
        'unocss': 'ignore',
        '/vue/': 'latest'
      },
      maturityPeriodExclude: [
        'react',
        '@myorg/*',
      ],
      depFields: {
        overrides: false
      }
    })
  3. Check global dependencies with Taze

    main

    Taze can be used to check for outdated global packages installed via npm or pnpm. It identifies global dependencies, checks for updates, and can optionally perform interactive updates or automatic installations.

    Key Behaviors

    • Detection: Automatically detects global packages from both npm and pnpm.
    • JSON Mode: If --json is used, Taze outputs the resolved update information in JSON format and skips interactive prompts and table rendering.
    • Interactive Mode: Using --interactive (or -i) allows you to manually select which global dependencies to update.
    • Installation: If --install is enabled, Taze will execute the necessary commands (via npm install -g or pnpm add -g) to update the outdated packages.
    • Exit Codes: If --fail-on-outdated is set, the process will exit with code 1 if any outdated global dependencies are found.
  4. Use the interactive CLI mode for dependency updates

    main

    Taze provides an interactive terminal interface to review and select dependency updates. In this mode, you can navigate through available updates, toggle specific dependencies for updating, and choose specific version ranges (like minor, patch, or specific tags) for each package.

    Main List View:

    • / k: Move selection up
    • / j: Move selection down
    • space: Toggle selection of the current dependency
    • a: Select or unselect all dependencies
    • / l: Enter version selection mode for the current dependency
    • enter / return: Confirm selected updates and exit
    • esc / q: Cancel and exit without applying changes

    Version Selection View: (Triggered by pressing or l on a dependency)

    • / k: Move selection up
    • / j: Move selection down
    • left / right / h / l: Confirm the selected version and return to the main list
    • escape: Cancel version selection and return to the main list

    Global Controls:

    • Ctrl + C: Exit the interactive session immediately
  5. Output update info as JSON

    main

    Use the --json flag to output resolved update information to stdout instead of a rendered table. This is ideal for CI/CD or scripting.

    Note: When --json is used, --interactive mode is ignored, and no progress bars or tables are printed. You can combine --json with --all to include up-to-date dependencies, or -w to write changes back to package.json.

  6. Filter packages with --include and --exclude

    main

    You can filter which packages taze checks for upgrades using --include or --exclude. These flags accept comma-separated strings or regular expressions.

    taze --include lodash,webpack
    taze --include /react/ --exclude react-dom
  7. Include locked or peer dependencies

    main

    By default, taze skips locked packages (those with fixed versions without ^ or ~) and does not bump peerDependencies.

    • Use --include-locked or -l to include locked packages.
    • Use --peer to include peerDependencies in the update process.
    taze --include-locked
    taze --peer
  8. Configure maturity period for updates

    main

    To avoid very new releases, use the --maturity-period flag to only suggest versions that have been out for a certain amount of time. The default is 7 days.

    • --maturity-period <days>: Set the number of days (e.g., 14).
    • --maturity-period-exclude <packages>: Exclude specific packages from this filter.
    • taze stable --maturity-period <days>: Use stable mode to ensure only stable releases are used while still honoring the maturity period.
    taze --maturity-period 14
    taze --maturity-period-exclude react,webpack
    taze stable --maturity-period 14
  9. Resolve dependencies with resolveDependencies()

    main

    Use resolveDependencies to resolve an array of raw dependencies into resolved dependency objects. This function supports concurrency control via the concurrency option in CheckOptions and provides a progress callback for tracking resolution status.

    Parameters:

    • deps: An array of RawDep objects to resolve.
    • options: CheckOptions containing configuration like concurrency, cwd, mode, etc.
    • filter: (Optional) A DependencyFilter function to skip certain dependencies.
    • progressCallback: (Optional) A callback function (name: string, counter: number, total: number) => void for progress reporting.
  10. Resolve a single package with resolvePackage()

    main

    Use resolvePackage to resolve all dependencies within a specific PackageMeta object. This method automatically sorts the resolved dependencies using diffSorter and attaches them to the resolved property of the package object.

    Parameters:

    • pkg: The PackageMeta object containing the dependencies to resolve.
    • options: CheckOptions for resolution configuration.
    • filter: (Optional) A DependencyFilter function.
    • progress: (Optional) A DependencyResolvedCallback for progress reporting.