Conversation
demiankatz
left a comment
There was a problem hiding this comment.
Thanks for sharing this, @crhallberg! The PR had some of the channels code unexpectedly included, but I've merged with dev and resolved conflicts and now we're just seeing the one new file.
I tried to run this, but it didn't work for me:
dkatz@dkatz-VirtualBox:/usr/local/vufind$ node themes/bootstrap5/tools/jsTranslationsCheck.mjs
Error globbing synchronously: TypeError: fs.globSync is not a function or its return value is not iterable
at file:///usr/local/vufind/themes/bootstrap5/tools/jsTranslationsCheck.mjs:61:24
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadESM (node:internal/process/esm_loader:91:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
What am I doing wrong?
a9ba2cc to
703daf9
Compare
|
I was seeing a mess of commits, sorry for the force push. |
What version of Node are you using? It looks like this was added in Node v22. |
|
@crhallberg, I'm running Ubuntu 24, which has node v18 installed. That version is out of active support, but we should probably avoid using features that don't work in node 20 as a baseline. |
|
I see, Node v22 is the new LTS version but v20 is still LTS. |
There was a problem hiding this comment.
Thanks, @crhallberg. I've at least moved on to a new set of errors now...
First, I got this:
Error globbing synchronously: Error: EACCES: permission denied, scandir 'data/cache/browscap/browscap-00'
at read (node:fs:1399:35)
at readdirSyncRecursive (node:fs:1437:5)
at Object.readdirSync (node:fs:1504:12)
at file:///usr/local/vufind/themes/bootstrap5/tools/jsTranslationsCheck.mjs:55:25
at ModuleJob.run (node:internal/modules/esm/module_job:325:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:606:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: 'data/cache/browscap/browscap-00'
}
There was some Apache-owned junk in my cache folders that my regular user did not have permission to read. Can we make it more tolerant of unreadable files, or have it explicitly ignore cache dirs? In any case, I cleared the cache, and then I got this:
Error globbing synchronously: Error: ENOENT: no such file or directory, open './js/map_selection_leaflet.js'
at Object.readFileSync (node:fs:449:20)
at file:///usr/local/vufind/themes/bootstrap5/tools/jsTranslationsCheck.mjs:73:26
at ModuleJob.run (node:internal/modules/esm/module_job:325:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:606:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: './js/map_selection_leaflet.js'
}
Looks like the script expects you to be in $VUFIND_HOME/themes/bootstrap5, and I was running it from $VUFIND_HOME. Can we make it more directory-agnostic?
In any case, I then switched to the desired theme directory, and ended up with this:
Error globbing synchronously: TypeError: jsStrings.union is not a function
at file:///usr/local/vufind/themes/bootstrap5/tools/jsTranslationsCheck.mjs:74:26
at ModuleJob.run (node:internal/modules/esm/module_job:325:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:606:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
...and I'm not sure why that is failing. I'm running node v20.19.5 if that makes any difference.
|
Thanks, @crhallberg, this is working for me now! Looks like there are some issues here that need to be fixed, in fact! Should we wire this up into continuous integration so the build fails if missing or extra strings are found? (I guess the first step is to see if we can fix all of the problems and that there are no false positives left behind after we do). Would you like me to help with the cleanup, or do you want to do it? |
A script to find missing and extra PHP-to-JS translation strings.
TODO