From 30525e03a082013d25663a005aae7979f206d025 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Thu, 20 Jun 2024 15:37:12 +1000 Subject: [PATCH] Remove rules.mk and rename info.json -> keyboard.json --- src/App.vue | 12 +++++----- src/components/OutputCard.vue | 41 ++++++++++------------------------- src/kbf-parse.js | 20 ++++++++--------- src/main.js | 2 -- 4 files changed, 26 insertions(+), 49 deletions(-) diff --git a/src/App.vue b/src/App.vue index 1867258..029b1a5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,19 +1,18 @@ @@ -26,11 +25,10 @@ function parseKbf(filename, o) {

diff --git a/src/components/OutputCard.vue b/src/components/OutputCard.vue index 87f3c8b..e156308 100644 --- a/src/components/OutputCard.vue +++ b/src/components/OutputCard.vue @@ -11,24 +11,20 @@ const props = defineProps({ type: String, required: true }, - info: { + keyboard: { type: Object, required: true }, keymap: { type: String, required: true - }, - rules: { - type: String, - required: true } }) -const prettyInfo = computed(() => { - if (props.info) { +const prettyKeyboard = computed(() => { + if (props.keyboard) { return ( - JSON.stringify(props.info, null, ' ') + JSON.stringify(props.keyboard, null, ' ') // Place layout keys on a single line .replace(/\n {20,}/g, ' ') .replace(/\n {16,}\}/g, ' }') @@ -50,8 +46,7 @@ const prettyInfo = computed(() => { async function downloadZip() { const zip = new JSZip() - zip.file('info.json', prettyInfo.value) - zip.file('rules.mk', props.rules) + zip.file('keyboard.json', prettyKeyboard.value) zip.folder('keymaps').folder('default').file('keymap.c', props.keymap) const content = await zip.generateAsync({ @@ -68,18 +63,18 @@ async function downloadZip() {
-
- +
+
-
- -
diff --git a/src/kbf-parse.js b/src/kbf-parse.js index b321e96..4190447 100644 --- a/src/kbf-parse.js +++ b/src/kbf-parse.js @@ -391,8 +391,8 @@ function parseLayout(o) { }) } -function kbfInfoJson(o) { - let infoJson = { +function kbfKeyboardJson(o) { + let keyboardJson = { keyboard_name: o.settings.name, manufacturer: '', url: '', @@ -413,27 +413,27 @@ function kbfInfoJson(o) { } if (o.pins.led) { - infoJson.backlight = parseBacklight(o) + keyboardJson.backlight = parseBacklight(o) } if (o.pins.rgb) { - infoJson.rgblight = parseRGBlight(o) - infoJson.ws2812 = parseWS2812(o) + keyboardJson.rgblight = parseRGBlight(o) + keyboardJson.ws2812 = parseWS2812(o) } if (o.pins.caps || o.pins.num || o.pins.scroll) { - infoJson.indicators = parseIndicators(o) + keyboardJson.indicators = parseIndicators(o) } - infoJson.layouts = { + keyboardJson.layouts = { LAYOUT: { layout: parseLayout(o) } } - infoJson.meta = 'https://noroadsleft.github.io/kbf_qmk_converter/' + keyboardJson.meta = 'https://noroadsleft.github.io/kbf_qmk_converter/' - return infoJson + return keyboardJson } function parseSimpleLayerKey(key) { @@ -656,4 +656,4 @@ ${layers.join(',\n')} ` } -export { kbfInfoJson, kbfKeymapC } +export { kbfKeyboardJson, kbfKeymapC } diff --git a/src/main.js b/src/main.js index e6c7331..9ad4d60 100644 --- a/src/main.js +++ b/src/main.js @@ -7,7 +7,6 @@ import 'bootstrap/dist/css/bootstrap.min.css' import hljs from 'highlight.js/lib/core' import cpp from 'highlight.js/lib/languages/cpp' import json from 'highlight.js/lib/languages/json' -import makefile from 'highlight.js/lib/languages/makefile' import 'highlight.js/styles/stackoverflow-light.css' @@ -15,6 +14,5 @@ import hljsVuePlugin from '@highlightjs/vue-plugin' hljs.registerLanguage('cpp', cpp) hljs.registerLanguage('json', json) -hljs.registerLanguage('makefile', makefile) createApp(App).use(hljsVuePlugin).mount('#app')