Skip to content

Commit

Permalink
Publish data as part of API gen
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr committed May 6, 2022
1 parent be9fa68 commit 933f086
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- master
paths:
- 'keyboards/**'
- 'layouts/community/**'
workflow_dispatch:

jobs:
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/develop_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- develop
paths:
- 'keyboards/**'
- 'layouts/community/**'
workflow_dispatch:

jobs:
Expand Down
14 changes: 8 additions & 6 deletions lib/python/qmk/cli/generate/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from qmk.json_schema import json_load
from qmk.keyboard import find_readme, list_keyboards

TEMPLATE_PATH = Path('data/templates/api/')
DATA_PATH = Path('data')
TEMPLATE_PATH = DATA_PATH / 'templates/api/'
BUILD_API_PATH = Path('.build/api_data/')


Expand All @@ -22,18 +23,19 @@
def generate_api(cli):
"""Generates the QMK API data.
"""
if BUILD_API_PATH.exists():
shutil.rmtree(BUILD_API_PATH)

shutil.copytree(TEMPLATE_PATH, BUILD_API_PATH)

v1_dir = BUILD_API_PATH / 'v1'
keyboard_all_file = v1_dir / 'keyboards.json' # A massive JSON containing everything
keyboard_list_file = v1_dir / 'keyboard_list.json' # A simple list of keyboard targets
keyboard_aliases_file = v1_dir / 'keyboard_aliases.json' # A list of historical keyboard names and their new name
keyboard_metadata_file = v1_dir / 'keyboard_metadata.json' # All the data configurator/via needs for initialization
usb_file = v1_dir / 'usb.json' # A mapping of USB VID/PID -> keyboard target

if BUILD_API_PATH.exists():
shutil.rmtree(BUILD_API_PATH)

shutil.copytree(TEMPLATE_PATH, BUILD_API_PATH)
shutil.copytree(DATA_PATH, v1_dir)

# Filter down when required
keyboard_list = list_keyboards()
if cli.args.filter:
Expand Down

0 comments on commit 933f086

Please sign in to comment.