Description
I'd like my stimulus controller to be automatically registered in my app via an auto-recipe, like ux-chartsjs works.
Ryan has given me some guidance in SymfonyCasts stimulus controller tutorial (https://symfonycasts.com/screencast/stimulus/controllers#comment-5420791953), but in my bundle the package.json and controllers.json aren't updated by the recipe.
I'm using a Symfony 6.1 simplified recipe, so perhaps there's an issue with the condition that triggers the recipe.
Does the package.json need to be in a particular path of the bundle? I've tried it in Resources, assets, and Resources/assets
{
"name": "@tacman/hello-bundle",
"description": "demonstrate installation for stimulus in a bundle",
"license": "MIT",
"version": "1.0.0",
"symfony": {
"controllers": {
"hello": {
"main": "src/controllers/hello_controller.js",
"webpackMode": "eager",
"fetch": "eager",
"enabled": true
}
}
},
"peerDependencies": {
"@hotwired/stimulus": "^3.0.0"
},
"devDependencies": {
"@hotwired/stimulus": "^3.0.0"
},
"dependencies": {
"sweetalert2": "^11.4.17"
}
}
I've enabled stimulus bridge in webpack.config.js
// enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)
.enableStimulusBridge('./assets/controllers.json')
I've put together a simple hello bundle that is structured like chartjs. This isn't working for me (not in packagist, so it requires adding the repo).
symfony new helloApp --webapp
cd helloApp && yarn install
composer config repositories.tacman_hello '{"type": "vcs", "url": "[email protected]:tacman/TacmanHelloBundle.git"}'
composer req tacman/hello-bundle:*@dev
git status
What I'm expecting is to see controllers.json add these lines;
"@tacman/ux-hello": {
"hello": {
"enabled": true,
"fetch": "eager"
}
}
and package.json to add this in devDependencies
"@tacman/ux-hello": "file:vendor/tacman/hello-bundle/Resources/assets",
I imagine this is something simple, but I can't figure out what triggers this recipe. Thanks.