mirror of
https://github.com/zulip/zulip.git
synced 2025-10-24 16:43:57 +00:00
Ever since we started bundling the app with webpack, there’s been less and less overlap between our ‘static’ directory (files belonging to the frontend app) and Django’s interpretation of the ‘static’ directory (files served directly to the web). Split the app out to its own ‘web’ directory outside of ‘static’, and remove all the custom collectstatic --ignore rules. This makes it much clearer what’s actually being served to the web, and what’s being bundled by webpack. It also shrinks the release tarball by 3%. Signed-off-by: Anders Kaseorg <anders@zulip.com>
37 lines
1.0 KiB
Python
Executable File
37 lines
1.0 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import json
|
|
import os
|
|
|
|
from pygments.lexers import get_all_lexers
|
|
|
|
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../")
|
|
# The current priorities data set is based on StackOverflow's 2020 survey.
|
|
DATA_PATH = os.path.join(ZULIP_PATH, "tools", "setup", "lang.json")
|
|
OUT_PATH = os.path.join(ZULIP_PATH, "web", "generated", "pygments_data.json")
|
|
|
|
with open(DATA_PATH) as f:
|
|
pygments_data = json.load(f)
|
|
priorities = dict(
|
|
**pygments_data["default"], **pygments_data["custom"], **pygments_data["aliases"]
|
|
)
|
|
|
|
lexers = get_all_lexers()
|
|
langs = {
|
|
alias: {
|
|
"priority": priorities.get(alias, 0),
|
|
"pretty_name": longname,
|
|
}
|
|
for longname, aliases, filename_patterns, mimetypes in lexers
|
|
for alias in aliases
|
|
}
|
|
|
|
for name in priorities:
|
|
if langs.get(name) is None:
|
|
langs[name] = {
|
|
"priority": priorities[name],
|
|
"pretty_name": name,
|
|
}
|
|
|
|
with open(OUT_PATH, "w") as f:
|
|
json.dump({"langs": langs}, f)
|