Files
activeadmin-quill_editor/spec/dummy/esbuild.config.js
Gleb Tv 0a12969370 refactor: Remove jQuery dependency and consolidate JavaScript assets
- Rename vendor JS file to activeadmin/quill_editor.js to avoid conflicts
- Update import alias to use 'activeadmin/quill_editor' for consistency
- Remove jQuery-dependent legacy file (quill_editor_input.js)
- Simplify engine asset configuration - only one JS file now
- Update documentation with correct paths and import names
- All functionality preserved with vanilla JavaScript

BREAKING CHANGE: Drops support for jQuery-based initialization.
Applications using the legacy jQuery initialization will need to
update to the new module-based approach.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 14:42:54 +03:00

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);
});
}