Commit 659f70b2 authored by JC Brand's avatar JC Brand

Add the ability to make different kinds of builds

parent bc872ee2
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
.idea .idea
.su? .su?
builds/* builds/*
*.map
dist/converse-no-dependencies-es2015.js
analytics.js analytics.js
inverse-analytics.js inverse-analytics.js
......
...@@ -74,7 +74,7 @@ serve_bg: dev ...@@ -74,7 +74,7 @@ serve_bg: dev
GETTEXT = xgettext --language="JavaScript" --keyword=__ --keyword=___ --from-code=UTF-8 --output=locale/converse.pot dist/converse-no-dependencies.js --package-name=Converse.js --copyright-holder="Jan-Carel Brand" --package-version=3.3.4 -c GETTEXT = xgettext --language="JavaScript" --keyword=__ --keyword=___ --from-code=UTF-8 --output=locale/converse.pot dist/converse-no-dependencies.js --package-name=Converse.js --copyright-holder="Jan-Carel Brand" --package-version=3.3.4 -c
.PHONY: pot .PHONY: pot
pot: dist/converse-no-dependencies.js pot: dist/converse-no-dependencies-es2015.js
$(GETTEXT) 2>&1 > /dev/null; exit $$?; $(GETTEXT) 2>&1 > /dev/null; exit $$?;
.PHONY: po .PHONY: po
...@@ -184,12 +184,28 @@ logo/conversejs-filled%.png:: logo/conversejs-filled.svg ...@@ -184,12 +184,28 @@ logo/conversejs-filled%.png:: logo/conversejs-filled.svg
$(OXIPNG) $@ $(OXIPNG) $@
BUILDS = dist/converse.js \ BUILDS = dist/converse.js \
dist/converse.min.js dist/converse.min.js \
dist/converse-headless.js \
dist/converse.js: transpile src stamp-npm dist/converse-headless.min.js \
./node_modules/.bin/npx webpack --mode=production dist/converse-no-dependencies.min.js \
dist/converse.min.js: transpile src stamp-npm dist/converse-no-dependencies.js \
dist/converse-no-dependencies-es5.js
dist/converse.js: src webpack.config.js stamp-npm
./node_modules/.bin/npx webpack --mode=development
dist/converse.min.js: src webpack.config.js stamp-npm
./node_modules/.bin/npx webpack --mode=production ./node_modules/.bin/npx webpack --mode=production
dist/converse-headless.js: src webpack.config.js stamp-npm
./node_modules/.bin/npx webpack --mode=development --type=headless
dist/converse-headless.min.js: src webpack.config.js stamp-npm
./node_modules/.bin/npx webpack --mode=production --type=headless
dist/converse-no-dependencies.js: src webpack.config.js stamp-npm
./node_modules/.bin/npx webpack --mode=development --type=nodeps
dist/converse-no-dependencies.min.js: src webpack.config.js stamp-npm
./node_modules/.bin/npx webpack --mode=production --type=nodeps
dist/converse-no-dependencies-es2015.js: src webpack.config.js stamp-npm
./node_modules/.bin/npx webpack --mode=development --type=nodeps --lang=es2015
.PHONY: dist .PHONY: dist
dist:: build dist:: build
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*global path, __dirname, module */ /*global path, __dirname, module */
'use strict' 'use strict'
const minimist = require('minimist');
const path = require('path'); const path = require('path');
const config = { const config = {
...@@ -152,4 +153,77 @@ const config = { ...@@ -152,4 +153,77 @@ const config = {
} }
} }
function getCLIArgument (name) {
return value;
}
function extend (o1, o2) {
for (let i in o2) {
if (o2.hasOwnProperty(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 === '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;
config.output.filename = `${fn.replace(/\.js$/, '')}.min.js`;
}
if (lang === 'es2015') {
console.log("Making an es2015 build");
config.module.rules.forEach((rule) => {
if (rule.use.loader === 'babel-loader') {
rule.use.options.presets = [
["@babel/preset-es2015"]
]
}
});
}
}
parameterize();
module.exports = config; module.exports = config;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment