Skip to content

Commit

Permalink
Fixed #819 - Nuxt Module for PrimeVue 2
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Dec 31, 2020
1 parent 4d4cb8f commit 27f2673
Show file tree
Hide file tree
Showing 98 changed files with 467 additions and 37 deletions.
36 changes: 20 additions & 16 deletions build-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,31 @@ function green(str) {

fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
if (!(/\.js$/.test(file)) || file === 'index.js') {
fs.copySync(path.resolve(__dirname, './src/components/' + folder) + '/' + file, 'dist/' + folder + '/' + file);
}
fs.copySync(path.resolve(__dirname, './src/components/' + folder) + '/' + file, 'dist/' + folder + '/' + file);
});
});

const excludedFolders = ['nuxt'];
const excludedFiles = ['index.js', 'index.d.ts', 'plugin.js', 'plugin-ripple.js'];

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') {
let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
if (/\.js$/.test(file)) {
console.log('Transpiling ' + blue(file));
buildComponent(folder, file, name);
transpileJS(folder, file);
}
else if (/\.vue$/.test(file)) {
console.log('Building ' + green(name));
buildComponent(folder, file, name);
if (!excludedFolders.includes(folder)) {
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
if (!excludedFiles.includes(file)) {
let name = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
if (/\.js$/.test(file)) {
console.log('Transpiling ' + blue(file));
buildComponent(folder, file, name);
transpileJS(folder, file);
}
else if (/\.vue$/.test(file)) {
console.log('Building ' + green(name));
buildComponent(folder, file, name);
}
}
}
});
});
}

});

fs.copySync(path.resolve(__dirname, './package-build.json'), 'dist/package.json');
Expand Down
4 changes: 4 additions & 0 deletions src/components/accordion/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Accordion from 'primevue/accordion';

Vue.component('Accordion', Accordion);
4 changes: 4 additions & 0 deletions src/components/accordiontab/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import AccordionTab from 'primevue/accordiontab';

Vue.component('AccordionTab', AccordionTab);
4 changes: 4 additions & 0 deletions src/components/autocomplete/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import AutoComplete from 'primevue/autocomplete';

Vue.component('AutoComplete', AutoComplete);
4 changes: 4 additions & 0 deletions src/components/avatar/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Avatar from 'primevue/avatar';

Vue.component('Avatar', Avatar);
4 changes: 4 additions & 0 deletions src/components/avatargroup/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import AvatarGroup from 'primevue/avatargroup';

Vue.component('AvatarGroup', AvatarGroup);
4 changes: 4 additions & 0 deletions src/components/badge/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Badge from 'primevue/badge';

Vue.component('Badge', Badge);
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/components/badgedirective/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './BadgeDirective';
2 changes: 2 additions & 0 deletions src/components/badgedirective/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'use strict';
module.exports = require('./BadgeDirective.js');
4 changes: 4 additions & 0 deletions src/components/badgedirective/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import BadgeDirective from 'primevue/badgedirective';

Vue.directive('BadgeDirective', BadgeDirective);
4 changes: 4 additions & 0 deletions src/components/blockui/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import BlockUI from 'primevue/blockui';

Vue.component('BlockUI', BlockUI);
4 changes: 4 additions & 0 deletions src/components/breadcrumb/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Breadcrumb from 'primevue/breadcrumb';

Vue.component('Breadcrumb', Breadcrumb);
4 changes: 4 additions & 0 deletions src/components/button/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Button from 'primevue/button';

Vue.component('Button', Button);
4 changes: 4 additions & 0 deletions src/components/calendar/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Calendar from 'primevue/calendar';

Vue.component('Calendar', Calendar);
4 changes: 4 additions & 0 deletions src/components/card/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Card from 'primevue/card';

Vue.component('Card', Card);
4 changes: 4 additions & 0 deletions src/components/carousel/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Carousel from 'primevue/carousel';

Vue.component('Carousel', Carousel);
4 changes: 4 additions & 0 deletions src/components/cascadeselect/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import CascadeSelect from 'primevue/cascadeselect';

Vue.component('CascadeSelect', CascadeSelect);
4 changes: 4 additions & 0 deletions src/components/chart/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Chart from 'primevue/chart';

Vue.component('Chart', Chart);
4 changes: 4 additions & 0 deletions src/components/checkbox/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Checkbox from 'primevue/checkbox';

