Files
insertr/scripts/build.js
Joakim ca3df47451 feat: complete code cleanup and create feature parity plan
Major Architecture Improvements:
- Separate JavaScript library (lib/) with proper build system
- Go CLI with embedded library using go:embed
- Hot reload development with Air integration
- Library + CLI build pipeline with npm run build

Code Cleanup:
- Remove obsolete assets (insertr-cli/assets/editor/)
- Clean up package.json metadata and dependencies
- Update .gitignore for new architecture
- Remove unused 'marked' dependency

New Documentation:
- Add comprehensive TODO.md with feature gap analysis
- Document critical gaps between prototype and current library
- Create phased implementation plan for feature parity
- Update DEVELOPMENT.md with hot reload workflow
- Add LIBRARY.md documenting new architecture

Hot Reload System:
- Air watches both Go CLI and JavaScript library
- Library changes trigger: rebuild → copy → CLI rebuild → serve
- Seamless development experience across full stack

Next Steps:
- Current library is basic proof-of-concept (prompt() editing)
- Archived prototype has production-ready features
- Phase 1 focuses on professional forms and authentication
- Phase 2 adds validation and content persistence
2025-09-03 19:11:54 +02:00

58 lines
1.7 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
*/
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('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);
}
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('\n🚀 Ready to use:');
console.log(' cd insertr-cli && ./insertr --help');