Browse Source

feat(generate): add makefile to generate code

pull/16/head
Pierre-Louis Guhur 3 years ago
parent
commit
a4fa0bd801
  1. 1
      .gitignore
  2. 36
      Makefile
  3. 1
      config/python-flask.yaml

1
.gitignore

@ -1,2 +1,3 @@
# Node modules directory
node_modules
build

36
Makefile

@ -0,0 +1,36 @@
INSTALL_DIR=build
CONFIG_DIR=config
YAML_FILE=https://raw.githubusercontent.com/MieuxVoter/mv-api-spec/master/mv-openapi.yaml
.DEFAULT_GOAL := all
.PHONY: all
all: clients server
.PHONY: server
server: ${INSTALL_DIR}/python-flask
.PHONY: clients
clients: ${INSTALL_DIR}/typescript-fetch ${INSTALL_DIR}/python
${INSTALL_DIR}/%:
mkdir -p ${INSTALL_DIR}
CONFIG_FILE=${CONFIG_DIR}/$*.yaml
if [ -f ${CONFIG_DIR}/$*.yaml ]; then\
docker run --rm -v "${PWD}:/local" \
openapitools/openapi-generator-cli generate \
-i ${YAML_FILE} \
-g $* \
-o /local/${INSTALL_DIR}/$* \
-c /local/${CONFIG_DIR}/$*.yaml;\
else\
docker run --rm -v "${PWD}:/local" \
openapitools/openapi-generator-cli generate \
-i ${YAML_FILE} \
-g $* \
-o /local/${INSTALL_DIR}/$*; \
fi
.PHONY: clean
clean:
rm -rf ${INSTALL_DIR}

1
config/python-flask.yaml

@ -0,0 +1 @@
packageName: mvapi
Loading…
Cancel
Save