-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Hello,
Thank you very much for DataHarmonizer, it is a really great tool - particularly that it doesn't need a standalone server to render.
I have two projects where I would like to host an instance of DataHarmonizer on our project website, which is hosted on GitHub pages.
Background
So far I've been able to make it work with two versions of DataHarmonizer, but with different levels of 'tweaks'.
- Older version:
- Repository: https://github.com/MIxS-MInAS/MInAS-DataHarmonizer
- Rendered version: https://www.mixs-minas.org/MInAS-DataHarmonizer/
- Forked from commit: b31a061
- Note this has a few extra HTML customisations on the header bar, which is why it looks a little different from stock DataHarmonizer
- Newer version:
- Repository: https://github.com/MIxS-MInAS/miaard-DataHarmonizer
- Rendered version: http://www.mixs-minas.org/miaard-DataHarmonizer/
- Forked from commit: b31a061
The older one worked almost out of the box, I just had to:
- Run
yarn build:web - Copy
web/dist/to adocs/directory at the root of the repository - Activate Github pages, and set on this page to Source: Deploy from Branch , then Branch
masterand directorydocs/
However since commit b31a061 something appears to have changed in the main.js so that this no longer works out of the box in my fork from commit b31a061.
Seemingly this is something to do with how the generated scripts/main.js file in picks up the paths to the schema.json.
Investigation
After a lot of trial error, inspecting the GitHub Pages page with browser tools, and a little bit of AI help with Claude Sonnet - it pointed me to the fact that there is a function:
: await (async function (e) {
for (const n of Object.values(oe.menu))
if (n.folder === e) {
var t = await se(`/templates/${e}/schema.json`);
const r = { name: e, default: { schema: t }, locales: {} };
if (n.locales)
for (const [i, o] of n.locales.entries())
if (i > 0) {
let n = B(
t,
await se(`/templates/${e}/locales/${o}/schema.json`)
);
r.locales[o] = { schema: n };
}
return r;
}
return null;
})(e)),Which hard codes the two locations of the schema.json to starting with a root of /templates/ . However when hosting this on GitHub pages directly, this fails because this page results in a 404, as it tries to find the file in the root of our domain, rather in the specific GitHub repository the website is coming from, i.e. in this case https://mix-minas.org/templates/miaard/schema.json rather than https://mixs-minas-org/miaard-Daharmonizer/templates/miaard/schema.json
Instead, if I manually edit the generated main.js to include the suffix of the GitHub repostiory to two paths, then the page will successfully render on GitHub page, i.e.
: await (async function (e) {
for (const n of Object.values(oe.menu))
if (n.folder === e) {
var t = await se(`/miaard-DataHarmonizer/templates/${e}/schema.json`);
const r = { name: e, default: { schema: t }, locales: {} };
if (n.locales)
for (const [i, o] of n.locales.entries())
if (i > 0) {
let n = B(
t,
await se(`/miaard-DataHarmonizer/templates/${e}/locales/${o}/schema.json`)
);
r.locales[o] = { schema: n };
}
return r;
}
return null;
})(e)),Request
I was wondering if it would be possible to update the more recent main.js script to again support more dynamic root domains somehow.
I don't know what has changed exactly between the two commits, but given it was possible before in the older version of DataHarmonizer, I wonder if somehow this area of the file could be reverted - however I 0 javascript experience, so I am unable to myself inspect/work out what impact of these changes are nor how feasible it would be to do so.