Experience Builder DevOps: Generating the App Export ZIP from the Terminal

3725
5
10-28-2021 01:43 PM
GavinRehkemper
Esri Contributor
14 5 3,725

As of 3/20/2024, this documentation has been moved to the official Experience Builder Developers documentation:

https://developers.arcgis.com/experience-builder/guide/deployment-topics/#automated-deployments

Please refer there for the latest updates. This post will not be updated.

---

If you’re using Experience Builder in a DevOps workflow, you may need the ability to generate the app ZIP export from a terminal without having the Experience Builder server running. There’s now a way to do this with developer edition of Experience Builder version 1.6 (released last week).

In the terminal, browse to the extracted root directory of your Experience Builder developer edition install (the directory that contains the “client” and “server” folders). Then run the following command, replacing the ‘0’ with the ID of the app that you’d like to export, and the ‘app.zip’ with the name of the ZIP file you’d like it to generate.

 

 

 

node -e "require('./server/src/middlewares/dev/apps/app-download.js').zipApp('0', 'app.zip');"

 

 

 

 

 

The ZIP will be generated and placed in the current working directory.

An example of using this command in a GitHub Actions dev-ops workflow can be found in this GitHub repository: https://github.com/gavinr/experience-builder-devops-example. Specifically, see the file build-app.yml to see app-download.js being used to generate the ZIP export. This GitHub action builds and deploys the Experience every time a commit is made to the repository – completely automatically!

 

---

Update: In developer edition of Experience Builder v1.7 (released January 2022), you can now include the Client ID that you'd like to be included in the config.json of the output app. For example,

 

 

 

node -e "require('./server/src/middlewares/dev/apps/app-download.js').zipApp('0', 'app.zip', 'my_client_id');"

 

 

 

5 Comments
Grant-S-Carroll
Esri Contributor

This is fantastic. Thanks for posting.

AlejandroMari1
Occasional Contributor

Hi Gavin, I've been using this for a bit now and works great. I'd like to generate a minified version using this (like the prod version you get when using the "download" button). Do you know how to achieve this?

Thanks!

Alejandro

MichaelLev
Occasional Contributor III

Thanks a lot!

Meanwhile I succeeded to download by deleting the "temp" folder in server folder,

and then download succeeded by running server either as administrator or not,

but it's good to know there is another safe way.

Anna_Gold
New Contributor II

Thank you!

Works great!

MichaelLev
Occasional Contributor III

@GavinRehkemper , Thanks a lot! I use your script (by batch file) so many times every day.
It works fantastic!

About the Author
I am a geospatial developer working for Esri Professional Services. https://gavinr.com ... see my Codepens: https://codepen.io/gavinr