diff options
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) |