Skip to content
Merged
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
26 changes: 25 additions & 1 deletion scripts/add_conference.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"""

import json
import subprocess
from datetime import date
from pathlib import Path

import click
Expand Down Expand Up @@ -85,7 +87,13 @@ def update_map_data(title: str, year: int, iso: str, country: str) -> None:

@click.command(help="Add a sponsored conference and regenerate the activity map.")
@click.option("--title", required=True, help="Conference title.")
@click.option("--year", type=int, required=True, help="Year sponsored.")
@click.option(
"--year",
type=int,
default=lambda: date.today().year,
show_default="current year",
help="Year sponsored.",
)
@click.option(
"--continent",
required=True,
Expand All @@ -105,6 +113,22 @@ def main(title: str, year: int, continent: str, country: str) -> None:
update_map_data(title, year, iso, canonical)
click.echo("Regenerating assets/map.html ...")
generate_map()
click.echo("Running pre-commit on modified files ...")
try:
subprocess.run(
[
"pre-commit",
"run",
"--files",
str(SPONSORED_JSON),
str(MAP_JSON),
str(ROOT / "assets" / "map.html"),
],
cwd=ROOT,
check=False,
)
except FileNotFoundError:
click.echo("Skipping pre-commit (not installed).")
click.echo("Done.")


Expand Down
Loading