Closed dzackgarza closed 5 years ago
@dzackgarza thanks for the report. Currently, it is required that you run the "main generator" (aka "App" or "Default" Generator) first before running the widget subgenerator. We should probably make this fact more explicit in the documentation.
You're correct that the widget generator depends on a variety of questions that are asked by the Main/App/Default Generator. For example if you've chosen to use SASS for CSS preprocessing, the widget generator will create you a style.scss
file instead of a style.css
file. We've never really thought about extracting the creation of the widget from the main generator, because there are so many benefits that come with the main generator including a grunt task runner, the SCSS stuff that I mentioned earlier, ES6 or TypeScript transpilation, etc. A few thoughts come to mind:
grunt
command after you run the widget generator, no changes will be made to your Web AppBuilder install.re: 3.
A significant reason for the 2 step process is exactly that - there are several questions you don't want to answer more than once. If it can be done as a one step process that retains the answers to the first questions (I recall that yeoman has some mechanism for that), that might be slicker, but I don't think any easier to explain than the current 2 step process.
I have added a pull request to solve this - I had a project requirement for it so shared the code - #145
It will present you with the widget generation options if you haven't deployed the generator before. If you have, it continues as before. I wanted to use the template here for a project using different task runners and docker.
To reproduce:
It looks like it attempts to read a number of config variables that are set by the main generator. In my case, I only wanted to scaffold a new widget to drop into an existing app, and didn't particularly want/need to go through the process of fiddling with Esri's WebappBuilder SDK or anything like that.
Would it perhaps be possible to just ask for these config variables in the Widget sub generator as well, instead of relying on the main generator being run first?