Skip to content

marcoroth/stimulus-parser

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date
Nov 7, 2024
Dec 12, 2024
Feb 13, 2024
Oct 7, 2024
Oct 7, 2024
Dec 26, 2023
Feb 15, 2024
Feb 11, 2024
Nov 7, 2024
Feb 25, 2024
Sep 8, 2023
Feb 25, 2024
Nov 7, 2024
Feb 9, 2024
Jan 2, 2025

Repository files navigation

stimulus-parser

NPM Version NPM Downloads NPM Bundle Size

Installation

To add stimulus-parser to your project, run the following command in your terminal:

yarn add stimulus-parser

Usage

import { Project } from "stimulus-parser"

const project = new Project("/Users/user/path/to/project")

const controllers = project.controllerDefinitions
const controller = controllers[0]

console.log(controller.actionNames)
// => ["connect", "click", "disconnect"]

console.log(controller.targetNames)
// => ["name", "output"]

console.log(controller.classNames)
// => ["loading"]

console.log(controller.values)
// => [{ url: { type: "String", default: "" } }]

Playground

You can inspect parse results on the hosted playground at https://stimulus-parser.hotwire.io.

Development

To run the tests:

yarn install
yarn build
yarn test