New build
parent
4795feeb1b
commit
382bc7dabd
122
build-lib.js
122
build-lib.js
|
@ -1,37 +1,105 @@
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { execSync } = require('child_process');
|
const Service = require('@vue/cli-service/lib/Service');
|
||||||
const vueCliServicePath = path.resolve(__dirname, 'node_modules/@vue/cli-service/bin/vue-cli-service');
|
const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd());
|
||||||
const babelPath = path.resolve(__dirname, 'node_modules/@babel/cli/bin/babel');
|
const _file = require("@babel/cli/lib/babel/file");
|
||||||
|
|
||||||
|
function buildComponent(folder, file, name) {
|
||||||
|
service.run('build', {
|
||||||
|
_: ['build', 'src/components/' + folder + '/' + file, 'build'],
|
||||||
|
modern: false,
|
||||||
|
report: false,
|
||||||
|
'report-json': false,
|
||||||
|
'inline-vue': false,
|
||||||
|
watch: false,
|
||||||
|
open: false,
|
||||||
|
copy: true,
|
||||||
|
https: false,
|
||||||
|
verbose: false,
|
||||||
|
target: 'lib',
|
||||||
|
clean: false,
|
||||||
|
name: name,
|
||||||
|
dest: 'dist/' + folder
|
||||||
|
},
|
||||||
|
[
|
||||||
|
'build',
|
||||||
|
'src/components/' + folder + '/' + file,
|
||||||
|
'build',
|
||||||
|
'--target',
|
||||||
|
'lib',
|
||||||
|
'--no-clean',
|
||||||
|
'--name',
|
||||||
|
name,
|
||||||
|
'--dest',
|
||||||
|
'dist/' + folder
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function transpileJS(folder, file) {
|
||||||
|
var options = {
|
||||||
|
babelOptions: {
|
||||||
|
configFile: './.babelrc-lib'
|
||||||
|
},
|
||||||
|
cliOptions: {
|
||||||
|
filename: undefined,
|
||||||
|
filenames: ['src/components/' + folder + '/' + file],
|
||||||
|
extensions: undefined,
|
||||||
|
keepFileExtension: undefined,
|
||||||
|
outFileExtension: undefined,
|
||||||
|
watch: undefined,
|
||||||
|
skipInitialBuild: undefined,
|
||||||
|
outFile: 'dist/' + folder + '/' + file,
|
||||||
|
outDir: undefined,
|
||||||
|
relative: undefined,
|
||||||
|
copyFiles: undefined,
|
||||||
|
copyIgnored: undefined,
|
||||||
|
includeDotfiles: undefined,
|
||||||
|
verbose: undefined,
|
||||||
|
quiet: undefined,
|
||||||
|
deleteDirOnStart: undefined,
|
||||||
|
sourceMapTarget: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_file.default(options).catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
process.exitCode = 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function blue(str) {
|
||||||
|
return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m';
|
||||||
|
}
|
||||||
|
|
||||||
|
function green(str) {
|
||||||
|
return '\x1b[1m\x1b[32m' + str + '\x1b[39m\x1b[22m';
|
||||||
|
}
|
||||||
|
|
||||||
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
|
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
|
||||||
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
|
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
|
||||||
let filename = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
|
if (!(/\.js$/.test(file)) || file === 'index.js') {
|
||||||
if (/\.vue$/.test(file)) {
|
fs.copySync(path.resolve(__dirname, './src/components/' + folder) + '/' + file, 'dist/' + folder + '/' + file);
|
||||||
console.log('Building ' + green(filename));
|
|
||||||
|
|
||||||
execSync(
|
|
||||||
`node ${vueCliServicePath} build src/components/${folder}/${file} --target lib --name ${filename} --dest components/${folder} --no-clean `
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else if (/\.js$/.test(file)) {
|
|
||||||
console.log('Building ' + blue(filename));
|
|
||||||
|
|
||||||
execSync(
|
|
||||||
`node ${vueCliServicePath} build src/components/${folder}/${file} --target lib --name ${filename} --dest components/${folder} --no-clean `
|
|
||||||
)
|
|
||||||
|
|
||||||
execSync(
|
|
||||||
`node ${babelPath} src/components/${folder}/${file} --out-file components/${folder}/${file} --config-file=./.babelrc-lib`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function blue (str) {
|
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
|
||||||
return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m';
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function green (str) {
|
fs.copySync(path.resolve(__dirname, './package-build.json'), 'dist/package.json');
|
||||||
return '\x1b[1m\x1b[32m' + str + '\x1b[39m\x1b[22m';
|
fs.copySync(path.resolve(__dirname, './README.md'), 'dist/README.md');
|
||||||
}
|
fs.copySync(path.resolve(__dirname, './LICENSE.md'), 'dist/LICENSE.md');
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/accordion/Accordion';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/accordion/Accordion.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/accordiontab/AccordionTab';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/accordiontab/AccordionTab.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/autocomplete/AutoComplete';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/autocomplete/AutoComplete.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/avatar/Avatar';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/avatar/Avatar.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/avatargroup/AvatarGroup';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/avatargroup/AvatarGroup.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/badge/Badge';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/badge/Badge.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/badge/BadgeDirective';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/badge/BadgeDirective.js');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/blockui/BlockUI';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/blockui/BlockUI.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/breadcrumb/Breadcrumb';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/breadcrumb/Breadcrumb.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/button/Button';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/button/Button.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/calendar/Calendar';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/calendar/Calendar.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/card/Card';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/card/Card.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/carousel/Carousel';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/carousel/Carousel.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/cascadeselect/CascadeSelect';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/cascadeselect/CascadeSelect.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/chart/Chart';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/chart/Chart.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/checkbox/Checkbox';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/checkbox/Checkbox.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/chip/Chip';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/chip/Chip.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/chips/Chips';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/chips/Chips.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/colorpicker/ColorPicker';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/colorpicker/ColorPicker.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/column/Column';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/column/Column.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/columngroup/ColumnGroup';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/columngroup/ColumnGroup.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/config/PrimeVue';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/config/PrimeVue.js');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/confirmation/ConfirmationService';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/confirmation/ConfirmationService.js');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/confirmdialog/ConfirmDialog';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/confirmdialog/ConfirmDialog.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/confirmpopup/ConfirmPopup';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/confirmpopup/ConfirmPopup.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/contextmenu/ContextMenu';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/contextmenu/ContextMenu.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/datatable/DataTable';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/datatable/DataTable.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/dataview/DataView';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/dataview/DataView.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/dataviewlayoutoptions/DataViewLayoutOptions';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/dataviewlayoutoptions/DataViewLayoutOptions.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/deferredcontent/DeferredContent';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/deferredcontent/DeferredContent.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/dialog/Dialog';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/dialog/Dialog.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/divider/Divider';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/divider/Divider.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/dropdown/Dropdown';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/dropdown/Dropdown.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/editor/Editor';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/editor/Editor.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/fieldset/Fieldset';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/fieldset/Fieldset.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/fileupload/FileUpload';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/fileupload/FileUpload.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/fullcalendar/FullCalendar';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/fullcalendar/FullCalendar.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/galleria/Galleria';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/galleria/Galleria.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/inlinemessage/InlineMessage';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/inlinemessage/InlineMessage.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/inplace/Inplace';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/inplace/Inplace.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/inputmask/InputMask';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/inputmask/InputMask.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/inputnumber/InputNumber';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/inputnumber/InputNumber.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/inputswitch/InputSwitch';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/inputswitch/InputSwitch.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/inputtext/InputText';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/inputtext/InputText.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/knob/Knob';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/knob/Knob.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/listbox/Listbox';
|
|
|
@ -1,3 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/listbox/Listbox.vue');
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/megamenu/MegaMenu';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/megamenu/MegaMenu.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/menu/Menu';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/menu/Menu.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/menubar/Menubar';
|
|
|
@ -1,2 +0,0 @@
|
||||||
'use strict';
|
|
||||||
module.exports = require('./components/menubar/Menubar.vue');
|
|
|
@ -1 +0,0 @@
|
||||||
export * from './components/message/Message';
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue