diff options
author | Joel Challis <git@zvecr.com> | 2022-11-05 10:30:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 10:30:09 +0000 |
commit | a69ab05dd687cb9aa38e0c125e4f64956c7da6c7 (patch) | |
tree | 3733805ea012b5bc6ae7dc78dfed9f0f4d942d33 /lib/python/qmk/cli/generate/api.py | |
parent | a070c4c50134cf274a674ee73227289fde81b8ed (diff) |
Initial DD keycode migration (#18643)
* Initial DD keycode migration
* Sort magic keycodes
Diffstat (limited to 'lib/python/qmk/cli/generate/api.py')
-rwxr-xr-x | lib/python/qmk/cli/generate/api.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/generate/api.py b/lib/python/qmk/cli/generate/api.py index 8d8ca3cd41..0f29cd2327 100755 --- a/lib/python/qmk/cli/generate/api.py +++ b/lib/python/qmk/cli/generate/api.py @@ -11,12 +11,23 @@ from qmk.info import info_json from qmk.json_encoders import InfoJSONEncoder from qmk.json_schema import json_load from qmk.keyboard import find_readme, list_keyboards +from qmk.keycodes import load_spec, list_versions DATA_PATH = Path('data') TEMPLATE_PATH = DATA_PATH / 'templates/api/' BUILD_API_PATH = Path('.build/api_data/') +def _resolve_keycode_specs(output_folder): + """To make it easier for consumers, publish pre-merged spec files + """ + for version in list_versions(): + overall = load_spec(version) + + output_file = output_folder / f'constants/keycodes_{version}.json' + output_file.write_text(json.dumps(overall, indent=4), encoding='utf-8') + + def _filtered_keyboard_list(): """Perform basic filtering of list_keyboards """ @@ -95,6 +106,9 @@ def generate_api(cli): 'usb': usb_list, } + # Feature specific handling + _resolve_keycode_specs(v1_dir) + # Write the global JSON files keyboard_all_json = json.dumps({'last_updated': current_datetime(), 'keyboards': kb_all}, cls=InfoJSONEncoder) usb_json = json.dumps({'last_updated': current_datetime(), 'usb': usb_list}, cls=InfoJSONEncoder) |