From cdeb4ae1cc25517727745705005e8f7565cb7956 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Mon, 18 Jan 2021 14:20:34 +0300 Subject: [PATCH] New build improvements based on rollup. --- build-meta.js | 19 +++++ gulpfile.js | 2 +- package.json | 2 +- rollup.config.js | 82 +++++++++++++------ src/components/accordion/Accordion.vue | 2 +- src/components/accordion/package.json | 6 ++ src/components/accordiontab/package.json | 6 ++ src/components/autocomplete/AutoComplete.vue | 12 +-- src/components/autocomplete/package.json | 6 ++ src/components/avatar/package.json | 6 ++ src/components/avatargroup/package.json | 6 ++ src/components/badge/package.json | 6 ++ .../badgedirective/BadgeDirective.js | 4 +- src/components/badgedirective/package.json | 6 ++ src/components/blockui/BlockUI.vue | 2 +- src/components/blockui/package.json | 6 ++ src/components/breadcrumb/package.json | 6 ++ src/components/button/Button.vue | 2 +- src/components/button/package.json | 6 ++ src/components/calendar/Calendar.vue | 10 +-- src/components/calendar/package.json | 6 ++ src/components/card/package.json | 6 ++ src/components/carousel/Carousel.vue | 6 +- src/components/carousel/package.json | 6 ++ .../cascadeselect/CascadeSelect.vue | 6 +- .../cascadeselect/CascadeSelectSub.vue | 6 +- src/components/cascadeselect/package.json | 6 ++ src/components/chart/package.json | 6 ++ src/components/checkbox/Checkbox.vue | 2 +- src/components/checkbox/package.json | 6 ++ src/components/chip/package.json | 6 ++ src/components/chips/package.json | 6 ++ src/components/colorpicker/ColorPicker.vue | 4 +- src/components/colorpicker/package.json | 6 ++ src/components/column/package.json | 6 ++ src/components/columngroup/package.json | 6 ++ src/components/common/package.json | 6 ++ src/components/config/package.json | 6 ++ .../ConfirmationEventBus.js | 0 .../confirmationeventbus/package.json | 5 ++ .../ConfirmationService.js | 4 +- .../confirmationservice/package.json | 6 ++ .../confirmdialog/ConfirmDialog.vue | 6 +- src/components/confirmdialog/package.json | 6 ++ src/components/confirmpopup/ConfirmPopup.vue | 8 +- src/components/confirmpopup/package.json | 6 ++ src/components/contextmenu/ContextMenu.vue | 2 +- src/components/contextmenu/ContextMenuSub.vue | 4 +- src/components/contextmenu/package.json | 6 ++ src/components/datatable/BodyCell.vue | 6 +- src/components/datatable/DataTable.vue | 8 +- src/components/datatable/ScrollableView.vue | 2 +- src/components/datatable/TableBody.vue | 2 +- src/components/datatable/TableHeader.vue | 2 +- src/components/datatable/package.json | 6 ++ src/components/dataview/DataView.vue | 4 +- src/components/dataview/package.json | 6 ++ .../dataviewlayoutoptions/package.json | 6 ++ src/components/deferredcontent/package.json | 6 ++ src/components/dialog/Dialog.vue | 5 +- src/components/dialog/package.json | 6 ++ src/components/divider/package.json | 6 ++ src/components/dropdown/Dropdown.vue | 8 +- src/components/dropdown/package.json | 6 ++ src/components/editor/package.json | 6 ++ src/components/fieldset/Fieldset.vue | 4 +- src/components/fieldset/package.json | 6 ++ src/components/fileupload/FileUpload.vue | 10 +-- src/components/fileupload/package.json | 6 ++ src/components/fullcalendar/package.json | 6 ++ src/components/galleria/Galleria.vue | 2 +- src/components/galleria/GalleriaContent.vue | 4 +- src/components/galleria/GalleriaItem.vue | 2 +- .../galleria/GalleriaThumbnails.vue | 4 +- src/components/galleria/package.json | 6 ++ src/components/inlinemessage/package.json | 6 ++ src/components/inplace/Inplace.vue | 2 +- src/components/inplace/package.json | 6 ++ src/components/inputmask/InputMask.vue | 2 +- src/components/inputmask/package.json | 6 ++ src/components/inputnumber/InputNumber.vue | 4 +- src/components/inputnumber/package.json | 6 ++ src/components/inputswitch/package.json | 6 ++ src/components/inputtext/package.json | 6 ++ src/components/knob/package.json | 6 ++ src/components/listbox/Listbox.vue | 6 +- src/components/listbox/package.json | 6 ++ src/components/megamenu/MegaMenu.vue | 4 +- src/components/megamenu/package.json | 6 ++ src/components/menu/Menu.vue | 4 +- src/components/menu/Menuitem.vue | 2 +- src/components/menu/package.json | 6 ++ src/components/menubar/Menubar.vue | 2 +- src/components/menubar/MenubarSub.vue | 4 +- src/components/menubar/package.json | 6 ++ src/components/message/Message.vue | 2 +- src/components/message/package.json | 6 ++ src/components/multiselect/MultiSelect.vue | 8 +- src/components/multiselect/package.json | 6 ++ src/components/orderlist/OrderList.vue | 8 +- src/components/orderlist/package.json | 6 ++ .../OrganizationChartNode.vue | 2 +- src/components/organizationchart/package.json | 6 ++ src/components/overlaypanel/OverlayPanel.vue | 6 +- src/components/overlaypanel/package.json | 6 ++ src/components/paginator/FirstPageLink.vue | 2 +- src/components/paginator/LastPageLink.vue | 2 +- src/components/paginator/NextPageLink.vue | 2 +- src/components/paginator/PageLinks.vue | 2 +- src/components/paginator/PrevPageLink.vue | 2 +- .../paginator/RowsPerPageDropdown.vue | 2 +- src/components/paginator/package.json | 6 ++ src/components/panel/Panel.vue | 4 +- src/components/panel/package.json | 6 ++ src/components/panelmenu/PanelMenu.vue | 2 +- src/components/panelmenu/package.json | 6 ++ src/components/password/Password.vue | 4 +- src/components/password/package.json | 6 ++ src/components/picklist/PickList.vue | 8 +- src/components/picklist/package.json | 6 ++ src/components/progressbar/package.json | 6 ++ src/components/progressspinner/package.json | 6 ++ src/components/radiobutton/RadioButton.vue | 2 +- src/components/radiobutton/package.json | 6 ++ src/components/rating/package.json | 6 ++ src/components/ripple/Ripple.js | 2 +- src/components/ripple/package.json | 6 ++ src/components/row/package.json | 6 ++ src/components/scrollpanel/ScrollPanel.vue | 2 +- src/components/scrollpanel/package.json | 6 ++ src/components/scrolltop/ScrollTop.vue | 2 +- src/components/scrolltop/package.json | 6 ++ src/components/selectbutton/SelectButton.vue | 4 +- src/components/selectbutton/package.json | 6 ++ src/components/sidebar/Sidebar.vue | 4 +- src/components/sidebar/package.json | 6 ++ src/components/skeleton/package.json | 6 ++ src/components/slider/Slider.vue | 2 +- src/components/slider/package.json | 6 ++ src/components/splitbutton/SplitButton.vue | 6 +- src/components/splitbutton/package.json | 6 ++ src/components/splitter/Splitter.vue | 2 +- src/components/splitter/package.json | 6 ++ src/components/splitterpanel/package.json | 6 ++ src/components/steps/Steps.vue | 2 +- src/components/steps/package.json | 6 ++ src/components/tabmenu/TabMenu.vue | 4 +- src/components/tabmenu/package.json | 6 ++ src/components/tabpanel/package.json | 6 ++ src/components/tabview/TabView.vue | 4 +- src/components/tabview/package.json | 6 ++ src/components/tag/package.json | 6 ++ src/components/terminal/package.json | 6 ++ src/components/terminalservice/package.json | 6 ++ src/components/textarea/package.json | 6 ++ src/components/tieredmenu/TieredMenu.vue | 4 +- src/components/tieredmenu/TieredMenuSub.vue | 4 +- src/components/tieredmenu/package.json | 6 ++ src/components/timeline/Timeline.vue | 2 +- src/components/timeline/package.json | 6 ++ src/components/toast/Toast.vue | 4 +- src/components/toast/ToastMessage.vue | 2 +- src/components/toast/package.json | 6 ++ .../ToastEventBus.js | 0 src/components/toasteventbus/package.json | 5 ++ src/components/toastservice/ToastService.js | 6 +- src/components/toastservice/package.json | 6 ++ src/components/togglebutton/ToggleButton.vue | 2 +- src/components/togglebutton/package.json | 6 ++ src/components/toolbar/package.json | 6 ++ src/components/tooltip/Tooltip.js | 6 +- src/components/tooltip/package.json | 6 ++ src/components/tree/Tree.vue | 2 +- src/components/tree/TreeNode.vue | 4 +- src/components/tree/package.json | 6 ++ src/components/treetable/TreeTable.vue | 8 +- src/components/treetable/TreeTableRow.vue | 6 +- src/components/treetable/package.json | 6 ++ src/components/tristatecheckbox/package.json | 6 ++ src/components/useconfirm/package.json | 6 ++ src/components/usetoast/package.json | 6 ++ src/components/utils/Utils.js | 7 ++ src/components/utils/package.json | 5 ++ src/views/badge/BadgeDoc.vue | 2 +- vue.config.js | 20 +++++ 185 files changed, 849 insertions(+), 185 deletions(-) create mode 100644 build-meta.js create mode 100644 src/components/accordion/package.json create mode 100644 src/components/accordiontab/package.json create mode 100644 src/components/autocomplete/package.json create mode 100644 src/components/avatar/package.json create mode 100644 src/components/avatargroup/package.json create mode 100644 src/components/badge/package.json create mode 100644 src/components/badgedirective/package.json create mode 100644 src/components/blockui/package.json create mode 100644 src/components/breadcrumb/package.json create mode 100644 src/components/button/package.json create mode 100644 src/components/calendar/package.json create mode 100644 src/components/card/package.json create mode 100644 src/components/carousel/package.json create mode 100644 src/components/cascadeselect/package.json create mode 100644 src/components/chart/package.json create mode 100644 src/components/checkbox/package.json create mode 100644 src/components/chip/package.json create mode 100644 src/components/chips/package.json create mode 100644 src/components/colorpicker/package.json create mode 100644 src/components/column/package.json create mode 100644 src/components/columngroup/package.json create mode 100644 src/components/common/package.json create mode 100644 src/components/config/package.json rename src/components/{confirmationservice => confirmationeventbus}/ConfirmationEventBus.js (100%) create mode 100644 src/components/confirmationeventbus/package.json create mode 100644 src/components/confirmationservice/package.json create mode 100644 src/components/confirmdialog/package.json create mode 100644 src/components/confirmpopup/package.json create mode 100644 src/components/contextmenu/package.json create mode 100644 src/components/datatable/package.json create mode 100644 src/components/dataview/package.json create mode 100644 src/components/dataviewlayoutoptions/package.json create mode 100644 src/components/deferredcontent/package.json create mode 100644 src/components/dialog/package.json create mode 100644 src/components/divider/package.json create mode 100644 src/components/dropdown/package.json create mode 100644 src/components/editor/package.json create mode 100644 src/components/fieldset/package.json create mode 100644 src/components/fileupload/package.json create mode 100644 src/components/fullcalendar/package.json create mode 100644 src/components/galleria/package.json create mode 100644 src/components/inlinemessage/package.json create mode 100644 src/components/inplace/package.json create mode 100644 src/components/inputmask/package.json create mode 100644 src/components/inputnumber/package.json create mode 100644 src/components/inputswitch/package.json create mode 100644 src/components/inputtext/package.json create mode 100644 src/components/knob/package.json create mode 100644 src/components/listbox/package.json create mode 100644 src/components/megamenu/package.json create mode 100644 src/components/menu/package.json create mode 100644 src/components/menubar/package.json create mode 100644 src/components/message/package.json create mode 100644 src/components/multiselect/package.json create mode 100644 src/components/orderlist/package.json create mode 100644 src/components/organizationchart/package.json create mode 100644 src/components/overlaypanel/package.json create mode 100644 src/components/paginator/package.json create mode 100644 src/components/panel/package.json create mode 100644 src/components/panelmenu/package.json create mode 100644 src/components/password/package.json create mode 100644 src/components/picklist/package.json create mode 100644 src/components/progressbar/package.json create mode 100644 src/components/progressspinner/package.json create mode 100644 src/components/radiobutton/package.json create mode 100644 src/components/rating/package.json create mode 100644 src/components/ripple/package.json create mode 100644 src/components/row/package.json create mode 100644 src/components/scrollpanel/package.json create mode 100644 src/components/scrolltop/package.json create mode 100644 src/components/selectbutton/package.json create mode 100644 src/components/sidebar/package.json create mode 100644 src/components/skeleton/package.json create mode 100644 src/components/slider/package.json create mode 100644 src/components/splitbutton/package.json create mode 100644 src/components/splitter/package.json create mode 100644 src/components/splitterpanel/package.json create mode 100644 src/components/steps/package.json create mode 100644 src/components/tabmenu/package.json create mode 100644 src/components/tabpanel/package.json create mode 100644 src/components/tabview/package.json create mode 100644 src/components/tag/package.json create mode 100644 src/components/terminal/package.json create mode 100644 src/components/terminalservice/package.json create mode 100644 src/components/textarea/package.json create mode 100644 src/components/tieredmenu/package.json create mode 100644 src/components/timeline/package.json create mode 100644 src/components/toast/package.json rename src/components/{toastservice => toasteventbus}/ToastEventBus.js (100%) create mode 100644 src/components/toasteventbus/package.json create mode 100644 src/components/toastservice/package.json create mode 100644 src/components/togglebutton/package.json create mode 100644 src/components/toolbar/package.json create mode 100644 src/components/tooltip/package.json create mode 100644 src/components/tree/package.json create mode 100644 src/components/treetable/package.json create mode 100644 src/components/tristatecheckbox/package.json create mode 100644 src/components/useconfirm/package.json create mode 100644 src/components/usetoast/package.json create mode 100644 src/components/utils/Utils.js create mode 100644 src/components/utils/package.json diff --git a/build-meta.js b/build-meta.js new file mode 100644 index 000000000..433130666 --- /dev/null +++ b/build-meta.js @@ -0,0 +1,19 @@ +const fs = require('fs-extra'); +const path = require('path'); + +fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => { + fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => { + if (file ==='package.json') { + fs.copySync(path.resolve(__dirname, './src/components/' + folder) + '/package.json', 'dist/' + folder + '/package.json'); + } + + if (file.endsWith('d.ts')) { + fs.copySync(path.resolve(__dirname, './src/components/' + folder) + '/' + file, 'dist/' + folder + '/' + file); + } + }) + +}); + +fs.copySync(path.resolve(__dirname, './package-build.json'), 'dist/package.json'); +fs.copySync(path.resolve(__dirname, './README.md'), 'dist/README.md'); +fs.copySync(path.resolve(__dirname, './LICENSE.md'), 'dist/LICENSE.md'); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 8928c950f..77249d62e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,5 +33,5 @@ gulp.task('images', function() { }); //Building project with run sequence -gulp.task('build-resources', ['build-css', 'images', 'build-themes']); +gulp.task('build-styles', ['build-css', 'images', 'build-themes']); diff --git a/package.json b/package.json index 096d31a3c..414ab4096 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "scripts": { "serve": "vue-cli-service serve", "build-app": "vue-cli-service build", - "build-lib": "node build-lib && gulp build-resources", + "build-lib": "rollup -c && node build-meta && gulp build-styles", "lint": "vue-cli-service lint", "test:unit": "vue-cli-service test:unit" }, diff --git a/rollup.config.js b/rollup.config.js index dd38df094..1ed44d970 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,33 +6,67 @@ const path = require('path'); let entries = []; -fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => { - fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => { - if (file !== 'index.js' && file !== 'index.d.ts') { +function addEntry(folder, inFile, outFile) { + entries.push({ + input: 'src/components/' + folder + '/' + inFile, + output: [ + { + format: 'esm', + file: 'dist/' + folder + '/' + outFile + '.esm.js' + }, + { + format: 'cjs', + file: 'dist/' + folder + '/' + outFile + '.cjs.js' + }, + { + format: 'umd', + name: 'primevue', + file: 'dist/' + folder + '/' + outFile + '.umd.js' + } + ], + plugins: [ + vue(), + postcss() + ] + }); +} + +function addSFC() { + fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => { + fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => { let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase(); if (/\.vue$/.test(file)) { - entries.push({ - input: 'src/components/' + folder + '/' + file, - external: [/\.\./], - output: [ - { - format: 'esm', - file: 'dist/' + folder + '/' + name + '.esm.js' - }, - { - format: 'umd', - name: 'primevue', - file: 'dist/' + folder + '/' + name + '.umd.js' - } - ], - plugins: [ - vue(), - postcss() - ] - }); + addEntry(folder, file, name); } - } + }); }); -}); +} + +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'); +} + +function addServices() { + addEntry('confirmationservice', 'ConfirmationService.js', 'confirmationservice'); + addEntry('confirmationeventbus', 'ConfirmationEventBus.js', 'confirmationeventbus'); + addEntry('toastservice', 'ToastService.js', 'toastservice'); + addEntry('toasteventbus', 'ToastEventBus.js', 'toasteventbus'); +} + +addSFC(); +addDirectives(); +addConfig(); +addUtils(); +addServices(); export default entries; \ No newline at end of file diff --git a/src/components/accordion/Accordion.vue b/src/components/accordion/Accordion.vue index 7746830d5..ceaf5e761 100755 --- a/src/components/accordion/Accordion.vue +++ b/src/components/accordion/Accordion.vue @@ -22,7 +22,7 @@