feat: added Makefile + npm scripts for docker dev

This commit is contained in:
Nicolas Giard 2018-08-28 21:07:01 -04:00
parent 2483dce941
commit 23f07381c2
2 changed files with 54 additions and 2 deletions

47
Makefile Normal file
View File

@ -0,0 +1,47 @@
SHELL := /bin/bash
start: ## Start Wiki.js in production mode
node wiki start
stop: ## Stop Wiki.js
node wiki stop
restart: ## Restart Wiki.js
node wiki restart
dev: ## Start Wiki.js in development mode
node wiki dev
build: ## Build Wiki.js client assets
webpack --profile --config dev/webpack/webpack.prod.js
watch: ## Watch client files and rebuild assets on changes
webpack --config dev/webpack/webpack.dev.js
test: ## Run code linting tests
eslint --format codeframe --ext .js,.vue .
pug-lint server/views && jest
docker-dev-up: ## Run dockerized dev environment
docker-compose up -d
docker-compose exec wiki yarn dev
docker-dev-down: ## Shutdown dockerized dev environment
docker-compose down
docker-dev-rebuild: ## Rebuild dockerized dev image
docker-compose build
docker-build: ## Run assets generation build in docker
docker-compose run wiki yarn build
docker-compose down
help: ## Display help
@echo ''
@echo -e 'usage: \033[1mmake [command] [args...]\033[0m'
@echo ''
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
@echo ''
.PHONY: clean logs
.DEFAULT_GOAL := help

View File

@ -10,7 +10,11 @@
"dev": "node wiki dev",
"build": "webpack --profile --config dev/webpack/webpack.prod.js",
"watch": "webpack --config dev/webpack/webpack.dev.js",
"test": "eslint --format codeframe --ext .js,.vue . && pug-lint server/views && jest"
"test": "eslint --format codeframe --ext .js,.vue . && pug-lint server/views && jest",
"docker:dev:up": "docker-compose up -d && docker-compose exec wiki yarn dev",
"docker:dev:down": "docker-compose down",
"docker:dev:rebuild": "docker-compose build",
"docker:build": "docker-compose run wiki yarn build && docker-compose down"
},
"bin": {
"wiki": "wiki.js"
@ -25,7 +29,8 @@
"docs",
"documentation",
"markdown",
"guides"
"guides",
"knowledge base"
],
"author": "Nicolas Giard",
"license": "AGPL-3.0",