Skip to content

Latest commit

 

History

History
208 lines (159 loc) · 5.1 KB

File metadata and controls

208 lines (159 loc) · 5.1 KB

npm & Homebrew Installation - Implementation Summary

✅ What Was Implemented

1. npm Package Setup

Created Files:

  • package.json - npm package manifest with:

    • Package name: lofetch
    • Version: 2.0.0
    • Binary: lofetch command
    • Supports both global install (npm install -g) and npx
    • Files included: lofetch, README.md, LICENSE, CHANGELOG.md
  • .npmignore - Excludes dev files from npm package:

    • Test files
    • Formula directory
    • CI/CD configs
    • IDE files
    • Legacy files

2. Homebrew Formula

Created Files:

  • Formula/lofetch.rb - Homebrew formula for macOS/Linux installation
    • References GitHub releases
    • Installs to system bin directory
    • Includes test command

3. Documentation

Created Files:

  • INSTALL.md - Comprehensive installation guide:

    • npm installation (global & npx)
    • Homebrew installation
    • Manual installation
    • Troubleshooting
  • PUBLISH.md - Publishing guide for maintainers:

    • Version update checklist
    • npm publishing steps
    • Homebrew formula updates
    • Testing procedures
  • INSTALLATION_SUMMARY.md - This file!

Updated Files:

  • README.md - Added npm and Homebrew quick start instructions

4. Testing

Created Files:

  • test_package.sh - Package structure tests (16 assertions):
    • Validates package.json
    • Checks bin references
    • Tests --version flag
    • Verifies Homebrew formula syntax
    • Ensures required files exist

Updated Files:

  • Makefile - Added targets:
    • make test-package - Run package tests
    • make test-all - Run all tests
    • make help - Show available targets

5. Existing Features Leveraged

The following were already implemented (no changes needed):

  • --version flag (line 728-729 in lofetch)
  • show_version() function (line 700-702)
  • LOFETCH_VERSION constant (line 12)

📊 Test Results

Main Tests:     110 passed, 0 failed ✅
Package Tests:   16 passed, 0 failed ✅
Total:          126 passed, 0 failed ✅

🚀 Next Steps to Publish

1. Test Local npm Install

# Test npm pack (dry run)
npm pack
tar -tzf lofetch-2.0.0.tgz

# Test local install
npm install -g ./lofetch-2.0.0.tgz
lofetch --version
npm uninstall -g lofetch

# Clean up
rm lofetch-2.0.0.tgz

2. Create GitHub Release

# Commit new files
git add package.json .npmignore Formula/ INSTALL.md PUBLISH.md test_package.sh Makefile README.md
git commit -m "feat: add npm and Homebrew installation support"

# Create and push tag
git tag -a v2.0.0 -m "Release v2.0.0"
git push origin main
git push origin v2.0.0

# Create release on GitHub
# Go to: https://github.com/jwuxan/lofetch/releases/new
# - Select tag: v2.0.0
# - Title: v2.0.0
# - Copy notes from CHANGELOG.md

3. Update Homebrew Formula SHA256

After creating the GitHub release:

# Download release tarball
curl -L https://github.com/jwuxan/lofetch/archive/refs/tags/v2.0.0.tar.gz -o release.tar.gz

# Calculate SHA256
shasum -a 256 release.tar.gz

# Update Formula/lofetch.rb line 6 with the SHA256
# Then commit:
git add Formula/lofetch.rb
git commit -m "chore: update Homebrew formula SHA256"
git push origin main

4. Publish to npm

# Login to npm (if not already)
npm login

# Publish
npm publish

# Verify
npm view lofetch

5. Test Installation

# Test npm
npm install -g lofetch
lofetch --version
npm uninstall -g lofetch

# Test npx
npx lofetch

# Test Homebrew
brew tap jwuxan/lofetch https://github.com/jwuxan/lofetch
brew install lofetch
lofetch --version
brew uninstall lofetch

📁 File Structure

lofetch/
├── lofetch                    # Main script
├── package.json               # ⭐ npm manifest
├── .npmignore                 # ⭐ npm exclusions
├── Formula/
│   └── lofetch.rb            # ⭐ Homebrew formula
├── test_lofetch.sh           # Main tests (110)
├── test_package.sh           # ⭐ Package tests (16)
├── Makefile                  # ⭐ Updated with test-package
├── README.md                 # ⭐ Updated with install methods
├── INSTALL.md                # ⭐ Installation guide
├── PUBLISH.md                # ⭐ Publishing guide
└── INSTALLATION_SUMMARY.md   # ⭐ This file

⭐ = New or updated for npm/Homebrew support

🔍 Installation Methods Available

  1. npm global: npm install -g lofetch
  2. npx: npx lofetch (no install needed)
  3. Homebrew: brew install lofetch
  4. Git clone: git clone ... && make install
  5. curl: curl ... | bash
  6. Manual: Download and copy to PATH

📝 Notes

  • All tests pass successfully
  • Version is consistent across all files (2.0.0)
  • npm package name "lofetch" needs to be available (check with npm view lofetch)
  • If unavailable, use scoped package: @your-username/lofetch
  • Homebrew formula references GitHub releases (requires tags)
  • The script is already executable and has --version support
  • No changes to core lofetch functionality were needed

🎉 Ready to Publish!

The implementation is complete and tested. Follow the "Next Steps to Publish" above to make lofetch available via npm and Homebrew.