This commit is contained in:
SamR1 2017-12-25 21:17:47 +01:00
parent b1fca3ab34
commit 4f70e5404f
4 changed files with 61 additions and 1 deletions

16
Makefile Normal file
View File

@ -0,0 +1,16 @@
include Makefile.config
-include Makefile.custom.config
.SILENT:
make-p:
# Launch all P targets in parallel and exit as soon as one exits.
set -m; (for p in $(P); do ($(MAKE) $$p || kill 0)& done; wait)
serve-python:
$(FLASK) run --with-threads -h $(HOST) -p $(API_PORT)
serve-react:
$(NPM) start
serve:
$(MAKE) P="serve-react serve-python" make-p

15
Makefile.config Normal file
View File

@ -0,0 +1,15 @@
HOST = 0.0.0.0
API_PORT = 5000
export REACT_APP_API_URL ?= http://$(HOST):$(API_PORT)/api/
export FLASK_APP ?= $(PWD)/mpwo_api/server.py
# Python env
PYTHON_VERSION ?= python
VENV = $(PWD)/mpwo_api/venv
PYTHON = $(VENV)/bin/python
FLASK = $(VENV)/bin/flask
# Node env
NODE_MODULES = $(PWD)/mpwo_client/node_modules
NPM ?= yarn --modules-folder mpwo_client/node_modules/

View File

@ -14,7 +14,7 @@
"redux-thunk": "^2.2.0"
},
"scripts": {
"start": "react-scripts start",
"start": "cd mpwo_client && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",

29
package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "mpwo_client",
"version": "0.1.0",
"private": true,
"dependencies": {
"history": "^4.7.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"react-scripts": "1.0.17",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0"
},
"scripts": {
"start": "cd mpwo_client && react-scripts start",
"build": "cd mpwo_client && react-scripts build",
"test": "cd mpwo_client && react-scripts test --env=jsdom",
"eject": "cd mpwo_client && react-scripts eject",
"lint": "cd mpwo_client && eslint --cache --ext .jsx --ext .js src"
},
"devDependencies": {
"babel-eslint": "^8.0.3",
"eslint": "^4.13.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-react": "^7.5.1"
}
}