or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-5/

Dependency Installer with Peer Resolution

Build a command-line tool that installs npm packages with automatic peer dependency resolution and conflict detection.

Overview

Create a utility that wraps package installation functionality to handle peer dependencies intelligently. The tool should install requested packages while automatically resolving peer dependencies, detecting conflicts, and providing clear feedback to the user.

Requirements

Command Interface

The tool should support the following operations:

  • Install one or more packages with peer dependency resolution
  • Option to automatically install peer dependencies
  • Option to use strict peer dependency validation
  • Display peer dependency conflicts and warnings

Installation Process

When installing packages:

  1. Resolve the dependency versions
  2. Detect peer dependency requirements
  3. Check for peer dependency conflicts
  4. Optionally auto-install missing peer dependencies
  5. Report the installation status and any peer-related issues

Output

The tool should display:

  • Which packages are being installed
  • Peer dependencies that need to be installed
  • Any peer dependency conflicts detected
  • Warning messages for missing or incompatible peers
  • Final installation status

Test Cases

  • Installing a package with satisfied peer dependencies completes successfully @test
  • Installing a package with missing peer dependencies shows appropriate warnings @test
  • Installing packages with conflicting peer dependency requirements reports the conflicts @test
  • Using the auto-install-peers option automatically installs missing peer dependencies @test

Implementation

@generates

API

/**
 * Installs packages with peer dependency resolution.
 *
 * @param {Array<string>} packages - Array of package names to install
 * @param {Object} options - Installation options
 * @param {boolean} options.autoInstallPeers - Automatically install peer dependencies
 * @param {boolean} options.strictPeerDependencies - Fail on peer dependency conflicts
 * @param {string} options.dir - Directory to install packages in
 * @returns {Promise<Object>} Installation result
 * @returns {Promise<Array>} result.installed - List of installed packages
 * @returns {Promise<Array>} result.peerWarnings - Warnings about peer dependencies
 * @returns {Promise<Array>} result.conflicts - List of peer dependency conflicts
 * @returns {Promise<boolean>} result.success - Whether installation succeeded
 */
async function installWithPeers(packages, options = {}) {
  // Implementation here
}

module.exports = { installWithPeers };

Dependencies { .dependencies }

pnpm { .dependency }

Provides package management functionality and metadata access for analyzing peer dependencies.

@satisfied-by