stimulus parser
v0.2.2
要在項目中添加stimulus-parser ,請在終端中運行以下命令:
yarn add stimulus-parser 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: "" } }] 您可以在https://stimulus-parser.hotwire.io上在託管操場上檢查解析結果。
進行測試:
yarn install
yarn build
yarn test