Files
insertr/scripts/build.js
Joakim 161c320304 feat: complete full-stack development integration
🎯 Major Achievement: Insertr is now a complete, production-ready CMS

## 🚀 Full-Stack Integration Complete
-  HTTP API Server: Complete REST API with SQLite database
-  Smart Client Integration: Environment-aware API client
-  Unified Development Workflow: Single command full-stack development
-  Professional Tooling: Enhanced build, status, and health checking

## 🔧 Development Experience
- Primary: `just dev` - Full-stack development (demo + API server)
- Alternative: `just demo-only` - Demo site only (special cases)
- Build: `just build` - Complete stack (library + CLI + server)
- Status: `just status` - Comprehensive project overview

## 📦 What's Included
- **insertr-server/**: Complete HTTP API server with SQLite database
- **Smart API Client**: Environment detection, helpful error messages
- **Enhanced Build Pipeline**: Builds library + CLI + server in one command
- **Integrated Tooling**: Status checking, health monitoring, clean workflows

## 🧹 Cleanup
- Removed legacy insertr-old code (no longer needed)
- Simplified workflow (full-stack by default)
- Updated all documentation to reflect complete CMS

## 🎉 Result
Insertr is now a complete, professional CMS with:
- Real content persistence via database
- Professional editing interface
- Build-time content injection
- Zero-configuration deployment
- Production-ready architecture

Ready for real-world use! 🚀
2025-09-08 19:40:09 +02:00

71 lines
2.2 KiB
JavaScript
Executable File

#!/usr/bin/env node
/**
* Build script for Insertr library and CLI integration
* This ensures the CLI always has the latest library version embedded
*/
import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
console.log('🔨 Building Insertr library and CLI...\n');
// 1. Build the library
console.log('📦 Building JavaScript library...');
try {
execSync('npm run build', { cwd: 'lib', stdio: 'inherit' });
console.log('✅ Library built successfully\n');
} catch (error) {
console.error('❌ Library build failed:', error.message);
process.exit(1);
}
// 2. Copy built library to CLI assets
console.log('📁 Copying library to CLI assets...');
const srcDir = './lib/dist';
const destDir = './insertr-cli/pkg/content/assets';
// Ensure destination directory exists
fs.mkdirSync(destDir, { recursive: true });
// Copy files
const files = fs.readdirSync(srcDir);
files.forEach(file => {
const src = path.join(srcDir, file);
const dest = path.join(destDir, file);
fs.copyFileSync(src, dest);
console.log(` ✅ Copied ${file}`);
});
console.log('📁 Assets copied successfully\n');
// 3. Build the CLI
console.log('🔧 Building Go CLI...');
try {
execSync('go build -o insertr', { cwd: './insertr-cli', stdio: 'inherit' });
console.log('✅ CLI built successfully\n');
} catch (error) {
console.error('❌ CLI build failed:', error.message);
process.exit(1);
}
// 4. Build the API Server
console.log('🔌 Building API Server...');
try {
execSync('go build -o insertr-server ./cmd/server', { cwd: './insertr-server', stdio: 'inherit' });
console.log('✅ API Server built successfully\n');
} catch (error) {
console.error('❌ API Server build failed:', error.message);
process.exit(1);
}
console.log('🎉 Build complete!\n');
console.log('📋 What was built:');
console.log(' • JavaScript library (lib/dist/)');
console.log(' • Go CLI with embedded library (insertr-cli/insertr)');
console.log(' • Content API server (insertr-server/insertr-server)');
console.log('\n🚀 Ready to use:');
console.log(' just dev # Full-stack development');
console.log(' just server # API server only');
console.log(' cd insertr-cli && ./insertr --help # CLI tools');