Get frontend dependencies from NPM instead of vendoring them#621
Open
JulianKniephoff wants to merge 1 commit intoopencast:masterfrom
Open
Get frontend dependencies from NPM instead of vendoring them#621JulianKniephoff wants to merge 1 commit intoopencast:masterfrom
JulianKniephoff wants to merge 1 commit intoopencast:masterfrom
Conversation
Not all of the libraries we were using could be found (in the correct version) in NPM, so had to get creative with some of them. I tried to stick to our current versions as closely as possible, except for some that were easy to update. Thus, most versions are pinned instead of using the usual `^x.y.z` constraint. Only ones where we are using a current version anyway, and where minor updates should be fine use the more traditional constraint. Here are the detailed notes about where dependencies (might have) changed: * `vis-timeline` should be in the correct version, but the NPM build is a few moments younger, and differs slightly. I hope it's just variable naming or something like that, but comparing minified JS is hard, so I'm not 100% sure. * `jquery.colorPicker` (or rather `really-simple-colorpicker` as the NPM package is called) is newer, because the original version isn't in NPM. Our use of it is relatively isolated, though, and it still seems to work superficially, so I'm relatively confident that this is fine. * `jquery.appear` was never actually in use, so I removed it. * `jquery` itself is updated to `1.8.2`. We were on `1.8.0` which is not in NPM. `1.8.2` is, and that should be fine, but jQuery is one of these candidates that you can never really be sure about since it doesn't follow SemVer perfectly and is used so pervasively, that even checking all our usages against the changelog is basically impossible. * `i18next-xhr-backend` was replaced with (the newest version of) `i18next-http-backend`. The former is deprecated and not in NPM anymore, but the update here is literally a drop in replacement, apparently. * Our Bootstrap version (`2.3.2`) is so dead it's not even funny. No `2.x` release is in NPM. Fortunately in this case one can just install it directly from their GitHub using the appropriate tag, but this is a bit shady and I want to get rid of it sooner rather than later. Unfortunately upgrading Bootstrap is a rather invasive step. * The Bootstrap slider thing we were using doesn't even have a GitHub. I replaced it with one that does, and which is based on our original one. I used the oldest release they have on GitHub, and seems to be more or less the same, still, but there have been significant code changes between the two. As with the color picker, this is a rather isolated thing, though, so we should be fine? * The RequireJS `text` plugin wasn't used anymore, so I got rid of it. * RequireJS `domReady` only has newer versions in NPM, but they seem to work fine, even though there was a major jump here. * `moment` got a minor update because the version we were using was actually incompatible with our `vis-timeline` version, and our own few uses should still work exactly the same. Note that this is merely a convenience to make `npm install` work. We are using all of these libraries pre-bundled, so `vis-timeline` isn't actually using the version of `moment` we are including, but rather comes with its own. Fixes opencast#138. Fixes opencast#457.
Arnei
reviewed
Jan 3, 2024
Member
Arnei
left a comment
There was a problem hiding this comment.
Glad this is getting done. The explanations on why which npm modules were chosen sound very reasonable to me. Looking forward to updated dependencies (bootstrap) in the future.
I am running into a build error and not seeing an immediately obvious fix:
[INFO] npm ERR! npm ERR! code 1
[INFO] npm ERR! npm ERR! path /home/arnewilken/.npm/_cacache/tmp/git-clonel6Eszu/node_modules/phantomjs
[INFO] npm ERR! npm ERR! command failed
[INFO] npm ERR! npm ERR! command sh -c node install.js
[INFO] npm ERR! npm ERR! PhantomJS not found on PATH
[INFO] npm ERR! npm ERR! Phantom installation failed TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
[INFO] npm ERR! npm ERR! at new NodeError (node:internal/errors:371:5)
[INFO] npm ERR! npm ERR! at validateString (node:internal/validators:119:11)
[INFO] npm ERR! npm ERR! at Object.join (node:path:1172:7)
[INFO] npm ERR! npm ERR! at findSuitableTempDirectory (/home/arnewilken/.npm/_cacache/tmp/git-clonel6Eszu/node_modules/phantomjs/install.js:127:30)
[INFO] npm ERR! npm ERR! at /home/arnewilken/.npm/_cacache/tmp/git-clonel6Eszu/node_modules/phantomjs/install.js:476:19
[INFO] npm ERR! npm ERR! at nextTickCallback (/home/arnewilken/.npm/_cacache/tmp/git-clonel6Eszu/node_modules/kew/kew.js:47:28)
[INFO] npm ERR! npm ERR! at processTicksAndRejections (node:internal/process/task_queues:78:11) {
[INFO] npm ERR! npm ERR! code: 'ERR_INVALID_ARG_TYPE'
[INFO] npm ERR! npm ERR! } TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
[INFO] npm ERR! npm ERR! at new NodeError (node:internal/errors:371:5)
[INFO] npm ERR! npm ERR! at validateString (node:internal/validators:119:11)
[INFO] npm ERR! npm ERR! at Object.join (node:path:1172:7)
[INFO] npm ERR! npm ERR! at findSuitableTempDirectory (/home/arnewilken/.npm/_cacache/tmp/git-clonel6Eszu/node_modules/phantomjs/install.js:127:30)
[INFO] npm ERR! npm ERR! at /home/arnewilken/.npm/_cacache/tmp/git-clonel6Eszu/node_modules/phantomjs/install.js:476:19
[INFO] npm ERR! npm ERR! at nextTickCallback (/home/arnewilken/.npm/_cacache/tmp/git-clonel6Eszu/node_modules/kew/kew.js:47:28)
[INFO] npm ERR! npm ERR! at processTicksAndRejections (node:internal/process/task_queues:78:11)
$ npm --version
9.6.7
$ node --version
v18.17.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not all of the libraries we were using could be found (in the correct version) in NPM, so had to get creative with some of them.
I tried to stick to our current versions as closely as possible, except for some that were easy to update. Thus, most versions are pinned instead of using the usual
^x.y.zconstraint. Only ones where we are using a current version anyway, and where minor updates should be fine use the more traditional constraint.Here are the detailed notes about where dependencies (might have) changed:
vis-timelineshould be in the correct version, but the NPM build is a few moments younger, and differs slightly. I hope it's just variable naming or something like that, but comparing minified JS is hard, so I'm not 100% sure.jquery.colorPicker(or ratherreally-simple-colorpickeras the NPM package is called) is newer, because the original version isn't in NPM. Our use of it is relatively isolated, though, and it still seems to work superficially, so I'm relatively confident that this is fine.jquery.appearwas never actually in use, so I removed it.jqueryitself is updated to1.8.2. We were on1.8.0which is not in NPM.1.8.2is, and that should be fine, but jQuery is one of these candidates that you can never really be sure about since it doesn't follow SemVer perfectly and is used so pervasively, that even checking all our usages against the changelog is basically impossible.i18next-xhr-backendwas replaced with (the newest version of)i18next-http-backend. The former is deprecated and not in NPM anymore, but the update here is literally a drop in replacement, apparently.2.3.2) is so dead it's not even funny. No2.xrelease is in NPM. Fortunately in this case one can just install it directly from their GitHub using the appropriate tag, but this is a bit shady and I want to get rid of it sooner rather than later. Unfortunately upgrading Bootstrap is a rather invasive step.textplugin wasn't used anymore, so I got rid of it.domReadyonly has newer versions in NPM, but they seem to work fine, even though there was a major jump here.momentgot a minor update because the version we were using was actually incompatible with ourvis-timelineversion, and our own few uses should still work exactly the same. Note that this is merely a convenience to makenpm installwork. We are using all of these libraries pre-bundled, sovis-timelineisn't actually using the version ofmomentwe are including, but rather comes with its own.Fixes #138.
Fixes #457.