Fix linting errors

This commit is contained in:
JC Brand 2018-06-07 07:04:45 +02:00
parent 0575ca485a
commit ce3ba2a4f8

View File

@ -1,4 +1,4 @@
/*global path, __dirname, module */
/*global path, __dirname, module, process */
'use strict'
const minimist = require('minimist');
const path = require('path');
@ -120,67 +120,63 @@ const config = {
}
}
function getCLIArgument (name) {
return value;
}
function extend (o1, o2) {
for (let i in o2) {
if (o2.hasOwnProperty(i)) {
o1[i] = o2[i];
}
}
};
for (var i in o2) {
if (Object.prototype.hasOwnProperty.call(o2, i)) {
o1[i] = o2[i];
}
}
}
function parameterize () {
const type = minimist(process.argv.slice(2)).type;
const mode = minimist(process.argv.slice(2)).mode;
const lang = minimist(process.argv.slice(2)).lang;
if (type === 'headless') {
console.log("Making a headless build");
extend(config, {
entry: path.resolve(__dirname, 'src/headless.js'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'converse-headless.js'
},
});
}
if (type === 'headless') {
console.log("Making a headless build");
extend(config, {
entry: path.resolve(__dirname, 'src/headless.js'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'converse-headless.js'
},
});
}
if (type === 'nodeps') {
console.log("Making a build without 3rd party dependencies");
extend(config, {
entry: path.resolve(__dirname, 'src/converse.js'),
externals: [{
"awesomplete": "awesomplete",
"backbone.browserStorage": "backbone.browserStorage",
"backbone.overview": "backbone.overview",
"es6-promise": "es6-promise",
"lodash": "lodash",
"lodash.converter": "lodash.converter",
"lodash.noconflict": "lodash.noconflict",
"moment": "moment",
"strophe": "strophe",
"strophe.ping": "strophe.ping",
"strophe.rsm": "strophe.rsm",
"window": "window"
}],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'converse-no-dependencies.js'
},
});
}
if (type === 'nodeps') {
console.log("Making a build without 3rd party dependencies");
extend(config, {
entry: path.resolve(__dirname, 'src/converse.js'),
externals: [{
"awesomplete": "awesomplete",
"backbone.browserStorage": "backbone.browserStorage",
"backbone.overview": "backbone.overview",
"es6-promise": "es6-promise",
"lodash": "lodash",
"lodash.converter": "lodash.converter",
"lodash.noconflict": "lodash.noconflict",
"moment": "moment",
"strophe": "strophe",
"strophe.ping": "strophe.ping",
"strophe.rsm": "strophe.rsm",
"window": "window"
}],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'converse-no-dependencies.js'
},
});
}
if (mode === 'production') {
console.log("Making a production build");
let fn = config.output.filename;
if (mode === 'production') {
console.log("Making a production build");
const fn = config.output.filename;
config.output.filename = `${fn.replace(/\.js$/, '')}.min.js`;
}
}
if (lang === 'es2015') {
console.log("Making an es2015 build");
if (lang === 'es2015') {
console.log("Making an es2015 build");
config.module.rules.forEach((rule) => {
if (rule.use.loader === 'babel-loader') {
rule.use.options.presets = [
@ -188,7 +184,7 @@ function parameterize () {
]
}
});
}
}
}
parameterize();