Wednesday 30 August 2017

node js - How to update the source code for apps built with ArcGIS Web AppBuilder widgets?


What is the procedure for updating a widget's code, in an app built using the ArcGIS Web AppBuilder?


I'm editing a widget which is working correctly. When I reload an app which uses this widget, I'm not seeing the changes. This includes using CTRL-F5 and > History > Clear All.


I can see from the file system that the changes I made in the the source directory C:\arcgis-web-appbuilder-1.0\client\stemapp\widgets.... have not flowed through to the app's directory (C:\arcgis-web-appbuilder-1.0\server\apps\31\widgets...) which strongly suggests that a Node-level process is required (and explains why F5 has no effect).


Deleting the app from the Web AppBuilder main page, and creating a new app, does use the new code. Presumably a new app always fetches the latest source code.


Is there a shortcut method? I'm hoping there might be something in Node.js to tell all apps to update their source code, but I'm a Node.js novice and don't know where to start.


I'm trying nodemon which says "nodemon will watch the files in the directory in which nodemon was started, and if any files change, nodemon will automatically restart your node application."



The startup.bat file launches node in the /server subdirectory, which might explain why the widget files in the /client subdirectory are not being tracked. I can't figure out how to start nodemon one level up, so that both subdirectories are monitored.


(Cross-posted to https://geonet.esri.com/message/450805)



Answer



So far I haven't seen any way to "refresh" the app's widget code automatically or programatically.


A workaround was suggested by Larry Stout:



  • add your widget code to \arcgis-web-appbuilder-1.0\client\stemapp\widgets then create an app.

  • this will build a new app containing a snapshot of your widget code (eg \arcgis-web-appbuilder-1.0\server\apps\APP_NUMBER\widgets

  • edit this snapshot code directly in your code editor, and test it at http://localhost:3344/webappbuilder/apps/APP_NUMBER

  • to deploy the changes, overwrite the code in \arcgis-web-appbuilder-1.0\client\stemapp\widgets


  • any new apps will use the updated code


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...