Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: docs

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- run: make init
- run: make test
- run: make docs
- uses: actions/upload-pages-artifact@v3
with:
path: docs/html/

deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
*todo*
dist/*
tests/*
docs/*.html
docs/*.css
docs/dist
docs/plot

deps
dist
docs/html
node_modules
test/flottplot.js
test/*.json
node_modules

86 changes: 51 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dist: \
dist/flottplot.css

clean:
rm -rf deps
rm -rf dist
rm -rf docs/*.html
rm -rf docs/*.css
Expand All @@ -19,19 +20,32 @@ clean:
%/:
mkdir -p $@

init:
npm install --include dev
pip install -r docs/requirements.txt


# Flottplot modules

dist/%.css: src/%.less | dist/
npx lessc $< > $@

dist/%-min.js: src/bundles/%.ts | dist/
# Building a bundle with webpack:
# - bundle js file depends on its corresponding ts file only
# - ts file dependencies are auto-generated
# - webpack won't overwrite the js file if it's content hasn't changed,
# touching it anyway after successful compilation ensures that make
# recognizes the update
dist/%-min.js: src/bundles/%.ts | dist/ deps/
python3 util/generate_dependencies.py $< > deps/$*.mk
npx webpack build \
--entry-reset \
--entry "./$<" \
--output-filename "$(notdir $@)"
--output-filename "$(notdir $@)" \
&& touch $@

# TODO: ts file dependencies
# Auto-generated dependencies for bundle files
-include deps/*.mk


# Unit tests
Expand All @@ -44,56 +58,58 @@ test: test/flottplot.js test/format_cases.json $(TESTS)
test/format_cases.json: util/generate_format_cases.py | test/
python3 $< > $@

test/flottplot.js: src/bundles/flottplot-test.ts
test/flottplot.js: src/bundles/flottplot-test.ts | deps/
python3 util/generate_dependencies.py $< > deps/flottplot-test.mk
npx webpack build \
--entry-reset \
--entry "./$<" \
--output-library-type "commonjs2" \
--output-path "test" \
--output-filename "flottplot.js"
--output-filename "flottplot.js" \
&& touch $@


# Documentation

DOCS := \
docs/ \
docs/index.html \
docs/tutorial.html \
docs/elements.html \
docs/values.html \
docs/python.html \
docs/docs.css \
docs/convert.js \
docs/dist/flottplot-min.js \
docs/dist/flottplot.css \
docs/dist/flottplot-scan-min.js \
docs/plot/sin-1x.png \
docs/plot/sin-2x.png \
docs/plot/sin-3x.png \
docs/plot/cos-3x.png \
docs/plot/cos-2x.png \
docs/plot/cos-3x.png \
docs/plot/adv_fwd_000.png \
docs/plot/adv_bwd_000.png \
docs/plot/adv_lag_000.png

docs: $(DOCS)

docs/%.css: docs/src/%.less
DOCS_HTML := \
docs/html/ \
docs/html/index.html \
docs/html/tutorial.html \
docs/html/elements.html \
docs/html/values.html \
docs/html/python.html \
docs/html/docs.css \
docs/html/convert.js \
docs/html/dist/flottplot-min.js \
docs/html/dist/flottplot.css \
docs/html/dist/flottplot-scan-min.js \
docs/html/plot/sin-1x.png \
docs/html/plot/sin-2x.png \
docs/html/plot/sin-3x.png \
docs/html/plot/cos-3x.png \
docs/html/plot/cos-2x.png \
docs/html/plot/cos-3x.png \
docs/html/plot/adv_fwd_000.png \
docs/html/plot/adv_bwd_000.png \
docs/html/plot/adv_lag_000.png

docs: $(DOCS_HTML)

docs/html/%.css: docs/src/%.less
npx lessc $< $@

docs/%.html: docs/util/build.py docs/src/template.html docs/src/%.html
docs/html/%.html: docs/util/build.py docs/src/template.html docs/src/%.html
python3 $+ > $@

docs/dist/%: dist/% | docs/dist/
docs/html/dist/%: dist/% | docs/html/dist/
cp $^ $@

docs/plot/sin-%x.png: docs/util/plot-trigonometric.py | docs/plot/
docs/html/plot/sin-%x.png: docs/util/plot-trigonometric.py | docs/html/plot/
python3 $< "sin" $* $@

docs/plot/cos-%x.png: docs/util/plot-trigonometric.py | docs/plot/
docs/html/plot/cos-%x.png: docs/util/plot-trigonometric.py | docs/html/plot/
python3 $< "cos" $* $@

docs/plot/adv_%_000.png: docs/util/plot-advection.py | docs/plot/
docs/html/plot/adv_%_000.png: docs/util/plot-advection.py | docs/html/plot/
python3 $< $* $(dir $@)

1 change: 0 additions & 1 deletion docs/.nojekyll

This file was deleted.

File renamed without changes.
File renamed without changes
File renamed without changes
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
numpy
matplotlib
flottplot

Loading