get the list of files/folders in developer file system
SOLVE
Hi,
For our website we want to load external React apps. The production builds are deployed to CMS developer file system through a CI/CD pipeline and this works like a charm. The problem is that we did not find any way to get the list of js/css files of the build in order to load them with require_js (_css) and the names of the files changes when new builds are deployed.
Is there any way to get the list of files from a developer file system folder and then load the react app in a loop of require_js(get_asset_url(...))? But without using CMS Api or serverless functions.
get the list of files/folders in developer file system
SOLVE
So ... the only solution that we found was to push the compiled React app(s) from GitHub to HubSpot dev file system through a GitHub action, together with a JSON file describing the app(s) (meaning the scripts/css files/chuncks). Of course, the JSON is in a form of a Hubl variable. Then, a custom module loads the app(s) into the page(s).
We are open to share the solution if somebody is interested to use it.
get the list of files/folders in developer file system
SOLVE
Hi,
Thanks for the reply.
Hubspot CLI is not a solution since it cannot be used inside a module.
We thought to make use of the React boilerplate but we did not find a way to do it. To be more specific, we only deploy the production build files (chunks) and we need to load them.
We thought that there is a function like as scandir() in PHP which returns the list of children of a folder (files or sub-folders).
Of course, technically, we can use CMS Api (source -code endpoint) to get the list we need but this require some kind of authentication that shall be made on server side. This means serverless functions whic are great but we believe that are much too expensive to be used with only what we need now.
get the list of files/folders in developer file system
SOLVE
So ... the only solution that we found was to push the compiled React app(s) from GitHub to HubSpot dev file system through a GitHub action, together with a JSON file describing the app(s) (meaning the scripts/css files/chuncks). Of course, the JSON is in a form of a Hubl variable. Then, a custom module loads the app(s) into the page(s).
We are open to share the solution if somebody is interested to use it.