Standardizing Custom Widget Sharing

520
5
03-08-2026 02:31 PM
Labels (2)
SunshineLuke90
Occasional Contributor

Standardizing Widget Sharing

Custom widgets are fantastic! But the process to distribute your widget to the community right now is quite unintuitive, and there isn't currently a set standard for how widgets should be packaged or shared. As such, I want to propose a potential solution for sharing widgets across the community.

Publishing widgets to NPM

NPM (Node Package Manager) is the default package manager for Node.js, acting as the world's largest software registry for JavaScript and TypeScript. Node.js is already a required item in the install process for Experience Builder developer edition, meaning that all users will already have npm available. To give a brief description of the advantages of npm packages over static zip files, or GitHub repos: npm packages offer versioned, dependency-aware distribution — meaning consumers can pin to a specific version, receive patch updates automatically, and trust that all peer dependencies are resolved correctly. Unlike a zip file buried in a blog comment or a GitHub repo that requires manual cloning and building, an npm package is a single command away (With the Experience Builder CLI - Blog Post here), integrates directly into any standard build toolchain, and surfaces discoverability through the npm registry's search. Packages also carry a structured package.json manifest that declares compatibility, licensing, and entry points explicitly, eliminating the guesswork that comes with unstructured archives or repos.

Using NPM as the registry for custom widgets also ensures that your widget will continue to stay available long into the future, without relying on a post attachment staying intact, or a repo to continue to exist. This improves the widget usage process for everyone using widgets as well. Many users have to stick to a specific version of Developer Edition, so being able to regularly access a version specific for their installation would be a huge upgrade.

On top of being able to reliably publish widgets, if all widgets are published to npm using community standards (Described below) it will be incredibly easy to search for widgets, on a unified registry.

NPM Community Standards

  • Prepend "exb-" to your widget name. For example, a widget named rightclick would be published to npm as exb-rightclick.
  • Add exb-widget, experience-builder, and exb as keywords for your package.
  • Use a license! Esri uses the Apache-2.0 license for most of their Experience Builder resources, and I like the MIT license. Do some research when deciding what license is best for you.
  • Add a README.md file within the root directory of your widget. This is the best place to include documentation on use cases for the widget, who developed it, and any extra steps that a user might have to take to use the widget.

Using widgets published to NPM

Using npm commands to install widgets directly won't be the best solution, since the npm cli commands will download the widget to your node_modules folder, which is not helpful for actually using the widget within developer edition. Because of this, I have developed a command line interface, which uses the npm registry, but installs widgets in the way that Experience Builder would expect widgets. More information on the Experience Builder Community CLI can be found on my Esri Community post here, or on the npm page for the CLI here. The CLI also makes it easy to search for widgets published to npm, without having to find a blog post, GitHub repo, or anything else. Just search, and install, straight from the command line.

Comments

I truly think that npm makes the most sense for reliably publishing widgets. I recognize that this process hasn't been tried before, but I want to support the community in sharing resources across the GIS space, to make it easy for anyone to install developer edition, and have a rich library of widgets to extend the default functionality of Experience Builder, and build on top of what others have already created, instead of starting from scratch.

If you have any thoughts on this idea, positive or negative, please share them in the comments section below. I welcome feedback, and want to try to implement a solution that will work widely across the community.

5 Replies
youknowww
Occasional Contributor

Great new approach to track widgets. I hope devs see this and it and catches on.

Another upside is I assume I could make a "living list" by writing something to search NPM for "exb-" and maybe some other particulars that identify a widget module. Maybe it could even be a command in the CLI to fetch a list.

Looking forward to contributing!

SunshineLuke90
Occasional Contributor

You're exactly right on the "living list" idea! That's actually a function in the CLI already! If you're using the CLI I have developed, running exb search will return all experience builder widgets with the keyword exb-widget, and have a manifest.json file.

Right now that command is decently fast, but if more widgets get published to npm (like more than 50), it's going to need adjusting. If we get to that point, I will work on creating a sort of "cached" list, which would get updated regularly, and the CLI would pull from that list by default. 

adamsimple
Occasional Contributor

I will give this a shot. For the widget I just announced, I linked to my GitHub site which uses releases, so there’s no need to clone the repo. All of the files you need are included in the assets for that release. 

IMG_9575.jpeg

https://github.com/MapSimple-Org/ExB-Simple-Public/releases

0 Kudos
SunshineLuke90
Occasional Contributor

I hadn't even thought of using GitHub releases! Partially since NPM is just so ubiquitous, but also because it can be difficult to manage multiple widget releases within one GitHub repository. I'll look into seeing how GitHub releases might be incorporated into the CLI, but with the current version just searching all of NPM using some keywords, GitHub releases might need to be done in a separate way.

I'm sure you've probably thought about this already, given the way that releases are packaged and named within your Git Repository, so I would appreciate your feedback on why you decided to go with GitHub Releases, and if you have any concerns with using NPM.

0 Kudos
adamsimple
Occasional Contributor

To be honest, I didn't know about NPM until I read your article. I use GitHub for my repos, so releases was just a natural extension of that. My public repo is actually a flattened version of what I use during development and a highly sanitized version of my day to day environment. I will definitely give this a shot when I have some time. I am not at all married to any one way of doing things. 

0 Kudos