Create React App (CRA) doesn't allow to import files or modules from outside of /src; however there is an 'escape hatch' that allows for data files / assets to be called from the /public folder https://create-react-app.dev/docs/using-the-public-folder/
The files in /boundaries are currently normal .js files, none of which have an exported member (so it isn't realistically possible to import them anyway)
These js files should be converted in to .json or .geojson files (remove the var declarations in each of the boundary files and update the filename to .json or .geojson - if .geojson must be valid geojson https://geojsonlint.com)
Move these .json/.geojson in /public/boundaries so that GitHub actions can keep pointing to this folder and do its update data thing;
Create a custom hook that actually fetches the json/geojson from the public folder so the app can tangibly use the data. Recommended to be able to pass in the file location as an argument to the hook
Based on last week's discussion (the exact time and date is irrelevant) we agreed to:
have the data as pure .json or .geojson
lets see what happens if we put in public folder first
if performance is notably horrible, maybe put it in /src/data and webpack will bundle with rest of app
long-term-ish approach is to house the data outside of the app entirely, as it should, like an S3 and the app will fetch the data somehow. and also it might play nicer with GH actions auto-updating the datasources
Create React App (CRA) doesn't allow to import files or modules from outside of
/src
; however there is an 'escape hatch' that allows for data files / assets to be called from the/public
folder https://create-react-app.dev/docs/using-the-public-folder/The files in
/boundaries
are currently normal .js files, none of which have an exported member (so it isn't realistically possible to import them anyway)CRA doesn't explicitly recommend to have json/geojson/data-like files in public folder, but this might be the easiest solution given the already existing boundary data and also for some way for GitHub hooks to continually update data as it is pulled https://create-react-app.dev/docs/using-the-public-folder/#when-to-use-the-public-folder
A suggested (albeit heavy-handed) approach:
/public/boundaries
so that GitHub actions can keep pointing to this folder and do its update data thing;fetch
es the json/geojson from the public folder so the app can tangibly use the data. Recommended to be able to pass in the file location as an argument to the hook