University of Arizona Libraries customizations and workflows for Springshare/LibApps.
This project uses Vite as its build and development tool.
ualibraries-libapps/
├── src/
│ ├── main.js
│ └── style.css
├── html/
├── helper.js # Helper functions to load local html files to the mount points
├── package.json
├── proxy-list.js # Fetch live Springshare pages for local development
├── README.md
└── vite.config.js
Install dependencies:
npm installStart the local development server (hot reload enabled):
npm run devCreate a production build:
npm run buildThis project currently relies on Vite via devDependencies.
Check what is out of date:
npm outdatedUpdate within allowed semver ranges in package.json:
npm updateUpdate a specific package to the latest version:
npm install vite@latest --save-devIf you want to bump all dependencies (including major versions), use npm-check-updates:
npx npm-check-updates -u
npm installAfter updates, verify everything still works:
npm run dev
npm run buildThe Vite config in this repo does two things during local development:
- Proxies a small set of Springshare resource paths directly to the sandbox host.
- Uses custom middleware to fetch and transform LibGuides HTML before serving it locally.
In vite.config.js, server.proxy forwards these paths to the sandbox LibGuides:
/process/web/lookfeel.css
This is needed because the A-Z page requests those assets from root-relative URLs, and without proxying them, local development pages can load with missing styles/scripts.
The LibApps middleware in vite.config.js runs on each incoming request and checks whether the URL starts with a configured prefix from proxy-list.js:
/db-sandbox-> sandbox A-Z databases path/db-> production A-Z databases path/lg-> production LibGuides path
If a prefix matches, the middleware:
- Builds the upstream URL from the matching target + remainder of the request path.
- Fetches the upstream HTML.
- Removes the old header/footer. (
#header_ua,#header_site,#footer_site). - Injects local mount points (
#vite-header,#vite-footer). - Appends
<script type="module" src="/helper.js"></script>so local helper logic runs. - Returns transformed HTML to the browser.
If no prefix matches, the middleware calls next() so normal Vite handling continues.
It lets you develop local front-end customizations against live/sandbox LibApps HTML while still using Vite's dev server and module workflow.