Vue.component('Checkbox', Checkbox);
4 changes: 4 additions & 0 deletions src/components/chip/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Chip from 'primevue/chip';

Vue.component('Chip', Chip);
4 changes: 4 additions & 0 deletions src/components/chips/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Chips from 'primevue/chips';

Vue.component('Chips', Chips);
4 changes: 4 additions & 0 deletions src/components/colorpicker/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import ColorPicker from 'primevue/colorpicker';

Vue.component('ColorPicker', ColorPicker);
4 changes: 4 additions & 0 deletions src/components/column/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Column from 'primevue/column';

Vue.component('Column', Column);
4 changes: 4 additions & 0 deletions src/components/columngroup/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import ColumnGroup from 'primevue/columngroup';

Vue.component('ColumnGroup', ColumnGroup);
4 changes: 4 additions & 0 deletions src/components/config/plugin-ripple.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import PrimeVue from 'primevue/config';

Vue.use(PrimeVue, {ripple: true});
4 changes: 4 additions & 0 deletions src/components/config/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import PrimeVue from 'primevue/config';

Vue.use(PrimeVue);
6 changes: 6 additions & 0 deletions src/components/confirmdialog/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Vue from 'vue';
import ConfirmDialog from 'primevue/confirmdialog';
import ConfirmationService from 'primevue/confirmationservice';

Vue.use(ConfirmationService);
Vue.component('ConfirmDialog', ConfirmDialog);
6 changes: 6 additions & 0 deletions src/components/confirmpopup/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Vue from 'vue';
import ConfirmPopup from 'primevue/confirmpopup';
import ConfirmationService from 'primevue/confirmationservice';

Vue.use(ConfirmationService);
Vue.component('ConfirmPopup', ConfirmPopup);
4 changes: 4 additions & 0 deletions src/components/contextmenu/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import ContextMenu from 'primevue/contextmenu';

Vue.component('ContextMenu', ContextMenu);
4 changes: 4 additions & 0 deletions src/components/datatable/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import DataTable from 'primevue/datatable';

Vue.component('DataTable', DataTable);
4 changes: 4 additions & 0 deletions src/components/dataview/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import DataView from 'primevue/dataview';

Vue.component('DataView', DataView);
4 changes: 4 additions & 0 deletions src/components/dataviewlayoutoptions/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import DataViewLayoutOptions from 'primevue/dataviewlayoutoptions';

Vue.component('DataViewLayoutOptions', DataViewLayoutOptions);
4 changes: 4 additions & 0 deletions src/components/deferredcontent/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import DeferredContent from 'primevue/deferredcontent';

Vue.component('DeferredContent', DeferredContent);
4 changes: 4 additions & 0 deletions src/components/dialog/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Dialog from 'primevue/dialog';

Vue.component('Dialog', Dialog);
4 changes: 4 additions & 0 deletions src/components/divider/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Divider from 'primevue/divider';

Vue.component('Divider', Divider);
4 changes: 4 additions & 0 deletions src/components/dropdown/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Dropdown from 'primevue/dropdown';

Vue.component('Dropdown', Dropdown);
4 changes: 4 additions & 0 deletions src/components/editor/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Editor from 'primevue/editor';

Vue.component('Editor', Editor);
4 changes: 4 additions & 0 deletions src/components/fieldset/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Fieldset from 'primevue/fieldset';

Vue.component('Fieldset', Fieldset);
4 changes: 4 additions & 0 deletions src/components/fileupload/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import FileUpload from 'primevue/fileupload';

Vue.component('FileUpload', FileUpload);
4 changes: 4 additions & 0 deletions src/components/fullcalendar/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import FullCalendar from 'primevue/fullcalendar';

Vue.component('FullCalendar', FullCalendar);
4 changes: 4 additions & 0 deletions src/components/galleria/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Galleria from 'primevue/galleria';

Vue.component('Galleria', Galleria);
4 changes: 4 additions & 0 deletions src/components/inlinemessage/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import InlineMessage from 'primevue/inlinemessage';

Vue.component('InlineMessage', InlineMessage);
4 changes: 4 additions & 0 deletions src/components/inplace/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Inplace from 'primevue/inplace';

Vue.component('Inplace', Inplace);
4 changes: 4 additions & 0 deletions src/components/inputmask/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import InputMask from 'primevue/inputmask';

