Fixed transpile issues for .js files

pull/12/head
mertsincan 2019-05-29 10:11:07 +03:00
parent bdde45ac1d
commit 8f44e19412
5 changed files with 125 additions and 107 deletions

View File

@ -5,13 +5,28 @@ const vueCliServicePath = path.resolve(__dirname, 'node_modules/@vue/cli-service
fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => {
fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => {
if (/\.vue$/.test(file) || /\.js$/.test(file)) {
let filename = file.split(/(.vue)$|(.js)$/)[0].toLowerCase();
console.log('Building ' + filename);
if (/\.vue$/.test(file)) {
console.log('Building ' + blue(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(
`babel --no-babelrc src/components/${folder}/${file} --out-file components/${folder}/${file} --presets=es2015,stage-2 `
)
}
});
});
function blue (str) {
return '\x1b[1m\x1b[34m' + str + '\x1b[39m\x1b[22m'
}

View File

@ -8,7 +8,7 @@ var gulp = require('gulp'),
flatten = require('gulp-flatten');
gulp.task('copy-components', function() {
return gulp.src(['src/components/**/*'])
return gulp.src(['src/components/**/*.vue'])
.pipe(gulp.dest('./components'));
});

View File

@ -26,6 +26,8 @@
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"eslint": "^5.8.0",
"eslint-plugin-vue": "^5.0.0-0",
"node-sass": "^4.9.0",

View File

@ -1,81 +0,0 @@
export default class FilterUtils {
static startsWith(value, filter) {
if(filter === undefined || filter === null || filter.trim() === '') {
return true;
}
if(value === undefined || value === null) {
return false;
}
let filterValue = filter.toLowerCase();
return value.toString().toLowerCase().slice(0, filterValue.length) === filterValue;
}
static contains(value, filter) {
if(filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
return true;
}
if(value === undefined || value === null) {
return false;
}
return value.toString().toLowerCase().indexOf(filter.toLowerCase()) !== -1;
}
static endsWith(value, filter) {
if(filter === undefined || filter === null || filter.trim() === '') {
return true;
}
if(value === undefined || value === null) {
return false;
}
let filterValue = filter.toString().toLowerCase();
return value.toString().toLowerCase().indexOf(filterValue, value.toString().length - filterValue.length) !== -1;
}
static equals(value, filter) {
if(filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
return true;
}
if(value === undefined || value === null) {
return false;
}
return value.toString().toLowerCase() === filter.toString().toLowerCase();
}
static notEquals(value, filter) {
if(filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
return false;
}
if(value === undefined || value === null) {
return true;
}
return value.toString().toLowerCase() !== filter.toString().toLowerCase();
}
static in(value, filter) {
if(filter === undefined || filter === null || filter.length === 0) {
return true;
}
if(value === undefined || value === null) {
return false;
}
for(let i = 0; i < filter.length; i++) {
if(filter[i] === value)
return true;
}
return false;
}
}

View File

@ -130,4 +130,86 @@ export default class ObjectUtils {
return false;
}
static filterConstraints = {
startsWith(value, filter) {
if (filter === undefined || filter === null || filter.trim() === '') {
return true;
}
if (value === undefined || value === null) {
return false;
}
let filterValue = filter.toLowerCase();
return value.toString().toLowerCase().slice(0, filterValue.length) === filterValue;
},
contains(value, filter) {
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
return true;
}
if (value === undefined || value === null) {
return false;
}
return value.toString().toLowerCase().indexOf(filter.toLowerCase()) !== -1;
},
endsWith(value, filter) {
if (filter === undefined || filter === null || filter.trim() === '') {
return true;
}
if (value === undefined || value === null) {
return false;
}
let filterValue = filter.toString().toLowerCase();
return value.toString().toLowerCase().indexOf(filterValue, value.toString().length - filterValue.length) !== -1;
},
equals(value, filter) {
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
return true;
}
if (value === undefined || value === null) {
return false;
}
return value.toString().toLowerCase() === filter.toString().toLowerCase();
},
notEquals(value, filter) {
if (filter === undefined || filter === null || (typeof filter === 'string' && filter.trim() === '')) {
return false;
}
if (value === undefined || value === null) {
return true;
}
return value.toString().toLowerCase() !== filter.toString().toLowerCase();
},
in(value, filter) {
if (filter === undefined || filter === null || filter.length === 0) {
return true;
}
if (value === undefined || value === null) {
return false;
}
for (let i = 0; i < filter.length; i++) {
if (filter[i] === value)
return true;
}
return false;
}
}
}