xmpp.chapril.org-conversejs/Makefile

250 lines
7.8 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/
2017-06-13 12:22:02 +02:00
BUILDDIR = ./docs
2020-04-22 13:11:48 +02:00
KARMA ?= ./node_modules/.bin/karma
CLEANCSS ?= ./node_modules/clean-css-cli/bin/cleancss
ESLINT ?= ./node_modules/.bin/eslint
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
PAPER =
2018-09-04 11:39:27 +02:00
RJS ?= ./node_modules/.bin/r.js
NPX ?= ./node_modules/.bin/npx
SASS ?= ./node_modules/.bin/sass
2018-09-04 11:39:27 +02:00
SED ?= sed
SPHINXBUILD ?= ./bin/sphinx-build
SPHINXOPTS =
XGETTEXT = xgettext
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
2020-04-07 15:10:50 +02:00
all: node_modules 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 ""
2020-04-07 15:10:50 +02:00
@echo " all Set up dev environment and create all builds"
@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."
########################################################################
## Miscellaneous
.PHONY: serve
serve: node_modules dist
$(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
$(HTTPSERVE) -p $(HTTPSERVE_PORT) -c-1 -s &
########################################################################
## Translation machinery
2022-01-27 12:07:52 +01:00
dist/converse-no-dependencies.js: src webpack/webpack.common.js webpack/webpack.nodeps.js @converse/headless node_modules
npm run nodeps
2022-04-02 16:28:01 +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=9.1.0 dist/converse-no-dependencies.js -c
src/i18n/converse.pot: dist/converse-no-dependencies.js
$(GETTEXT) 2>&1 > /dev/null; exit $$?;
2019-09-11 17:42:09 +02:00
rm dist/converse-no-dependencies.js
rm dist/tmp.css
2013-04-26 21:01:39 +02:00
2020-04-13 14:45:41 +02:00
.PHONY: pot
pot: src/i18n/converse.pot
2020-04-13 14:45:41 +02:00
.PHONY: po
po:
find ./src/i18n -maxdepth 1 -mindepth 1 -type d -exec msgmerge {}/LC_MESSAGES/converse.po ./src/i18n/converse.pot -U \;
########################################################################
## Release management
.PHONY: release
release:
2021-09-03 15:28:35 +02:00
$(SED) -i '/^_converse.VERSION_NAME =/s/=.*/= "v$(VERSION)";/' src/headless/core.js
$(SED) -i '/Version:/s/:.*/: $(VERSION)/' COPYRIGHT
$(SED) -i '/Project-Id-Version:/s/:.*/: Converse.js $(VERSION)\n"/' src/i18n/converse.pot
$(SED) -i '/"version":/s/:.*/: "$(VERSION)",/' manifest.json
$(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 dist
2019-08-08 17:47:31 +02:00
npm pack
2021-03-31 14:30:56 +02:00
cd src/headless && npm pack
2018-10-29 22:28:28 +01:00
.PHONY: postrelease
postrelease:
2021-09-04 09:42:45 +02:00
$(SED) -i '/^_converse.VERSION_NAME =/s/=.*/= "v$(VERSION)dev";/' src/headless/core.js
########################################################################
## Install dependencies
2018-10-07 16:44:43 +02:00
$(LERNA):
npm install lerna
${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
2019-09-20 09:55:33 +02:00
package-lock.json: package.json
npm install
2020-04-07 15:10:50 +02:00
node_modules: $(LERNA) package.json package-lock.json src/headless/package.json src/headless/package-lock.json
npm run lerna
.PHONY: clean
clean:
npm run clean
rm -rf lib bin include parts
2013-04-26 21:01:39 +02:00
.PHONY: dev
2020-04-07 15:10:50 +02:00
dev: node_modules
npm run dev
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
dist/converse.js:: node_modules
npm run dev
2019-09-05 15:04:16 +02:00
dist/converse.css:: node_modules
npm run dev
2019-09-05 15:04:16 +02:00
dist/website.css:: node_modules src/shared/styles/website.scss
$(SASS) --load-path=$(BOOTSTRAP) src/shared/styles/website.scss $@
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 > $@
.PHONY: watch
2020-04-07 15:10:50 +02:00
watch: node_modules
npm run watch
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) $@
@converse/headless: src/headless
2022-01-27 12:07:52 +01:00
src/headless/dist/converse-headless.js: src webpack/webpack.common.js node_modules @converse/headless
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
npm run headless
dist:: node_modules src/* | dist/converse.js dist/converse.css dist/website.css dist/website.min.css src/headless/dist/converse-headless.min.js src/headless/dist/converse-headless.js
npm run prod
.PHONY: install
install:: dist
.PHONY: cdn
2020-04-07 15:10:50 +02:00
cdn:: node_modules
npm run cdn
2018-11-13 16:06:11 +01:00
########################################################################
## Tests
.PHONY: eslint
2020-04-07 15:10:50 +02:00
eslint: node_modules
$(ESLINT) src/*.js
$(ESLINT) src/utils/*.js
$(ESLINT) src/headless/*.js
$(ESLINT) src/headless/utils/*.js
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
2020-04-22 13:11:48 +02:00
$(KARMA) start karma.conf.js $(ARGS)
.PHONY: test
test:
$(KARMA) start karma.conf.js $(ARGS)
########################################################################
## Documentation
./bin/activate:
python3 -m venv .
.installed.cfg: requirements.txt buildout.cfg
./bin/pip install -r requirements.txt
2022-04-02 20:32:34 +02:00
./bin/pip install --upgrade pip==21.3.1
./bin/pip install --upgrade setuptools==51.3.3
./bin/buildout -v
docsdev: ./bin/activate .installed.cfg
.PHONY: html
html: doc
.PHONY: doc
2020-04-07 15:10:50 +02:00
doc: node_modules 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:
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