2021-01-18 08:25:54 +00:00
|
|
|
import vue from 'rollup-plugin-vue';
|
|
|
|
import postcss from 'rollup-plugin-postcss';
|
2021-01-18 12:21:54 +00:00
|
|
|
import { terser } from 'rollup-plugin-terser';
|
2021-01-18 08:25:54 +00:00
|
|
|
|
|
|
|
const fs = require('fs-extra');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
let entries = [];
|
|
|
|
|
2021-01-18 14:35:36 +00:00
|
|
|
let globalDependencies = {
|
|
|
|
'vue': 'Vue',
|
|
|
|
'primevue/ripple': 'primevue.ripple',
|
|
|
|
'primevue/utils': 'primevue.utils',
|
|
|
|
'primevue/button': 'primevue.button',
|
|
|
|
'primevue/inputtext': 'primevue.inputtext',
|
|
|
|
'primevue/dialog': 'primevue.dialog',
|
|
|
|
'primevue/paginator': 'primevue.paginator',
|
|
|
|
'primevue/confirmationeventbus': 'primevue.confirmationeventbus',
|
|
|
|
'primevue/toasteventbus': 'primevue.toasteventbus',
|
|
|
|
'primevue/useconfirm': 'primevue.useconfirm',
|
|
|
|
'primevue/usetoast': 'primevue.usetoast',
|
|
|
|
'primevue/progressbar': 'primevue.progressbar',
|
|
|
|
'primevue/message': 'primevue.message',
|
|
|
|
'primevue/dropdown': 'primevue.dropdown',
|
|
|
|
'primevue/menu': 'primevue.menu',
|
|
|
|
'@fullcalendar/core': 'FullCalendar'
|
|
|
|
}
|
|
|
|
|
2021-01-18 11:20:34 +00:00
|
|
|
function addEntry(folder, inFile, outFile) {
|
|
|
|
entries.push({
|
|
|
|
input: 'src/components/' + folder + '/' + inFile,
|
|
|
|
output: [
|
2021-01-18 12:21:54 +00:00
|
|
|
{
|
2021-01-18 14:39:05 +00:00
|
|
|
format: 'cjs',
|
|
|
|
file: 'dist/' + folder + '/' + outFile + '.cjs.js',
|
2021-01-18 12:21:54 +00:00
|
|
|
},
|
2021-01-18 11:20:34 +00:00
|
|
|
{
|
|
|
|
format: 'esm',
|
|
|
|
file: 'dist/' + folder + '/' + outFile + '.esm.js'
|
|
|
|
},
|
|
|
|
{
|
2021-01-18 12:21:54 +00:00
|
|
|
format: 'iife',
|
2021-01-18 14:35:36 +00:00
|
|
|
name: 'primevue.' + folder,
|
2021-01-18 13:41:06 +00:00
|
|
|
file: 'dist/' + folder + '/' + outFile + '.js',
|
2021-01-18 14:35:36 +00:00
|
|
|
globals: globalDependencies
|
2021-01-18 12:21:54 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
vue(),
|
|
|
|
postcss()
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
2021-01-18 14:39:05 +00:00
|
|
|
entries.push({
|
2021-01-18 12:21:54 +00:00
|
|
|
input: 'src/components/' + folder + '/' + inFile,
|
|
|
|
output: [
|
2021-01-18 11:20:34 +00:00
|
|
|
{
|
2021-01-18 14:39:05 +00:00
|
|
|
format: 'cjs',
|
|
|
|
file: 'dist/' + folder + '/' + outFile + '.cjs.min.js'
|
2021-01-18 12:21:54 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
format: 'esm',
|
|
|
|
file: 'dist/' + folder + '/' + outFile + '.esm.min.js'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
format: 'iife',
|
2021-01-18 13:41:06 +00:00
|
|
|
name: folder,
|
2021-01-18 14:39:05 +00:00
|
|
|
file: 'dist/' + folder + '/' + outFile + '.min.js',
|
|
|
|
globals: globalDependencies
|
2021-01-18 11:20:34 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
plugins: [
|
|
|
|
vue(),
|
2021-01-18 12:21:54 +00:00
|
|
|
postcss(),
|
|
|
|
terser()
|
2021-01-18 11:20:34 +00:00
|
|
|
]
|
2021-01-18 14:39:05 +00:00
|
|
|
});
|
2021-01-18 11:20:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function addSFC() {
|
|
|
|
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
|
|
|
|
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
|
2021-01-18 08:25:54 +00:00
|
|
|
let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
|
2021-01-18 15:38:34 +00:00
|
|
|
if (/\.vue$/.test(file) && (name === folder)) {
|
2021-01-18 11:20:34 +00:00
|
|
|
addEntry(folder, file, name);
|
2021-01-18 08:25:54 +00:00
|
|
|
}
|
2021-01-18 11:20:34 +00:00
|
|
|
});
|
2021-01-18 08:25:54 +00:00
|
|
|
});
|
2021-01-18 11:20:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function addDirectives() {
|
|
|
|
addEntry('badgedirective', 'BadgeDirective.js', 'badgedirective');
|
|
|
|
addEntry('ripple', 'Ripple.js', 'ripple');
|
|
|
|
addEntry('tooltip', 'Tooltip.js', 'tooltip');
|
|
|
|
}
|
|
|
|
|
|
|
|
function addConfig() {
|
|
|
|
addEntry('config', 'PrimeVue.js', 'config');
|
|
|
|
}
|
|
|
|
|
|
|
|
function addUtils() {
|
|
|
|
addEntry('utils', 'Utils.js', 'utils');
|
|
|
|
}
|
|
|
|
|
2021-02-06 09:26:12 +00:00
|
|
|
function addApi() {
|
|
|
|
addEntry('api', 'Api.js', 'api');
|
|
|
|
}
|
|
|
|
|
2021-01-18 11:20:34 +00:00
|
|
|
function addServices() {
|
|
|
|
addEntry('confirmationservice', 'ConfirmationService.js', 'confirmationservice');
|
|
|
|
addEntry('confirmationeventbus', 'ConfirmationEventBus.js', 'confirmationeventbus');
|
2021-01-18 15:16:32 +00:00
|
|
|
addEntry('useconfirm', 'UseConfirm.js', 'useconfirm');
|
2021-01-18 11:20:34 +00:00
|
|
|
addEntry('toastservice', 'ToastService.js', 'toastservice');
|
|
|
|
addEntry('toasteventbus', 'ToastEventBus.js', 'toasteventbus');
|
2021-01-18 15:16:32 +00:00
|
|
|
addEntry('usetoast', 'UseToast.js', 'usetoast');
|
2021-01-18 14:35:36 +00:00
|
|
|
addEntry('terminalservice', 'TerminalService.js', 'terminalservice');
|
2021-01-18 11:20:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
addSFC();
|
|
|
|
addDirectives();
|
|
|
|
addConfig();
|
|
|
|
addUtils();
|
2021-02-06 09:26:12 +00:00
|
|
|
addApi();
|
2021-01-18 11:20:34 +00:00
|
|
|
addServices();
|
2021-01-18 08:25:54 +00:00
|
|
|
|
|
|
|
export default entries;
|