From ad3a5e3eb64c46969ddc38ef873bc2020a1ab114 Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Mon, 19 Aug 2024 15:48:33 -0400 Subject: [PATCH 1/3] Update readme and prepare for release --- .vscode/settings.json | 1 - README.md | 57 ++++++++++++++++++++++++++++++++++++++++--- package.json | 4 +-- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c80ab65..3d00bdc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,6 @@ "editor.tabSize": 4, "editor.insertSpaces": true, "editor.detectIndentation": false, - "editor.formatOnSave": true, "cSpell.words": [ "brighterscript", "findnode", diff --git a/README.md b/README.md index 3ea5f55..840698c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # bsc-plugin-auto-findnode + A BrighterScript plugin that auto-injects `m.top.findNode()` calls in your component `init()` functions [![build status](https://img.shields.io/github/actions/workflow/status/rokucommunity/bsc-plugin-auto-findnode/build.yml?branch=master&logo=github)](https://github.com/rokucommunity/bsc-plugin-auto-findnode/actions?query=branch%3Amaster+workflow%3Abuild) @@ -20,14 +21,64 @@ npm install bsc-plugin-auto-findnode ```jsonc { - "plugins": [ - "bsc-plugin-auto-findnode" - ] + "plugins": ["bsc-plugin-auto-findnode"] } ``` 3. Run brighterscript like normal, and the plugin will work! + ```bash npx bsc ``` +## How it works + +1. find every xml file in the project +2. find every element with an ID in that xml file +3. find the `init()` function for each scope (or create one in a new file) +4. inject `m. = m.top.findNode("")` into the init function + +For example: + +**Before:** + +_pkg:/components/ZombieKeyboard.xml_ + +```xml + + + +