nushell-plugins/scripts/build_all.nu

108 lines
2.9 KiB
Plaintext
Raw Normal View History

feat: major repository modernization and tracking cleanup ## Summary Comprehensive repository cleanup focusing on plugin dependency management, documentation improvements, and git tracking optimization. ## Key Changes ### 🔧 Core Infrastructure - Synchronized all nu-* dependencies across plugins for version consistency - Enhanced upstream tracking and automation systems - Removed nushell directory from git tracking for cleaner repository management ### 📚 Documentation - Significantly expanded README.md with comprehensive development guides - Added detailed workflow documentation and command references - Improved plugin collection overview and usage examples ### 🧹 Repository Cleanup - Removed legacy bash scripts (build-all.sh, collect-install.sh, make_plugin.sh) - Streamlined automation through unified justfile and nushell script approach - Updated .gitignore with nushell directory and archive patterns - Removed nushell directory from git tracking to prevent unwanted changes ### 🔌 Plugin Updates - **nu_plugin_image**: Major refactoring with modular architecture improvements - **nu_plugin_hashes**: Enhanced functionality and build system improvements - **nu_plugin_highlight**: Updated for new plugin API compatibility - **nu_plugin_clipboard**: Dependency synchronization - **nu_plugin_desktop_notifications**: Version alignment - **nu_plugin_port_extension & nu_plugin_qr_maker**: Consistency updates - **nu_plugin_kcl & nu_plugin_tera**: Submodule synchronization ### 🏗️ Git Tracking Optimization - Removed nushell directory from version control for cleaner repository management - Added comprehensive .gitignore patterns for build artifacts and archives ## Statistics - 2,082 files changed - 2,373 insertions, 339,936 deletions - Net reduction of 337,563 lines (primarily from removing nushell directory tracking) ## Benefits - Complete version consistency across all plugins - Cleaner repository with optimized git tracking - Improved developer experience with streamlined workflows - Enhanced documentation and automation - Reduced repository size and complexity 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 15:18:58 +01:00
#!/usr/bin/env nu
# Build All Plugins Script
# Builds all nu_plugin_* directories in release mode
# Version check - mandatory for all plugin operations
def version_check [] {
try {
nu scripts/check_version.nu --quiet | ignore
} catch {
print "❌ Nushell version mismatch detected!"
print "🔧 Run: nu scripts/check_version.nu --fix"
exit 1
}
}
# Get all plugin directories
def get_plugin_directories [] {
glob "nu_plugin_*" | where ($it | path type) == "dir"
}
# Build a single plugin
def build_plugin [plugin_dir: string] {
print $"🔨 Building ($plugin_dir)..."
try {
cd $plugin_dir
let result = cargo build --release
cd ..
print $"✅ Created ($plugin_dir)"
{plugin: $plugin_dir, status: "success", error: null}
} catch {|err|
cd ..
print $"❌ Error in ($plugin_dir): ($err.msg)"
{plugin: $plugin_dir, status: "error", error: $err.msg}
}
}
# Main function
def main [
--verbose (-v) # Verbose output
--parallel (-p) # Build plugins in parallel (experimental)
] {
# Mandatory version check before any plugin operations
version_check
# Ensure we're in the repository root directory
if not ("nu_plugin_clipboard" | path exists) {
error make {msg: "Please run this script from the nushell-plugins repository root directory"}
}
print "🚀 Building all nushell plugins..."
let plugin_dirs = get_plugin_directories
if ($plugin_dirs | length) == 0 {
print "❓ No nu_plugin_* directories found"
return
}
print $"📦 Found ($plugin_dirs | length) plugins to build:"
for dir in $plugin_dirs {
print $" - ($dir)"
}
print ""
let start_time = date now
mut results = []
if $parallel {
# Experimental parallel building (may have issues with cargo lock)
print "⚡ Building in parallel mode (experimental)..."
$results = ($plugin_dirs | par-each {|dir| build_plugin $dir})
} else {
# Sequential building (safer)
for dir in $plugin_dirs {
let result = build_plugin $dir
$results = ($results | append $result)
print "---"
}
}
let end_time = date now
let duration = $end_time - $start_time
# Summary
print "\n📊 Build Summary:"
let successful = $results | where status == "success"
let failed = $results | where status == "error"
print $"✅ Successful: ($successful | length)"
print $"❌ Failed: ($failed | length)"
print $"⏱️ Total time: ($duration)"
if ($failed | length) > 0 {
print "\n❌ Failed builds:"
for failure in $failed {
print $" - ($failure.plugin): ($failure.error)"
}
exit 1
} else {
print "\n🎉 All plugins built successfully!"
}
}
if ($env.NUSHELL_EXECUTION_CONTEXT? | default "" | str contains "run") {
main
}