Commit cf7d2fb6 authored by JC Brand's avatar JC Brand

Add webpack.nodeps.js

Use it to generate dist/converse-no-dependencies.js which we use to
generate the converse.pot file.
parent 12bca229
......@@ -21,6 +21,7 @@ SED ?= sed
SPHINXBUILD ?= ./bin/sphinx-build
SPHINXOPTS =
UGLIFYJS ?= node_modules/.bin/uglifyjs
XGETTEXT = xgettext
# Internal variables.
......@@ -65,10 +66,13 @@ serve_bg: stamp-npm
########################################################################
## Translation machinery
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=5.0.1 -c
dist/converse-no-dependencies.js: src webpack.common.js webpack.nodeps.js stamp-npm @converse/headless
npm run nodeps
GETTEXT = $(XGETTEXT) --from-code=UTF-8 --language=JavaScript --keyword=__ -keyword=___ --force-po --output=locale/converse.pot --package-name=Converse.js --copyright-holder="Jan-Carel Brand" --package-version=5.0.1 dist/converse-no-dependencies.js -c
.PHONY: pot
pot: dist/converse-no-dependencies-es2015.js
pot: dist/converse-no-dependencies.js
$(GETTEXT) 2>&1 > /dev/null; exit $$?;
.PHONY: po
......@@ -155,18 +159,13 @@ logo/conversejs-filled%.png:: logo/conversejs-filled.svg
$(OXIPNG) $@
BUILDS = src/headless/dist/converse-headless.js \
src/headless/dist/converse-headless.min.js \
dist/converse-no-dependencies.js \
dist/converse-no-dependencies-es2015.js
src/headless/dist/converse-headless.min.js
src/headless/dist/converse-headless.js: src webpack.common.js stamp-npm @converse/headless
npm run converse-headless.js
src/headless/dist/converse-headless.min.js: src webpack.common.js stamp-npm @converse/headless
npm run converse-headless.min.js
dist/converse-no-dependencies.js: src webpack.common.js stamp-npm @converse/headless
$(NPX) webpack --mode=development --type=nodeps
dist/converse-no-dependencies-es2015.js: src webpack.common.js stamp-npm @converse/headless
$(NPX) webpack --mode=development --type=nodeps --lang=es2015
@converse/headless: src/headless
......
This diff is collapsed.
......@@ -19,6 +19,7 @@
"clean": "rm -rf node_modules stamp-npm dist *.zip",
"converse-headless.js": "webpack --mode=development --type=headless",
"converse-headless.min.js": "npm run converse-headless.js && webpack --mode=production --type=headless",
"nodeps": "webpack --config webpack.nodeps.js",
"build": "webpack --config webpack.prod.js",
"lerna": "lerna bootstrap --hoist --ignore-scripts",
"prepare": "npm run lerna && npm run build"
......
......@@ -399,23 +399,28 @@ converse.plugins.add('converse-chatview', {
* @method _converse.ChatBoxView#addSpoilerButton
*/
async addSpoilerButton (options) {
__('1111')
if (!options.show_spoiler_button || this.model.get('type') === _converse.CHATROOMS_TYPE) {
return;
}
__('2222')
const contact_jid = this.model.get('jid');
if (this.model.presence.resources.length === 0) {
return;
}
__('3333')
const results = await Promise.all(
this.model.presence.resources.map(
r => _converse.api.disco.supports(Strophe.NS.SPOILER, `${contact_jid}/${r.get('name')}`)
)
);
__('4444')
const all_resources_support_spolers = results.reduce((acc, val) => (acc && val), true);
if (all_resources_support_spolers) {
const html = tpl_spoiler_button(this.model.toJSON());
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('afterBegin', html);
}
__('hello world')
},
insertHeading () {
......@@ -434,9 +439,9 @@ converse.plugins.add('converse-chatview', {
getToolbarOptions () {
let label_toggle_spoiler;
if (this.model.get('composing_spoiler')) {
label_toggle_spoiler = __('Click to write as a normal (non-spoiler) message');
label_toggle_spoiler = __("Click to write as a normal (non-spoiler) message");
} else {
label_toggle_spoiler = __('Click to write your message as a spoiler');
label_toggle_spoiler = __("Click to write your message as a spoiler");
}
return {
'label_clear': __('Clear all messages'),
......@@ -445,7 +450,7 @@ converse.plugins.add('converse-chatview', {
'message_limit': _converse.message_limit,
'show_call_button': _converse.visible_toolbar_buttons.call,
'show_spoiler_button': _converse.visible_toolbar_buttons.spoiler,
'tooltip_start_call': __('Start a call'),
'tooltip_start_call': __('Start a call')
}
},
......
......@@ -8,7 +8,6 @@
//
import * as strophe from 'strophe.js/src/core';
import Backbone from "backbone";
import Promise from "es6-promise/dist/es6-promise.auto";
import _ from "../lodash.noconflict";
import sizzle from "sizzle";
......
/* global module, __dirname */
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const common = require("./webpack.common.js");
const merge = require("webpack-merge");
const path = require('path');
module.exports = merge(common, {
mode: "production",
output: {
filename: 'converse-no-dependencies.js'
},
optimization: {
minimizer: []
},
plugins: [
new MiniCssExtractPlugin({filename: ''})
],
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: [
["@babel/preset-env", {
"targets": {
"browsers": ["ie 8"]
}
}]
]
}
}
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'sass-loader',
options: {
includePaths: [path.resolve(__dirname, 'node_modules/')]
}
}
]
}]
},
externals: [{
"backbone": "backbone",
"backbone.nativeview": "backbone.nativeview",
"backbone.vdomview": "backbone.vdomview",
"backbone.browserStorage": "backbone.browserStorage",
"backbone.overview": "backbone.overview",
"es6-promise": "es6-promise",
"formdata-polyfill": "formdata-polyfill",
"lodash": "lodash",
"lodash.converter": "lodash.converter",
"lodash.noconflict": "lodash.noconflict",
"strophe": "strophe",
"window": "window",
"filesize": "filesize",
"jed": "jed",
"sizzle": "sizzle",
"twemoji": "twemoji",
"urijs": "urijs"
}]
});
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