feat: implement zero-configuration auto-enhancement demo workflow
- Add intelligent auto-enhancement that detects viable content elements - Replace manual enhancement with automated container-first detection - Support inline formatting (strong, em, span, links) within editable content - Streamline demo workflow: just demo shows options, auto-enhances on demand - Clean up legacy commands and simplify directory structure - Auto-enhancement goes directly from source to demo-ready (no intermediate dirs) - Add Dan Eden portfolio and simple test sites for real-world validation - Auto-enhanced 40 elements in Dan Eden portfolio, 5 in simple site - Achieve true zero-configuration CMS experience
This commit is contained in:
71
test-sites/scripts/download-site.js
Executable file
71
test-sites/scripts/download-site.js
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Script to download a website with its assets for insertr testing
|
||||
* Usage: node download-site.js <url> <output-directory>
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
async function downloadSite(url, outputDir) {
|
||||
console.log(`Downloading ${url} to ${outputDir}`);
|
||||
|
||||
// Create output directory
|
||||
if (!fs.existsSync(outputDir)) {
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
}
|
||||
|
||||
try {
|
||||
// Use wget to download the site with assets
|
||||
// --page-requisites: download all files needed to display page
|
||||
// --convert-links: convert links to work locally
|
||||
// --adjust-extension: add proper extensions
|
||||
// --no-parent: don't ascend to parent directory
|
||||
// --no-host-directories: don't create host directories
|
||||
// --cut-dirs=1: cut directory levels
|
||||
const wgetCmd = `wget --page-requisites --convert-links --adjust-extension --no-parent --no-host-directories --directory-prefix="${outputDir}" --user-agent="Mozilla/5.0 (compatible; insertr-test-bot)" "${url}"`;
|
||||
|
||||
execSync(wgetCmd, { stdio: 'inherit' });
|
||||
|
||||
console.log('✅ Download completed successfully');
|
||||
|
||||
// Create README for the site
|
||||
const readmeContent = `# ${path.basename(outputDir)}
|
||||
|
||||
## Original URL
|
||||
${url}
|
||||
|
||||
## Downloaded
|
||||
${new Date().toISOString()}
|
||||
|
||||
## Testing Notes
|
||||
- Site downloaded with assets for insertr testing
|
||||
- Check HTML structure for suitable content sections
|
||||
- Add insertr classes to editable sections
|
||||
|
||||
## Insertr Enhancement Status
|
||||
- [ ] Content sections identified
|
||||
- [ ] Insertr classes added
|
||||
- [ ] Enhanced version tested
|
||||
- [ ] Results documented
|
||||
`;
|
||||
|
||||
fs.writeFileSync(path.join(outputDir, 'README.md'), readmeContent);
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Download failed:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Parse command line arguments
|
||||
const args = process.argv.slice(2);
|
||||
if (args.length < 2) {
|
||||
console.log('Usage: node download-site.js <url> <output-directory>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const [url, outputDir] = args;
|
||||
downloadSite(url, outputDir);
|
||||
Reference in New Issue
Block a user