Skip to content

Commit c8e813b

Browse files
committed
WASM build
1 parent 3ef9d3a commit c8e813b

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

.github/workflows/release-wasm.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
make install_deps
24-
if [ -d .venv ]; then .venv/bin/pip install py2wasm; else pip install py2wasm; fi
2524
2625
- name: Build WASM
2726
run: |

Makefile

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22

33
.DEFAULT_GOAL := help
44

5+
BIN_DIR ?= dist
6+
DOCS_DIR ?= docs
7+
58
# Extract arguments for build, build_docs, run
69
ifeq ($(firstword $(MAKECMDGOALS)),build)
7-
BIN_DIR := $(word 2,$(MAKECMDGOALS))
8-
ifeq ($(BIN_DIR),)
9-
BIN_DIR := dist
10-
else
10+
ifneq ($(word 2,$(MAKECMDGOALS)),)
11+
BIN_DIR := $(word 2,$(MAKECMDGOALS))
1112
$(eval $(BIN_DIR):;@:)
1213
endif
1314
endif
1415

1516
ifeq ($(firstword $(MAKECMDGOALS)),build_docs)
16-
DOCS_DIR := $(word 2,$(MAKECMDGOALS))
17-
ifeq ($(DOCS_DIR),)
18-
DOCS_DIR := docs
19-
else
17+
ifneq ($(word 2,$(MAKECMDGOALS)),)
18+
DOCS_DIR := $(word 2,$(MAKECMDGOALS))
2019
$(eval $(DOCS_DIR):;@:)
2120
endif
2221
endif
@@ -40,7 +39,7 @@ install_deps:
4039
build_docs:
4140
@echo "Building docs in $(DOCS_DIR)"
4241
@mkdir -p $(DOCS_DIR)
43-
.venv/bin/python3 -m pdoc src/openapi_client -o $(DOCS_DIR) || pdoc src/openapi_client -o $(DOCS_DIR)
42+
pdoc src/openapi_client -o $(DOCS_DIR)
4443

4544
build:
4645
@echo "Building binary/package in $(BIN_DIR)"
@@ -50,13 +49,12 @@ build:
5049
build_wasm:
5150
@echo "Building WASM to bin/"
5251
@mkdir -p bin
53-
if [ -d .venv ]; then .venv/bin/python3 -m py2wasm src/openapi_client/cli.py -o bin/cdd-python-all.wasm; else py2wasm src/openapi_client/cli.py -o bin/cdd-python-all.wasm; fi
54-
52+
py2wasm src/openapi_client/cli.py -o bin/cdd-python-all.wasm
5553
test:
56-
.venv/bin/python3 -m pytest tests/ || pytest tests/
54+
pytest tests/
5755

5856
run: build
59-
.venv/bin/python3 -m openapi_client.cli $(RUN_ARGS) || cdd-python $(RUN_ARGS)
57+
python3 -m openapi_client.cli $(RUN_ARGS) || cdd-python $(RUN_ARGS)
6058

6159
help:
6260
@echo "Available tasks:"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dev = [
2222
"interrogate",
2323
"build",
2424
"pdoc",
25+
"py2wasm",
2526
]
2627

2728
[project.scripts]

0 commit comments

Comments
 (0)