When creating apps in WebAppBuilder, an instantiated app's themes and widgets are basically frozen in their state at the time of app creation. If developers continue to update or patch those themes and widgets in their development repo (or in stemapp), the instantiated apps will never be updated.
This gruntfile contains a custom task (written out here in javascript instead of a grunt task package so you can tinker) to update widgets and themes from a development repo to instantiated apps.
The task requires three flag options:
-appIds
is a comma-separated string of numeric app ids (corresponding to the apps found in [webappbuilder-root]/server/apps/)
component
is the name of the thing to copy over, for instance MyTheme or AwesomeWidget. This name needs to match the folder name where the component lives.
type
is your component's type, either theme
or widget
.
To create an app config.json, WebAppBuilder mashes up some generated metadata about the app with a theme layout's config.json file. It also includes information about which widgets the app's author has added to the app and where, and how those widgets have been configured. The configuration files live in a separate configs
directory.
Because of this complexity, and the unpredictability of modifying layouts and configs of instantiated apps, this task does not copy over a theme layout's config.json. Making these kinds of changes requires either editing the app in Builder. One could also directly (and carefully!) edit both the app's and the theme layout's config, but there's no guarantee the result would then work in Builder at a future date.
At the top of the gruntfile, there are three environment-specific variables. Change the path to the webappbuilder installation being used, and also change the paths in the repoBase
object to point to the location of the development repository's themes
and widgets
folders.
grunt pushUpdates -appIds=2 component=FBITheme -type=theme
This updates the FBITheme in instantiated app #2.
grunt pushUpdates -appIds='3, 5, 9' component=CheckboxFilter -type=widget
This updates the CheckboxFilter widget in apps 3, 5, and 9.
All three flags are required.