uikit/rollup.config.js
Llewellyn van der Merwe 78271fea45
refactor: Rename and enhance UikitUploader, refactor URL building, and update package
- Renamed 'UikitUploader' to 'UploadFile' for improved clarity and updated related imports.
- Refactored methods to handle null element cases and enhanced notification system, improving code readability and functionality.
- Renamed 'UploadHelper' to 'FileType' to better reflect its purpose.
- Simplified URL building by utilizing class properties directly and reducing parameters.
- Updated package details, bumped version to 3.0.0, and modified the main entry point.
- Renamed 'Uploader' to 'vdm-uikit' across the project documentation for consistency.
- Enhanced rollup config by updating references from Uploader to VDMUikit, including file names, banner text, and global objects.
- Added support for delete endpoint in configuration and updated script source URLs to use the unified 'vdm.min.js'.
- Renamed 'Uploader.js' to 'vdm.js', updated import statements to reflect new modules 'UploadFile' and 'DeleteFile'.
- Implemented initialization and error handling for 'delete_file' in the VDM namespace.
- Removed obsolete 'Uploader.js' and 'Uploader.min.js' files from distribution.
2024-09-14 17:50:43 +02:00

70 lines
2.0 KiB
JavaScript

import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel } from '@rollup/plugin-babel';
import { terser } from 'rollup-plugin-terser';
import license from 'rollup-plugin-license';
import replace from '@rollup/plugin-replace';
const licenseLine = {
banner: `/*! VDM Uikit v${require('./package.json').version} | https://git.vdm.dev/joomla/uikit | (c) 2020 - ${new Date().getFullYear()} Llewellyn van der Merwe | MIT License */`
};
const licenseHeader = {
banner: `/**
* VDM Uikit v${require('./package.json').version}
* https://git.vdm.dev/joomla/uikit
* (c) 2020 - ${new Date().getFullYear()} Llewellyn van der Merwe
* MIT License
**/
`};
export default [
{
input: 'src/js/vdm.js',
plugins: [
license(licenseHeader),
replace({
'process.env.DEBUG': true,
preventAssignment: true,
}),
resolve(), // Resolves local and node modules
commonjs()
],
output: {
file: 'dist/js/vdm.js',
format: 'iife',
name: 'VDMUikit',
globals: {
uikit: 'UIkit'
}
},
external: ['uikit'], // UIkit is treated as external
},
{
input: 'src/js/vdm.js',
plugins: [
resolve(), // Resolves local and node modules
commonjs(),
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-env'],
}),
terser(), // Minify the output
license(licenseLine),
replace({
'process.env.DEBUG': false,
preventAssignment: true,
})
],
external: ['uikit'], // UIkit is treated as external
output: {
file: 'dist/js/vdm.min.js',
format: 'iife',
name: 'VDMUikit',
globals: {
uikit: 'UIkit'
},
},
},
];