Vue.component('InputMask', InputMask);
4 changes: 4 additions & 0 deletions src/components/inputnumber/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import InputNumber from 'primevue/inputnumber';

Vue.component('InputNumber', InputNumber);
4 changes: 4 additions & 0 deletions src/components/inputswitch/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import InputSwitch from 'primevue/inputswitch';

Vue.component('InputSwitch', InputSwitch);
4 changes: 4 additions & 0 deletions src/components/inputtext/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import InputText from 'primevue/inputtext';

Vue.component('InputText', InputText);
4 changes: 4 additions & 0 deletions src/components/knob/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Knob from 'primevue/knob';

Vue.component('Knob', Knob);
4 changes: 4 additions & 0 deletions src/components/listbox/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Listbox from 'primevue/listbox';

Vue.component('Listbox', Listbox);
4 changes: 4 additions & 0 deletions src/components/megamenu/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import MegaMenu from 'primevue/megamenu';

Vue.component('MegaMenu', MegaMenu);
4 changes: 4 additions & 0 deletions src/components/menu/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Menu from 'primevue/menu';

Vue.component('Menu', Menu);
4 changes: 4 additions & 0 deletions src/components/menubar/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Menubar from 'primevue/menubar';

Vue.component('Menubar', Menubar);
4 changes: 4 additions & 0 deletions src/components/message/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Message from 'primevue/message';

Vue.component('Message', Message);
4 changes: 4 additions & 0 deletions src/components/multiselect/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import MultiSelect from 'primevue/multiselect';

Vue.component('MultiSelect', MultiSelect);
24 changes: 24 additions & 0 deletions src/components/nuxt/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import path from 'path';

export default function (moduleOptions) {
const config = Object.assign({}, this.options.primevue, moduleOptions);
const theme = config.theme || 'saga-blue';
this.options.css.push('primevue/resources/themes/' + theme + '/theme.css');
this.options.css.push('primevue/resources/primevue.min.css');
this.options.css.push('primeicons/primeicons.css');

if (config.ripple) {
this.addPlugin(path.resolve(__dirname, '../config/plugin-ripple.js'));
}
else {
this.addPlugin(path.resolve(__dirname, '../config/plugin.js'));
}

if (config.components) {
config.components.forEach(component => this.addPlugin(path.resolve(__dirname, '../' + component.toLowerCase() + '/plugin.js')));
}

if (config.directives) {
config.directives.forEach(component => this.addPlugin(path.resolve(__dirname, '../' + component.toLowerCase() + '/plugin.js')));
}
}
4 changes: 4 additions & 0 deletions src/components/orderlist/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import OrderList from 'primevue/orderlist';

Vue.component('OrderList', OrderList);
4 changes: 4 additions & 0 deletions src/components/organizationchart/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import OrganizationChart from 'primevue/organizationchart';

Vue.component('OrganizationChart', OrganizationChart);
4 changes: 4 additions & 0 deletions src/components/overlaypanel/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import OverlayPanel from 'primevue/overlaypanel';

Vue.component('OverlayPanel', OverlayPanel);
4 changes: 4 additions & 0 deletions src/components/paginator/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Paginator from 'primevue/paginator';

Vue.component('Paginator', Paginator);
4 changes: 4 additions & 0 deletions src/components/panel/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Panel from 'primevue/panel';

Vue.component('Panel', Panel);
4 changes: 4 additions & 0 deletions src/components/panelmenu/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import PanelMenu from 'primevue/panelmenu';

Vue.component('PanelMenu', PanelMenu);
4 changes: 4 additions & 0 deletions src/components/password/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import Password from 'primevue/password';

Vue.component('Password', Password);
4 changes: 4 additions & 0 deletions src/components/picklist/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import PickList from 'primevue/picklist';

Vue.component('PickList', PickList);
4 changes: 4 additions & 0 deletions src/components/progressbar/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import ProgressBar from 'primevue/progressbar';

Vue.component('ProgressBar', ProgressBar);
4 changes: 4 additions & 0 deletions src/components/progressspinner/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import ProgressSpinner from 'primevue/progressspinner';

Vue.component('ProgressSpinner', ProgressSpinner);
4 changes: 4 additions & 0 deletions src/components/radiobutton/plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import RadioButton from 'primevue/radiobutton';

Vue.component('RadioButton', RadioButton);
Loading

0 comments on commit 27f2673

Please sign in to comment.