Skip to content

feat: migrate Node.js to new feature folder architecture#56

Merged
ooloth merged 2 commits intomainfrom
feature/migrate-node-feature
Jul 27, 2025
Merged

feat: migrate Node.js to new feature folder architecture#56
ooloth merged 2 commits intomainfrom
feature/migrate-node-feature

Conversation

@ooloth
Copy link
Owner

@ooloth ooloth commented Jul 27, 2025

Summary

Migrates Node.js installation and management to the new feature folder architecture, following the established pattern from features/ssh/, features/git/, and features/homebrew/.

Key Changes

  • Self-contained feature structure - All Node.js related files in features/node/
  • Bash conversion - Migrated from bin/install/node.zsh to features/node/install.bash
  • Enhanced npm management - Comprehensive package management in features/node/update.bash
  • No external dependencies - Removed dependencies on bin/lib/ utility files
  • Comprehensive testing - 3 test files with 25+ test cases using bats framework
  • Complete documentation - README with usage, troubleshooting, and migration guide

Files Added

features/node/
├── install.bash               # Node.js installation via fnm
├── update.bash               # Node.js and npm package updates  
├── utils.bash                # Node.js utility functions
├── tests/
│   ├── test-node-utils.bats         # Unit tests for utilities
│   ├── test-node-installation.bats  # Installation workflow tests
│   └── test-node-update.bats        # Update and npm management tests
└── README.md                 # Feature documentation

Migration Path

Replaces:

  • bin/install/node.zshfeatures/node/install.bash
  • bin/update/npm.zshfeatures/node/update.bash

Maintains compatibility with:

  • Existing fnm configurations
  • Shell auto-switching (.node-version files)
  • Global npm package management

Improvements Over Legacy

  1. Better error handling - Comprehensive validation and clear error messages
  2. Modular design - Clear separation between installation and updates
  3. Self-contained - No external library dependencies
  4. Comprehensive testing - Full test coverage for all functionality
  5. Enhanced npm management - Smart detection of missing/outdated packages
  6. Cross-shell compatibility - Works in both bash and zsh environments

Test Plan

  • Syntax validation - All bash scripts pass syntax checks
  • Unit tests - 25+ test cases covering all utility functions
  • Integration tests - Installation and update workflow tests
  • Error handling - Tests for various failure scenarios
  • Mocking - Isolated tests using fake commands
  • Documentation - README covers usage, troubleshooting, and migration

Running Tests

# Run all Node.js tests
bats features/node/tests/

# Run specific test categories
bats features/node/tests/test-node-utils.bats        # Utility functions
bats features/node/tests/test-node-installation.bats # Installation workflow  
bats features/node/tests/test-node-update.bats       # Update workflow

Backwards Compatibility

This change maintains full backwards compatibility:

  • Legacy scripts remain functional during transition
  • Same fnm-based Node.js installation approach
  • Identical npm package list and management
  • No changes to shell integration or aliases

The new feature can be adopted gradually without disrupting existing workflows.

ooloth added 2 commits July 27, 2025 02:27
- Create self-contained features/node/ directory structure
- Convert existing node.zsh installation logic to bash
- Add comprehensive npm package management in update.bash
- Include extensive test suite with bats framework
- Provide complete documentation and troubleshooting guide

This migration follows the established pattern from features/ssh/,
features/git/, and features/homebrew/ with no external dependencies
on lib files and full test coverage.

The new structure replaces:
- bin/install/node.zsh → features/node/install.bash
- bin/update/npm.zsh → features/node/update.bash

Key improvements:
- Self-contained bash implementation
- Robust error handling and validation
- Comprehensive test coverage (3 test files, 25+ test cases)
- Better npm package management with missing/outdated detection
- Clear documentation with troubleshooting guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant