xmpp.chapril.org-conversejs/Makefile

252 lines
8.7 KiB
Makefile
Raw Normal View History

2013-04-26 21:01:39 +02:00
# You can set these variables from the command line.
BABEL ?= node_modules/.bin/babel
2018-10-07 16:44:43 +02:00
BOOTSTRAP = ./node_modules/
BOURBON = ./node_modules/bourbon/app/assets/stylesheets/
2017-06-13 12:22:02 +02:00
BUILDDIR = ./docs
CHROMIUM ?= ./node_modules/.bin/run-headless-chromium
CLEANCSS ?= ./node_modules/clean-css-cli/bin/cleancss --skip-rebase
ESLINT ?= ./node_modules/.bin/eslint
2017-06-13 12:22:02 +02:00
HTTPSERVE ?= ./node_modules/.bin/http-server
2018-09-04 11:39:27 +02:00
HTTPSERVE_PORT ?= 8000
INKSCAPE ?= inkscape
INSTALL ?= install
JSDOC ?= ./node_modules/.bin/jsdoc
2018-10-07 16:44:43 +02:00
LERNA ?= ./node_modules/.bin/lerna
OXIPNG ?= oxipng
2017-06-13 12:22:02 +02:00
PAPER =
PO2JSON ?= ./node_modules/.bin/po2json
2018-09-04 11:39:27 +02:00
RJS ?= ./node_modules/.bin/r.js
NPX ?= ./node_modules/.bin/npx
2018-10-28 17:23:10 +01:00
SASS ?= ./node_modules/.bin/node-sass
2018-09-04 11:39:27 +02:00
SED ?= sed
SPHINXBUILD ?= ./bin/sphinx-build
2017-06-13 12:22:02 +02:00
SPHINXOPTS =
UGLIFYJS ?= node_modules/.bin/uglifyjs
2017-12-05 18:35:01 +01:00
2013-04-26 21:01:39 +02:00
# Internal variables.
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source
VERSION_FORMAT = [0-9]+\.[0-9]+\.[0-9]+
2013-04-26 21:01:39 +02:00
.PHONY: all
all: dev dist
.PHONY: help
2013-04-26 21:01:39 +02:00
help:
@echo "Please use \`make <target>' where <target> is one of the following:"
@echo ""
@echo " all Set up dev environment and create all builds"
@echo " build Create minified builds of converse.js and all its dependencies."
2018-10-28 17:23:10 +01:00
@echo " clean Remove all NPM packages."
@echo " check Run all tests."
@echo " css Generate CSS from the Sass files."
@echo " dev Set up the development environment. To force a fresh start, run 'make clean' first."
@echo " html Make standalone HTML files of the documentation."
@echo " po Generate gettext PO files for each i18n language."
@echo " po2json Generate JSON files from the language PO files."
@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 " stamp-npm 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."
########################################################################
## Miscellaneous
.PHONY: serve
2019-04-23 10:08:05 +02:00
serve: stamp-npm
$(HTTPSERVE) -p $(HTTPSERVE_PORT) -c-1
2017-06-13 12:22:02 +02:00
.PHONY: serve_bg
2019-04-23 10:08:05 +02:00
serve_bg: stamp-npm
$(HTTPSERVE) -p $(HTTPSERVE_PORT) -c-1 -s &
########################################################################
## Translation machinery
2019-04-04 12:33:08 +02:00
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=4.2.0 -c
.PHONY: pot
pot: dist/converse-no-dependencies-es2015.js
$(GETTEXT) 2>&1 > /dev/null; exit $$?;
2013-04-26 21:01:39 +02:00
.PHONY: po
po:
find ./locale -maxdepth 1 -mindepth 1 -type d -exec msgmerge {}/LC_MESSAGES/converse.po ./locale/converse.pot -U \;
.PHONY: po2json
2013-09-15 22:16:16 +02:00
po2json:
2018-01-05 12:47:50 +01:00
find ./locale -maxdepth 1 -mindepth 1 -type d -exec $(PO2JSON) -f jed1.x -d converse {}/LC_MESSAGES/converse.po {}/LC_MESSAGES/converse.json \;
2013-09-15 22:16:16 +02:00
########################################################################
## Release management
.PHONY: release
release:
$(SED) -i '/^_converse.VERSION_NAME =/s/=.*/= "v$(VERSION)";/' src/headless/converse-core.js
$(SED) -i '/Version:/s/:.*/: $(VERSION)/' COPYRIGHT
$(SED) -i '/Project-Id-Version:/s/:.*/: Converse.js $(VERSION)\n"/' locale/converse.pot
$(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
$(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
make po2json
2014-08-04 23:09:14 +02:00
make build
npm run pack
2018-10-29 22:28:28 +01:00
########################################################################
## Install dependencies
2018-10-07 16:44:43 +02:00
$(LERNA):
npm install lerna
stamp-npm: $(LERNA) package.json package-lock.json src/headless/package.json
npm run lerna
2018-03-17 19:54:01 +01:00
touch stamp-npm
.PHONY: clean
clean:
npm run clean
rm -r lib bin include parts
2013-04-26 21:01:39 +02:00
.PHONY: dev
2018-10-28 17:23:10 +01:00
dev: stamp-npm
2014-05-07 22:36:45 +02:00
########################################################################
## Builds
.PHONY: css
2019-05-10 11:18:17 +02:00
css: sass/*.scss dist/converse.css dist/converse.min.css dist/website.css dist/website.min.css dist/font-awesome.css
2017-06-13 21:07:42 +02:00
2019-05-10 11:18:17 +02:00
dist/website.css:: stamp-npm sass
2018-12-04 13:15:30 +01:00
$(SASS) --source-map true --include-path $(BOURBON) --include-path $(BOOTSTRAP) sass/website.scss $@
dist/website.min.css:: stamp-npm dist/website.css
2019-06-12 06:45:00 +02:00
$(CLEANCSS) dist/website.css > $@
2019-05-10 11:18:17 +02:00
dist/font-awesome.css:: stamp-npm sass
2018-12-04 13:15:30 +01:00
$(SASS) --source-map true --include-path $(BOURBON) --include-path $(BOOTSTRAP) sass/font-awesome.scss $@
dist/converse.css:: stamp-npm webpack.config.js sass
npm run converse.css
2019-05-10 11:18:17 +02:00
dist/converse.min.css:: stamp-npm dist/converse.css
npm run converse.min.css
2019-04-23 10:08:05 +02:00
.PHONY: watchcss
2019-05-10 11:18:17 +02:00
watchcss: stamp-npm
2019-04-23 10:08:05 +02:00
$(NPX) webpack --type=css --mode=development --watch
.PHONY: watchjs
2019-04-23 10:08:05 +02:00
watchjs: stamp-npm src/headless/dist/converse-headless.js
$(NPX) webpack --mode=development --watch
2018-10-23 03:41:38 +02:00
.PHONY: watchjsheadless
2019-04-23 10:08:05 +02:00
watchjsheadless: stamp-npm
$(NPX) webpack --mode=development --watch --type=headless
2018-10-23 03:41:38 +02:00
.PHONY: watch
2019-04-23 10:08:05 +02:00
watch: stamp-npm
make -j 3 watchcss watchjsheadless watchjs
2018-03-30 13:30:50 +02:00
.PHONY: logo
logo: logo/conversejs-transparent16.png \
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) $@
BUILDS = dist/converse.js \
dist/converse.min.js \
src/headless/dist/converse-headless.js \
src/headless/dist/converse-headless.min.js \
dist/converse-no-dependencies.min.js \
dist/converse-no-dependencies.js \
dist/converse-no-dependencies-es2015.js
2018-10-07 16:44:43 +02:00
dist/converse.js: src webpack.config.js stamp-npm @converse/headless
npm run converse.js
2018-10-07 16:44:43 +02:00
dist/converse.min.js: src webpack.config.js stamp-npm @converse/headless
npm run converse.min.js
src/headless/dist/converse-headless.js: src webpack.config.js stamp-npm @converse/headless
npm run converse-headless.js
src/headless/dist/converse-headless.min.js: src webpack.config.js stamp-npm @converse/headless
npm run converse-headless.min.js
2018-10-07 16:44:43 +02:00
dist/converse-no-dependencies.js: src webpack.config.js stamp-npm @converse/headless
$(NPX) webpack --mode=development --type=nodeps
2018-10-07 16:44:43 +02:00
dist/converse-no-dependencies.min.js: src webpack.config.js stamp-npm @converse/headless
$(NPX) webpack --mode=production --type=nodeps
2018-10-07 16:44:43 +02:00
dist/converse-no-dependencies-es2015.js: src webpack.config.js stamp-npm @converse/headless
$(NPX) webpack --mode=development --type=nodeps --lang=es2015
@converse/headless: src/headless
.PHONY: dist
dist:: build
.PHONY: build
2019-04-23 10:08:05 +02:00
build:: stamp-npm css $(BUILDS)
2018-11-13 16:06:11 +01:00
########################################################################
## Tests
.PHONY: eslint
2018-03-17 19:54:01 +01:00
eslint: stamp-npm
$(ESLINT) src/*.js
$(ESLINT) src/utils/*.js
$(ESLINT) src/headless/*.js
$(ESLINT) src/headless/utils/*.js
$(ESLINT) spec/
2016-05-23 21:21:42 +02:00
.PHONY: check
2019-05-10 11:18:17 +02:00
check: eslint dist/converse.js
2019-02-01 15:22:45 +01:00
LOG_CR_VERBOSITY=INFO $(CHROMIUM) --disable-gpu --no-sandbox http://localhost:$(HTTPSERVE_PORT)/tests/index.html
########################################################################
## Documentation
./bin/activate:
python3.7 -m venv .
.installed.cfg: requirements.txt buildout.cfg
./bin/pip install -r requirements.txt
./bin/pip install --upgrade pip==19.2.1
./bin/pip install --upgrade setuptools==41.0.1
./bin/buildout -v
docsdev: ./bin/activate .installed.cfg
.PHONY: html
2019-04-23 10:08:05 +02:00
html: stamp-npm docsdev apidoc
rm -rf $(BUILDDIR)/html
2013-04-26 21:01:39 +02:00
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
make apidoc
2013-04-26 21:01:39 +02:00
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
PHONY: apidoc
apidoc:
$(JSDOC) --private --readme docs/source/jsdoc_intro.md -c docs/source/conf.json -d docs/html/api src/*.js src/utils/*.js src/headless/*.js src/headless/utils/*.js