You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.9 KiB

  1. SHELL := /bin/bash
  2. DEVDB := postgres
  3. start: ## Start Wiki.js in production mode
  4. node wiki start
  5. stop: ## Stop Wiki.js
  6. node wiki stop
  7. restart: ## Restart Wiki.js
  8. node wiki restart
  9. dev-up: ## Start Wiki.js in development mode
  10. node wiki dev
  11. build: ## Build Wiki.js client assets
  12. webpack --profile --config dev/webpack/webpack.prod.js
  13. watch: ## Watch client files and rebuild assets on changes
  14. webpack --config dev/webpack/webpack.dev.js
  15. test: ## Run code linting tests
  16. eslint --format codeframe --ext .js,.vue .
  17. pug-lint server/views && jest
  18. docker-dev-up: ## Run dockerized dev environment
  19. docker-compose -f ./dev/docker-${DEVDB}/docker-compose.yml -p wiki --project-directory . up -d --remove-orphans
  20. docker-compose -f ./dev/docker-${DEVDB}/docker-compose.yml -p wiki --project-directory . exec wiki yarn dev
  21. docker-dev-down: ## Shutdown dockerized dev environment
  22. docker-compose -f ./dev/docker-${DEVDB}/docker-compose.yml -p wiki --project-directory . down
  23. docker-dev-rebuild: ## Rebuild dockerized dev image
  24. rm -rf ./node_modules
  25. docker-compose -f ./dev/docker-${DEVDB}/docker-compose.yml -p wiki --project-directory . build --no-cache --force-rm
  26. docker-dev-clean: ## Clean DB, redis and data folders
  27. rm -rf ./data
  28. [[ "${DEVDB}" == "postgres" ]] && docker-compose -f ./dev/docker-postgres/docker-compose.yml -p wiki --project-directory . exec db psql --dbname=wiki --username=wikijs --command='DROP SCHEMA IF EXISTS public CASCADE; CREATE SCHEMA public' || true
  29. [[ "${DEVDB}" == "mysql" || "${DEVDB}" == "mariadb" ]] && docker-compose -f ./dev/docker-${DEVDB}/docker-compose.yml -p wiki --project-directory . exec db mysql -uroot -p'wikijsrocks' -e 'DROP SCHEMA IF EXISTS wiki; CREATE SCHEMA wiki;' || true
  30. [[ "${DEVDB}" == "mssql" ]] && docker-compose -f ./dev/docker-mssql/docker-compose.yml -p wiki --project-directory . exec db /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'W1kiJSR0cks!' -Q 'DROP DATABASE IF EXISTS wiki; CREATE DATABASE wiki;' || true
  31. [[ "${DEVDB}" == "sqlite" ]] && docker-compose -f ./dev/docker-sqlite/docker-compose.yml -p wiki --project-directory . exec wiki rm -rf /wiki/db.sqlite || true
  32. docker-compose -f ./dev/docker-${DEVDB}/docker-compose.yml -p wiki --project-directory . exec redis redis-cli flushall
  33. docker-dev-bash: ## Rebuild dockerized dev image
  34. docker-compose -f ./dev/docker-${DEVDB}/docker-compose.yml -p wiki --project-directory . exec wiki bash
  35. docker-build: ## Run assets generation build in docker
  36. docker-compose -f ./dev/docker-${DEVDB}/docker-compose.yml -p wiki --project-directory . run wiki yarn build
  37. docker-compose -f ./dev/docker-${DEVDB}/docker-compose.yml -p wiki --project-directory . down
  38. help: ## Display help
  39. @echo ''
  40. @echo -e 'usage: \033[1mmake [command] [args...]\033[0m'
  41. @echo ''
  42. @echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
  43. @echo ''
  44. .PHONY: clean logs
  45. .DEFAULT_GOAL := help