hathitrust / firebird-common

Other
0 stars 0 forks source link

update search URLs to use location protocol #57

Closed carylwyatt closed 10 months ago

carylwyatt commented 10 months ago

When working on Advanced Search locally, the search part doesn't actually work thanks to the hard-coded https protocol. This update adds a check for the current location.protocol, then builds the search URL using https if that's the current protocol, otherwise falls back to http.

This is up on dev-3 and looks like it's working.

But I'm interested to see if anyone can get my changes working locally with my new babel-local-dev firebird workflow.

Perhaps:

  1. in /babel/firebird-common, git fetch and switch to the TTO-166 branch
  2. docker compose run node bash will drop you into a I have no name! exec where you can run npm commands
  3. cd /htapps/babel/firebird-common
  4. npm run babel will build your files (and the asset manifest) and watch them for changes you make

if you got an error about missing a file or a package, you might need to npm i for good measure (I had this problem today)

I'm interested to see if this works for other people like I think it should. I'm also 100% sure there is a better way to run commands in docker than what I've done here, but it works!

And if you get my changes working locally, hopefully you can do an advanced search 🀞

netlify[bot] commented 10 months ago

Deploy Preview for hathitrust-firebird-common ready!

Name Link
Latest commit 54de04911bd02fc68786dfe051bd4a30d351afa4
Latest deploy log https://app.netlify.com/sites/hathitrust-firebird-common/deploys/659f198341ae57000810290c
Deploy Preview https://deploy-preview-57--hathitrust-firebird-common.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

liseli commented 10 months ago

@carylwyatt I have tested your PR locally and appear the issue Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/htapps/babel/firebird-common/node_modules/kleur/colors.mjs' imported from /htapps/babel/firebird-common/node_modules/@sveltejs/vite-plugin-svelte/src/utils/log.js. I have applied the following steps to fix the issue, but without success

  1. npm i
  2. npm audit fix
  3. npm install -g npm@10.3.0 # the output of npm run babel showed me a message to upgrade npm version

Do you have some idea how to fix it?

carylwyatt commented 10 months ago

@liseli With npm audit fix you updated some packages, which will have changed the package.json, so I'm not sure how this will work, but this could be a caching problem. Usually when I have issues with "module not found" even after I install, I try this:

  1. rm -rf node_modules
  2. rm -f package-lock.json
  3. npm cache clean --force
  4. npm install

But it will install the dependencies from your post-audit-fix updated package.json... which maybe isn't bad, but I haven't tested that.

liseli commented 10 months ago

It is working right now. I did npm install --cache /tmp/empty-cache to use a temporary cache instead of the actual one. After that, it worked. I will approved this PR