How jamiemason/syncpack works
Main Components
a) Core Engine Components:
• Configuration Manager (src/config/)
• Package Scanner (src/get-package-json-files/)
• Version Manager
• Version Groups (src/version-group/)
• Semver Groups (src/semver-group/)
• Specifier Handler (src/specifier/)
• I/O Operations (src/io/)
b) Command Modules:
• Fix Mismatches
• Format
• Lint
• List
• Update
• Prompt
┌─────────────────────────────────────────────────────────────────┐
• Command Interface │
• ┬─────────────┬────────────────┬───────────────────┤
• Fix Mismatches│ Format │ Lint │ Update │
• ┴─────────────┴────────────────┴───────────────────┘
• ▲
┌─────────────────────────┴─────────────────────────────────────┐
• Core Engine │
• ┬────────────────┬───────────────┬────────────┤
• Config Manager│ Package Scanner│Version Manager │ I/O │
• ┴────────────────┴───────────────┴────────────┘
• ▲
┌─────────────────────────┴─────────────────────────────────────┐
• File System Interface │
• ┬────────────────┬───────────────┬────────────┤
• package.json │ lerna.json │ pnpm-lock.yaml│ Others │
• ┴────────────────┴───────────────┴────────────┘
Important Relationships
• Bidirectional flow between Command Interface and Core Engine
• Core Engine's interaction with File System
• Version Manager's relationship with both Package Scanner and Config Manager
• I/O Operations' connection to File System Interface
Additional Elements
• Component types (Command, Core, File System)
• Version handling strategies (standard, pinned, banned, etc.)
• Supported package manager integrations (npm, yarn, pnpm)
Implementation Details
• The modular architecture (separate bin directories for each command)
• The strategy pattern used for version management
• The plugin-like system for different package managers
• Configuration flexibility through .syncpackrc.js