Skip to content

fc-anjos/stimulus-parser

 
 

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")

await project.initialize()

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

About

Statically analyze Stimulus controllers in your project.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.2%
  • JavaScript 1.7%
  • HTML 1.1%