Skip to content

Commit

Permalink
STCOR-726 map sounds directory for remote applications
Browse files Browse the repository at this point in the history
* map the `sounds` directory for remote applications, analogous to how
  translations and icons are served
* provide `/code` to make the registry human-readable
* catch and display startup errors in case humans make stupid coding
  mistakes and need help finding them
  • Loading branch information
zburke committed Oct 28, 2024
1 parent 54db9c9 commit ecaa7a6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions webpack.config.federate.remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const buildConfig = (metadata) => {
const stripesModulePaths = getStripesModulesPaths();
const translationsPath = path.join(process.cwd(), 'translations', displayName.split('.').shift());
const iconsPath = path.join(process.cwd(), 'icons');

// yeah, yeah, soundsPath vs sound. sorry. `sound` is a legacy name.
// other paths are plural and I'm sticking with that convention.
const soundsPath = path.join(process.cwd(), 'sound');
const shared = processShared(singletons, { singleton: true });

const config = {
Expand All @@ -38,6 +42,10 @@ const buildConfig = (metadata) => {
directory: iconsPath,
publicPath: '/icons'
},
{
directory: soundsPath,
publicPath: '/sounds'
},
]
},
module: {
Expand Down
5 changes: 4 additions & 1 deletion webpack/registryServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ const registryServer = {
res.status(200).send(`Remote ${name} metadata updated`);
});

// return entire registry
// return entire registry for machines
app.get('/registry', (_, res) => res.json(registry));

// return entire registry for humans
app.get('/code', (_, res) => res.send(`<pre>${JSON.stringify(registry, null, 2)}</pre>`));

app.delete('/registry', (req, res) => {
const metadata = req.body;
const { name } = metadata;
Expand Down
7 changes: 6 additions & 1 deletion webpack/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ module.exports = function serve(stripesConfig, options) {
serviceWorkerConfig.resolveLoader = { modules: ['node_modules', platformModulePath, coreModulePath] };

// stripes module registry
registryServer.start();
try {
registryServer.start();
}
catch (e) {
console.error(e)
}

let config = buildConfig(stripesConfig);

Expand Down

0 comments on commit ecaa7a6

Please sign in to comment.