open-scd
open-scd copied to clipboard
Plugin development scaffolding tool
Description As a developer, I want to easily create new plugins for my project, for that I want to count on a CLI scaffolding script that guides me through the process. When I run the script, it should prompt me to select the type of plugin I want to develop (editor or menu).
Based on my selection, the script should generate a new Lit project in Typescript that features:
- A plugin file with the rough structure of the type of the chosen plugin. This should include the necessary Lit imports and basic structure (run method for menu plugins, render method for editor plugins and the properties
doc
andeditCount
) , leaving placeholders for me to complete the specific behavior of the plugin. - A test file should also be provided with the rough structure of how to add tests for the newly created plugin.
Requirements
- This script should live in a project called /tools/generators
- The solution must be built with Nx
Acceptance criteria
- The CLI scaffolding script should provide a menu for selecting the type of plugin (editor or menu) and it should run from the packages/plugins project, something like npm run create-new-plugin
- CLI should display the following prompts:
- Select type (multiselect: editor, menu)
- Enter the name of the plugin: (text input) (validated to only have [a-zA-Z] (Pascal Case))
- The script should generate a new TypeScript file (and folder to hold the file) with the appropriate structure and placeholders for plugin-specific behavior (name of the folder and file should be in Kebab Case)
- Tests should be added to ensure this working properly