зеркало из
https://github.com/rs-pro/activeadmin-quill_editor.git
synced 2026-09-03 18:25:51 +03:00
- Switch to ActiveAdmin 4 beta with Tailwind CSS - Replace Sprockets with Propshaft for Rails 8 - Migrate from jQuery to vanilla JavaScript - Implement proper module initialization without setTimeout hacks - Add esbuild for JavaScript bundling with clean import aliases - Configure Tailwind CSS build process with ActiveAdmin plugin - Update engine configuration for both Propshaft and Sprockets - Add comprehensive documentation for AA4 gem updates - Maintain backward compatibility with legacy AA versions 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
50 строки
1.3 KiB
JavaScript
50 строки
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
const esbuild = require('esbuild');
|
|
const path = require('path');
|
|
const { execSync } = require('node:child_process');
|
|
|
|
// For development, use the local gem path
|
|
const gemPath = path.resolve(__dirname, '../..');
|
|
|
|
// Configuration for esbuild with proper module resolution
|
|
const config = {
|
|
entryPoints: ['app/javascript/active_admin.js'],
|
|
bundle: true,
|
|
sourcemap: true,
|
|
format: 'iife',
|
|
outdir: 'app/assets/builds',
|
|
publicPath: '/assets',
|
|
loader: {
|
|
'.js': 'js',
|
|
},
|
|
// Define global Quill for the initialization script
|
|
define: {
|
|
'global': 'window'
|
|
},
|
|
// Use alias for clean imports
|
|
alias: {
|
|
'activeadmin_quill_editor': path.join(gemPath, 'vendor/assets/javascripts/activeadmin_quill_editor.js')
|
|
}
|
|
};
|
|
|
|
// Check if we're in watch mode
|
|
const watchMode = process.argv.includes('--watch');
|
|
|
|
if (watchMode) {
|
|
// Start the build with watch mode
|
|
esbuild.context(config).then(ctx => {
|
|
ctx.watch();
|
|
console.log('Watching for changes...');
|
|
}).catch(error => {
|
|
console.error('Build failed:', error);
|
|
process.exit(1);
|
|
});
|
|
} else {
|
|
// Single build
|
|
esbuild.build(config).then(() => {
|
|
console.log('Build completed');
|
|
}).catch(error => {
|
|
console.error('Build failed:', error);
|
|
process.exit(1);
|
|
});
|
|
} |