Skip to content

Commit

Permalink
fix(tools): make www look like a real server
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed May 27, 2024
1 parent 07a9435 commit 6c778fc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 24.3.0
hooks:
- id: black
entry: black --check
Expand Down
39 changes: 1 addition & 38 deletions docs/vitepress/assets/logos/trame-text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions trame/tools/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
From the directory containing the static content for a trame application to work,
generate another application specific HTML file.
"""

import argparse
import re
from pathlib import Path
Expand Down
12 changes: 6 additions & 6 deletions trame/tools/widgets/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ async def create_base_structure(ref_path, config, output):
config[name][sub_name][module][web_dir],
)
# Register trame/modules/{webdir}
trame_plugins[
f"trame/modules/{module}.py"
] = f"from {name}.module.{module} import *\n"
trame_plugins[f"trame/modules/{module}.py"] = (
f"from {name}.module.{module} import *\n"
)
create_module_init(module_root_init, module_conf_init)

elif sub_name == "widgets":
Expand Down Expand Up @@ -165,9 +165,9 @@ async def create_base_structure(ref_path, config, output):
file.write("\n")

# Register trame/modules/{webdir}
trame_plugins[
f"trame/widgets/{module}.py"
] = f"from {name}.widgets.{module} import *\n\ndef initialize(server):\n from {name}.module import {module}\n\n server.enable_module({module})\n"
trame_plugins[f"trame/widgets/{module}.py"] = (
f"from {name}.widgets.{module} import *\n\ndef initialize(server):\n from {name}.module import {module}\n\n server.enable_module({module})\n"
)

# Create trame package connectors
for file, content in trame_plugins.items():
Expand Down
2 changes: 2 additions & 0 deletions trame/tools/www.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
From a list of trame modules name, gather and generate the required static
content that needs to be served for a trame application to work.
"""

import argparse
import importlib
import shutil
Expand All @@ -10,6 +11,7 @@

class StaticContentGenerator:
def __init__(self):
self.name = "www_generator" # required to look like a server
self.www = None
self.serve = {}
self.client_type = "vue3"
Expand Down

0 comments on commit 6c778fc

Please sign in to comment.