Skip to content

Remove all runtime reliance on NPM #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jun 21, 2021
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install Python Dependencies
run: pip install -r requirements/test-run.txt
- name: Run Tests
run: nox -s test -- --headless
run: nox -s test --verbose -- --headless
test-python-versions:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -54,7 +54,7 @@ jobs:
- name: Install Python Dependencies
run: pip install -r requirements/test-run.txt
- name: Run Tests
run: nox -s test -- --headless --no-cov
run: nox -s test --verbose -- --headless --no-cov
test-javascript:
runs-on: ubuntu-latest
steps:
Expand All @@ -67,7 +67,7 @@ jobs:
npm install -g npm@latest
npm --version
- name: Test Javascript
working-directory: ./src/idom/client/app
working-directory: ./src/idom/client
run: |
npm install
npm test
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ pip-wheel-metadata
# --- IDE ---
.idea
.vscode

# --- JS ---

node_modules
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
recursive-include src/idom *
recursive-exclude src/idom/client/app/node_modules *
recursive-exclude src/idom/client/app/web_modules *
recursive-exclude src/idom/client/build *
recursive-exclude src/idom/client/node_modules *
include requirements/prod.txt
include requirements/extras.txt
6 changes: 1 addition & 5 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ ADD README.md ./

RUN pip install -e .[all]

ENV IDOM_DEBUG_MODE=1
ENV IDOM_CLIENT_BUILD_DIR=./build

RUN python -m idom install htm victory semantic-ui-react @material-ui/core

# Build the Docs
# --------------
ADD docs/main.py ./docs/
Expand All @@ -44,4 +39,5 @@ RUN sphinx-build -b html docs/source docs/build
# Define Entrypoint
# -----------------
ENV PORT 5000
ENV IDOM_DEBUG_MODE=1
CMD python docs/main.py
6 changes: 3 additions & 3 deletions docs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from sanic import Sanic, response

import idom
from idom.client.manage import web_modules_dir
from idom.config import IDOM_WED_MODULES_DIR
from idom.server.sanic import PerClientStateServer
from idom.widgets.utils import multiview
from idom.widgets import multiview


HERE = Path(__file__).parent
Expand All @@ -18,7 +18,7 @@
def make_app():
app = Sanic(__name__)
app.static("/docs", str(HERE / "build"))
app.static("/_modules", str(web_modules_dir()))
app.static("/_modules", str(IDOM_WED_MODULES_DIR.current))

@app.route("/")
async def forward_to_index(request):
Expand Down
13 changes: 13 additions & 0 deletions docs/source/_exts/build_custom_js.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import subprocess
from pathlib import Path

from sphinx.application import Sphinx


SOURCE_DIR = Path(__file__).parent.parent
CUSTOM_JS_DIR = SOURCE_DIR / "custom_js"


def setup(app: Sphinx) -> None:
subprocess.run("npm install", cwd=CUSTOM_JS_DIR, shell=True)
subprocess.run("npm run build", cwd=CUSTOM_JS_DIR, shell=True)
4 changes: 2 additions & 2 deletions docs/source/_exts/interactive_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def run(self):
<div>
<div id="{container_id}" class="interactive widget-container center-content" style="" />
<script async type="module">
import loadWidgetExample from "{_IDOM_STATIC_HOST}/_static/js/load-widget-example.js";
loadWidgetExample("{_IDOM_EXAMPLE_HOST}", "{container_id}", "{view_id}");
import {{ mountWidgetExample }} from "{_IDOM_STATIC_HOST}/_static/custom.js";
mountWidgetExample("{container_id}", "{view_id}", "{_IDOM_EXAMPLE_HOST}");
</script>
</div>
""",
Expand Down
1,946 changes: 1,946 additions & 0 deletions docs/source/_static/custom.js

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions docs/source/auto/api-reference.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
API Reference
=============

.. automodule:: idom.client.manage
:members:

.. automodule:: idom.client.module
:members:

.. automodule:: idom.config
:members:

Expand All @@ -28,7 +22,7 @@ API Reference
.. automodule:: idom.core.vdom
:members:

.. automodule:: idom.dialect
.. automodule:: idom.html
:members:

.. automodule:: idom.log
Expand All @@ -55,18 +49,15 @@ API Reference
.. automodule:: idom.utils
:members:

.. automodule:: idom.widgets.html
.. automodule:: idom.web.module
:members:

.. automodule:: idom.widgets.utils
.. automodule:: idom.widgets
:members:

Misc Modules
------------

.. automodule:: idom.cli
:members:

.. automodule:: idom.core.utils
:members:

Expand All @@ -75,3 +66,6 @@ Misc Modules

.. automodule:: idom.server.utils
:members:

.. automodule:: idom.web.utils
:members:
6 changes: 0 additions & 6 deletions docs/source/auto/developer-apis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ Developer APIs

.. automodule:: idom._option
:members:

Misc Dev Modules
----------------

.. automodule:: idom.client._private
:members:
51 changes: 0 additions & 51 deletions docs/source/command-line.rst

This file was deleted.

1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"interactive_widget",
"patched_html_translator",
"widget_example",
"build_custom_js",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
9 changes: 9 additions & 0 deletions docs/source/custom_js/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Custom Javascript for IDOM's Docs

Build the javascript with

```
npm run build
```

This will drop a javascript bundle into `../_static/custom.js`
Loading