2013-04-26 21:01:39 +02:00
|
|
|
# You can set these variables from the command line.
|
2018-10-07 16:44:43 +02:00
|
|
|
BOOTSTRAP = ./node_modules/
|
2017-06-13 12:22:02 +02:00
|
|
|
BUILDDIR = ./docs
|
2020-04-22 13:11:48 +02:00
|
|
|
KARMA ?= ./node_modules/.bin/karma
|
2021-07-15 12:47:19 +02:00
|
|
|
CLEANCSS ?= ./node_modules/clean-css-cli/bin/cleancss
|
2019-09-04 15:21:00 +02:00
|
|
|
HTTPSERVE ?= ./node_modules/.bin/http-server
|
2018-09-04 11:39:27 +02:00
|
|
|
HTTPSERVE_PORT ?= 8000
|
2018-06-14 10:22:16 +02:00
|
|
|
INKSCAPE ?= inkscape
|
2019-09-04 15:21:00 +02:00
|
|
|
INSTALL ?= install
|
|
|
|
JSDOC ?= ./node_modules/.bin/jsdoc
|
2018-06-14 10:22:16 +02:00
|
|
|
OXIPNG ?= oxipng
|
2019-09-04 15:21:00 +02:00
|
|
|
PAPER =
|
2018-09-04 11:39:27 +02:00
|
|
|
RJS ?= ./node_modules/.bin/r.js
|
2018-10-29 21:42:26 +01:00
|
|
|
NPX ?= ./node_modules/.bin/npx
|
2021-04-14 22:56:59 +02:00
|
|
|
SASS ?= ./node_modules/.bin/sass
|
2018-09-04 11:39:27 +02:00
|
|
|
SED ?= sed
|
2018-05-11 13:31:48 +02:00
|
|
|
SPHINXBUILD ?= ./bin/sphinx-build
|
2019-09-04 15:21:00 +02:00
|
|
|
SPHINXOPTS =
|
2019-08-23 17:09:39 +02:00
|
|
|
XGETTEXT = xgettext
|
2014-03-17 21:37:40 +01:00
|
|
|
|
2017-12-05 18:35:01 +01:00
|
|
|
|
2013-04-26 21:01:39 +02:00
|
|
|
# Internal variables.
|
2019-09-04 15:21:00 +02:00
|
|
|
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source
|
2019-01-15 17:59:56 +01:00
|
|
|
VERSION_FORMAT = [0-9]+\.[0-9]+\.[0-9]+
|
2013-04-26 21:01:39 +02:00
|
|
|
|
2016-03-29 08:56:13 +02:00
|
|
|
.PHONY: all
|
2020-04-07 15:10:50 +02:00
|
|
|
all: node_modules dist
|
2016-03-29 08:56:13 +02:00
|
|
|
|
2015-09-25 21:39:47 +02:00
|
|
|
.PHONY: help
|
2013-04-26 21:01:39 +02:00
|
|
|
help:
|
2015-04-26 09:38:23 +02:00
|
|
|
@echo "Please use \`make <target>' where <target> is one of the following:"
|
|
|
|
@echo ""
|
2020-04-07 15:10:50 +02:00
|
|
|
@echo " all Set up dev environment and create all builds"
|
2020-04-21 14:22:36 +02:00
|
|
|
@echo " dist Create minified builds of converse.js and all its dependencies."
|
2020-04-07 15:10:50 +02:00
|
|
|
@echo " clean Remove all NPM packages."
|
|
|
|
@echo " check Run all tests."
|
|
|
|
@echo " dev Set up the development environment and build unminified resources. To force a fresh start, run 'make clean' first."
|
|
|
|
@echo " devserver Set up the development environment and start the webpack dev server."
|
|
|
|
@echo " doc Make standalone HTML files of the documentation."
|
|
|
|
@echo " po Generate gettext PO files for each i18n language."
|
|
|
|
@echo " pot Generate a gettext POT file to be used for translations."
|
|
|
|
@echo " release Prepare a new release of converse.js. E.g. make release VERSION=0.9.5"
|
|
|
|
@echo " serve Serve this directory via a webserver on port 8000."
|
|
|
|
@echo " serve_bg Same as \"serve\", but do it in the background"
|
|
|
|
@echo " node_modules Install NPM dependencies"
|
|
|
|
@echo " watch Watch for changes on JS and scss files and automatically update the generated files."
|
|
|
|
@echo " logo Generate PNG logos of multiple sizes."
|
2015-09-25 21:39:47 +02:00
|
|
|
|
2015-02-05 15:57:39 +01:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
## Miscellaneous
|
|
|
|
|
2015-09-25 21:39:47 +02:00
|
|
|
.PHONY: serve
|
2020-09-18 11:19:44 +02:00
|
|
|
serve: node_modules dist
|
2017-12-05 18:46:22 +01:00
|
|
|
$(HTTPSERVE) -p $(HTTPSERVE_PORT) -c-1
|
2017-06-13 12:22:02 +02:00
|
|
|
|
|
|
|
.PHONY: serve_bg
|
2020-04-07 15:10:50 +02:00
|
|
|
serve_bg: node_modules
|
2017-12-05 18:46:22 +01:00
|
|
|
$(HTTPSERVE) -p $(HTTPSERVE_PORT) -c-1 -s &
|
2013-06-01 13:17:52 +02:00
|
|
|
|
2023-06-09 20:37:27 +02:00
|
|
|
certs:
|
|
|
|
mkdir certs
|
|
|
|
cd certs && openssl req -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out chat.example.org.crt -keyout chat.example.org.key
|
|
|
|
|
2014-04-18 17:47:47 +02:00
|
|
|
########################################################################
|
|
|
|
## Translation machinery
|
|
|
|
|
2023-08-31 21:00:52 +02:00
|
|
|
GETTEXT = $(XGETTEXT) --from-code=UTF-8 --language=JavaScript --keyword=__ --keyword=___ --keyword=i18n_ --force-po --output=src/i18n/converse.pot --package-name=Converse.js --copyright-holder="Jan-Carel Brand" --package-version=10.1.6 dist/converse-no-dependencies.js -c
|
2016-02-08 09:58:57 +01:00
|
|
|
|
2020-08-16 22:53:24 +02:00
|
|
|
src/i18n/converse.pot: dist/converse-no-dependencies.js
|
2017-08-23 11:56:40 +02:00
|
|
|
$(GETTEXT) 2>&1 > /dev/null; exit $$?;
|
2019-09-11 17:42:09 +02:00
|
|
|
rm dist/converse-no-dependencies.js
|
2021-06-25 10:38:38 +02:00
|
|
|
rm dist/tmp.css
|
2013-04-26 21:01:39 +02:00
|
|
|
|
2020-04-13 14:45:41 +02:00
|
|
|
.PHONY: pot
|
2020-08-16 22:53:24 +02:00
|
|
|
pot: src/i18n/converse.pot
|
2020-04-13 14:45:41 +02:00
|
|
|
|
2015-09-25 21:39:47 +02:00
|
|
|
.PHONY: po
|
2014-03-14 19:27:44 +01:00
|
|
|
po:
|
2020-08-16 22:53:24 +02:00
|
|
|
find ./src/i18n -maxdepth 1 -mindepth 1 -type d -exec msgmerge {}/LC_MESSAGES/converse.po ./src/i18n/converse.pot -U \;
|
2013-09-12 11:14:45 +02:00
|
|
|
|
2014-04-18 17:47:47 +02:00
|
|
|
########################################################################
|
|
|
|
## Release management
|
|
|
|
|
2023-06-29 09:48:30 +02:00
|
|
|
.PHONY: version
|
|
|
|
version:
|
2023-03-02 12:18:26 +01:00
|
|
|
$(SED) -i '/^export const VERSION_NAME =/s/=.*/= "v$(VERSION)";/' src/headless/shared/constants.js
|
2019-01-15 17:59:56 +01:00
|
|
|
$(SED) -i '/Version:/s/:.*/: $(VERSION)/' COPYRIGHT
|
2020-08-16 22:53:24 +02:00
|
|
|
$(SED) -i '/Project-Id-Version:/s/:.*/: Converse.js $(VERSION)\n"/' src/i18n/converse.pot
|
2020-03-03 15:21:48 +01:00
|
|
|
$(SED) -i '/"version":/s/:.*/: "$(VERSION)",/' manifest.json
|
2019-01-15 17:59:56 +01:00
|
|
|
$(SED) -i '/"version":/s/:.*/: "$(VERSION)",/' package.json
|
|
|
|
$(SED) -i '/"version":/s/:.*/: "$(VERSION)",/' src/headless/package.json
|
|
|
|
$(SED) -ri 's/--package-version=$(VERSION_FORMAT)/--package-version=$(VERSION)/' Makefile
|
|
|
|
$(SED) -i -e "/version =/s/=.*/= '$(VERSION)'/" -e "/release =/s/=.*/= '$(VERSION)'/" docs/source/conf.py
|
|
|
|
$(SED) -i "s/[Uu]nreleased/`date +%Y-%m-%d`/" CHANGES.md
|
|
|
|
$(SED) -ri 's,cdn.conversejs.org/$(VERSION_FORMAT),cdn.conversejs.org/$(VERSION),' docs/source/quickstart.rst
|
2019-05-10 12:35:30 +02:00
|
|
|
$(SED) -ri 's,cdn.conversejs.org/$(VERSION_FORMAT),cdn.conversejs.org/$(VERSION),' *.html
|
|
|
|
$(SED) -ri 's,cdn.conversejs.org/$(VERSION_FORMAT),cdn.conversejs.org/$(VERSION),' demo/*.html
|
2014-08-25 14:39:32 +02:00
|
|
|
make pot
|
|
|
|
make po
|
2020-04-21 14:22:36 +02:00
|
|
|
make dist
|
2023-06-25 10:44:31 +02:00
|
|
|
|
2023-06-29 09:48:30 +02:00
|
|
|
release-checkout:
|
|
|
|
git clone git@github.com:conversejs/converse.js.git --depth 1 --branch $(BRANCH) release-$(BRANCH)
|
|
|
|
cd release-$(BRANCH) && make dist
|
|
|
|
|
2023-06-25 10:44:31 +02:00
|
|
|
.PHONY: publish
|
|
|
|
publish:
|
2023-06-29 09:48:30 +02:00
|
|
|
make release-checkout
|
|
|
|
cd release-$(BRANCH) && npm pack && npm publish
|
|
|
|
cd release-$(BRANCH)/src/headless && npm pack && npm publish
|
|
|
|
find ./release-$(BRANCH)/ -name "converse.js-*.tgz" -exec mv {} . \;
|
|
|
|
find ./release-$(BRANCH)/src/headless -name "converse-headless-*.tgz" -exec mv {} . \;
|
|
|
|
rm -rf release-$(BRANCH)
|
2018-10-29 22:28:28 +01:00
|
|
|
|
2019-07-25 13:45:21 +02:00
|
|
|
.PHONY: postrelease
|
|
|
|
postrelease:
|
2023-06-23 10:39:32 +02:00
|
|
|
$(SED) -i '/^export const VERSION_NAME =/s/=.*/= "v$(VERSION)dev";/' src/headless/shared/constants.js
|
2019-07-25 13:45:21 +02:00
|
|
|
|
2023-02-17 12:14:48 +01:00
|
|
|
.PHONY: deploy
|
|
|
|
deploy:
|
2023-06-25 11:22:16 +02:00
|
|
|
git clone --branch v$(VERSION) git@github.com:conversejs/converse.js.git --depth 1 $(VERSION)
|
2023-02-17 12:14:48 +01:00
|
|
|
cd $(VERSION) && make node && ASSET_PATH=https://cdn.conversejs.org/$(VERSION)/dist/ make dist && make doc
|
|
|
|
cd .. && git pull && make node && ASSET_PATH=https://cdn.conversejs.org/dist/ make dist && make doc
|
|
|
|
|
2014-04-18 17:39:45 +02:00
|
|
|
########################################################################
|
|
|
|
## Install dependencies
|
|
|
|
|
2021-07-15 12:47:19 +02:00
|
|
|
${NVM_DIR}/nvm.sh:
|
|
|
|
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
|
|
|
|
source ~/.bashrc
|
|
|
|
|
|
|
|
.PHONY: nvm
|
|
|
|
nvm: ${NVM_DIR}/nvm.sh
|
|
|
|
|
|
|
|
.PHONY: node
|
|
|
|
node: .nvmrc
|
|
|
|
. $(HOME)/.nvm/nvm.sh && nvm install
|
|
|
|
|
2023-06-09 11:23:56 +02:00
|
|
|
node_modules: package.json src/headless/package.json
|
2019-09-20 09:55:33 +02:00
|
|
|
npm install
|
|
|
|
|
2015-09-25 21:39:47 +02:00
|
|
|
.PHONY: clean
|
2016-02-27 16:57:30 +01:00
|
|
|
clean:
|
2019-05-10 11:42:40 +02:00
|
|
|
npm run clean
|
2019-07-30 14:59:28 +02:00
|
|
|
rm -rf lib bin include parts
|
2013-04-26 21:01:39 +02:00
|
|
|
|
2015-09-25 21:39:47 +02:00
|
|
|
.PHONY: dev
|
2020-04-07 15:10:50 +02:00
|
|
|
dev: node_modules
|
2019-09-05 14:07:25 +02:00
|
|
|
npm run dev
|
2014-04-18 17:39:45 +02:00
|
|
|
|
2019-09-05 15:04:16 +02:00
|
|
|
.PHONY: devserver
|
2020-04-07 15:10:50 +02:00
|
|
|
devserver: node_modules
|
2019-09-05 15:04:16 +02:00
|
|
|
npm run serve
|
|
|
|
|
2014-05-07 22:36:45 +02:00
|
|
|
########################################################################
|
|
|
|
## Builds
|
|
|
|
|
2023-06-29 09:48:30 +02:00
|
|
|
dist/converse-no-dependencies.js: src webpack/webpack.common.js webpack/webpack.nodeps.js @converse/headless node_modules
|
|
|
|
npm run nodeps
|
|
|
|
|
2020-04-21 14:22:36 +02:00
|
|
|
dist/converse.js:: node_modules
|
2022-05-05 07:03:23 +02:00
|
|
|
npm run build
|
2019-09-05 15:04:16 +02:00
|
|
|
|
2020-04-21 14:22:36 +02:00
|
|
|
dist/converse.css:: node_modules
|
2022-05-05 07:03:23 +02:00
|
|
|
npm run build
|
2019-09-05 15:04:16 +02:00
|
|
|
|
2021-06-10 10:07:19 +02:00
|
|
|
dist/website.css:: node_modules src/shared/styles/website.scss
|
2021-04-14 22:56:59 +02:00
|
|
|
$(SASS) --load-path=$(BOOTSTRAP) src/shared/styles/website.scss $@
|
2018-05-15 09:38:20 +02:00
|
|
|
|
2020-04-07 15:10:50 +02:00
|
|
|
dist/website.min.css:: node_modules dist/website.css
|
2019-06-12 06:45:00 +02:00
|
|
|
$(CLEANCSS) dist/website.css > $@
|
2019-05-10 11:42:40 +02:00
|
|
|
|
2018-10-06 06:59:04 +02:00
|
|
|
.PHONY: watch
|
2020-04-07 15:10:50 +02:00
|
|
|
watch: node_modules
|
2019-09-04 18:58:10 +02:00
|
|
|
npm run watch
|
2018-10-06 06:59:04 +02:00
|
|
|
|
2018-03-30 13:30:50 +02:00
|
|
|
.PHONY: logo
|
|
|
|
logo: logo/conversejs-transparent16.png \
|
2019-09-04 15:21:00 +02:00
|
|
|
logo/conversejs-transparent19.png \
|
|
|
|
logo/conversejs-transparent48.png \
|
|
|
|
logo/conversejs-transparent128.png \
|
|
|
|
logo/conversejs-transparent512.png \
|
|
|
|
logo/conversejs-filled16.png \
|
|
|
|
logo/conversejs-filled19.png \
|
|
|
|
logo/conversejs-filled48.png \
|
|
|
|
logo/conversejs-filled128.png \
|
|
|
|
logo/conversejs-filled512.png \
|
2018-03-30 13:30:50 +02:00
|
|
|
|
|
|
|
logo/conversejs-transparent%.png:: logo/conversejs-transparent.svg
|
|
|
|
$(INKSCAPE) -e $@ -w $* $<
|
|
|
|
$(OXIPNG) $@
|
|
|
|
|
|
|
|
logo/conversejs-filled%.png:: logo/conversejs-filled.svg
|
|
|
|
$(INKSCAPE) -e $@ -w $* $<
|
|
|
|
$(OXIPNG) $@
|
|
|
|
|
2019-09-11 17:18:11 +02:00
|
|
|
@converse/headless: src/headless
|
2018-06-04 12:07:49 +02:00
|
|
|
|
2022-01-27 12:07:52 +01:00
|
|
|
src/headless/dist/converse-headless.js: src webpack/webpack.common.js node_modules @converse/headless
|
2022-01-27 11:51:40 +01:00
|
|
|
npm run headless-dev
|
|
|
|
|
2022-01-27 12:07:52 +01:00
|
|
|
src/headless/dist/converse-headless.min.js: src webpack/webpack.common.js node_modules @converse/headless
|
2019-09-13 13:29:49 +02:00
|
|
|
npm run headless
|
2019-08-23 17:09:39 +02:00
|
|
|
|
2023-06-29 23:09:49 +02:00
|
|
|
dist:: node_modules src/* | dist/website.css dist/website.min.css
|
2022-05-05 07:03:23 +02:00
|
|
|
npm run headless
|
2023-06-30 06:38:40 +02:00
|
|
|
# Ideally this should just be `npm run build`.
|
|
|
|
# The additional steps are necessary to properly generate JSON chunk files
|
|
|
|
# from the .po files. The nodeps config uses preset-env with IE11.
|
|
|
|
# Somehow this is necessary.
|
2023-06-29 23:09:49 +02:00
|
|
|
npm run nodeps
|
2023-06-30 06:38:40 +02:00
|
|
|
$(eval TMPD := $(shell mktemp -d))
|
|
|
|
mv dist/locales $(TMPD) && \
|
|
|
|
npm run build && \
|
|
|
|
mv $(TMPD)/locales/*-po.js dist/locales/ && \
|
|
|
|
rm -rf $(TMPD)
|
2019-09-13 13:29:49 +02:00
|
|
|
|
2020-04-20 18:49:02 +02:00
|
|
|
.PHONY: install
|
2020-04-21 14:22:36 +02:00
|
|
|
install:: dist
|
2020-04-20 18:49:02 +02:00
|
|
|
|
2019-09-13 13:29:49 +02:00
|
|
|
.PHONY: cdn
|
2020-04-07 15:10:50 +02:00
|
|
|
cdn:: node_modules
|
2019-09-13 13:29:49 +02:00
|
|
|
npm run cdn
|
2018-11-13 16:06:11 +01:00
|
|
|
|
2023-02-23 07:03:50 +01:00
|
|
|
.PHONY: types
|
|
|
|
types:: node_modules
|
|
|
|
npm run types
|
|
|
|
|
2014-04-18 17:39:45 +02:00
|
|
|
########################################################################
|
|
|
|
## Tests
|
|
|
|
|
2017-01-26 15:49:02 +01:00
|
|
|
.PHONY: eslint
|
2020-04-07 15:10:50 +02:00
|
|
|
eslint: node_modules
|
2023-06-02 07:31:47 +02:00
|
|
|
npm run lint
|
2017-01-26 15:49:02 +01:00
|
|
|
|
2016-05-23 21:21:42 +02:00
|
|
|
.PHONY: check
|
2020-09-18 21:36:33 +02:00
|
|
|
check: eslint | dist/converse.js dist/converse.css
|
2023-06-02 21:01:05 +02:00
|
|
|
npm run test -- $(ARGS)
|
2020-04-22 13:11:48 +02:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
2023-06-02 21:01:05 +02:00
|
|
|
npm run test -- $(ARGS)
|
2014-04-18 17:39:45 +02:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
## Documentation
|
|
|
|
|
2018-12-19 11:01:25 +01:00
|
|
|
./bin/activate:
|
2020-06-10 12:30:52 +02:00
|
|
|
python3 -m venv .
|
2018-12-19 11:01:25 +01:00
|
|
|
|
2022-06-11 20:17:19 +02:00
|
|
|
.PHONY: docsdev
|
|
|
|
docsdev: ./bin/activate requirements.txt
|
2022-04-02 20:32:34 +02:00
|
|
|
./bin/pip install --upgrade pip==21.3.1
|
2022-06-11 20:17:19 +02:00
|
|
|
./bin/pip install -r requirements.txt
|
2018-12-19 11:01:25 +01:00
|
|
|
|
2015-09-25 21:39:47 +02:00
|
|
|
.PHONY: html
|
2019-11-22 12:57:51 +01:00
|
|
|
html: doc
|
|
|
|
|
|
|
|
.PHONY: doc
|
2020-04-07 15:10:50 +02:00
|
|
|
doc: node_modules docsdev apidoc
|
2014-12-07 10:48:32 +01:00
|
|
|
rm -rf $(BUILDDIR)/html
|
2013-04-26 21:01:39 +02:00
|
|
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
2018-08-01 12:08:18 +02:00
|
|
|
make apidoc
|
2013-04-26 21:01:39 +02:00
|
|
|
@echo
|
|
|
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
2018-05-11 13:31:48 +02:00
|
|
|
|
2018-11-13 12:59:35 +01:00
|
|
|
PHONY: apidoc
|
2018-05-11 13:31:48 +02:00
|
|
|
apidoc:
|
2021-09-14 15:04:12 +02:00
|
|
|
find ./src -type d -name node_modules -prune -false -o -name "*.js" | xargs $(JSDOC) --private --readme docs/source/jsdoc_intro.md -c docs/source/conf.json -d docs/html/api
|