Modernize Review Board JavaScript setup.
Review Request #14647 — Created Oct. 31, 2025 and updated
This change makes a bunch of changes to modernize our JavaScript build
process across our products:Better handle npm workspaces.
Prior to this change, we had a
reviewboard/package.jsonfile which was
the "real" JS package file, and a symlink from the repository root into
that (for the purposes ofnpm install). This then also specified a
"workspaces" key which had.npm-workspaces/*, in which we'd
automatically create symlinks for djblets and reviewboard. This ended up
kind of double-installing packages, where we'd have both the top-level
reviewboard as well as a reviewboard inside the workspaces.This change removes the symlink, and creates a new top-level
package.jsonfile which just specifies the workspaces and scripts. All
actual dependencies now live only inside thereviewboard/package.json
file.This allows creating additional symbolic links in the workspace
directory in order to bring in development copies of spina, ink,
beanbag-eslint-plugin, or whatever other JS dependencies on desires.Depending on which JS packages one wants to include in their workspace,
this may require having a shared parent directory and a symbolic link
from ../node_modules to ./node_modules, since some things like to
resolve to absolute paths and then crawl up the directory tree (looking
at you,tsc).Update and consolidate JS dependencies.
Several updates have been made to our JS dependencies:
- We now rely on the new
@beanbag/js-buildkitmetapackage for our
eslint and typescript dependencies. babel-polyfillhas been replaced withcore-jsand the
useBuiltInssetting for@babel/preset-env(as per Babel's
documentation). This ends up transforming the core-js library to only
include what's needed for the browserslist target.- Most other dependencies have been updated to the latest. CodeMirror
is updated within its major version, since version 6 is completely
different. - Update to Storybook 10.
- Update to ESLint 9.
Stop vendoring dependencies.
We had a number of things that were vendored into our source tree, many
from before we used node_modules at all.
- We were both getting
jasmine-corethrough npm as well as vendoring a
copy of jasmine 5.1.0 into our lib/js directory. I've changed it so the
js-test-libs index pulls in the relevant jasmine boot files from the
installed jasmine-core, making it easier and more reliable to upgrade in
the future. We also had vendored in sourcemapped-stacktrace and
masonry-layout, which I've changed to also come entirely from npm.
I've also ported our old jasmine-hide-filtered and jasmine-sourcemaps
code to TypeScript.
-
jquery-ui's JavaScript was being pulled from
node_modules, but we
had vendored in a copy of the CSS and some of the images. Fixing this
required some build-time shenanigans inside settings.py to find the
relevant files. -
Masonry (used in the admin dashboard) is a very simple update,
especially since there haven't been any new versions at all.
Simplify browserslist.
Instead of a complicated browserslist config, I've changed it to just
specify baseline widely available. This ends up pulling in a few
more older versions of browsers than our old config did, but it seems
like it's the right choice in the current age.
Fix an issue in the page-banner CSS.
The newer version of LESS correctly identified :not('.ink-c-button')
as an error. I've removed the quotes so that CSS builds properly.
- Smoke tested the dev server.
- Built static media and verified that everything looked correct,
especially the core-js polyfills and jQuery-UI stylesheets. - Ran python tests.
- Ran js-tests.
- Ran eslint (eek).
- Built the rbintegrations extension to verify that static media
building still worked for that. - Ran
build-storybook - Ran the storybook and flipped through the couple components that are
there. Verified that things worked as expected. - Verified that things that used jQuery-UI (comment dialog, autocomplete
fields) looked correct.
| Summary | ID |
|---|---|
| opkxnmsquyvssqtotyvtqnlpnpmsnpyl |
| Description | From | Last Updated |
|---|---|---|
|
module level import not at top of file Column: 1 Error code: E402 |
|
|
|
module level import not at top of file Column: 1 Error code: E402 |
|
|
|
module level import not at top of file Column: 1 Error code: E402 |
|
|
|
module level import not at top of file Column: 1 Error code: E402 |
|
|
|
module level import not at top of file Column: 1 Error code: E402 |
|
|
|
module level import not at top of file Column: 1 Error code: E402 |
|
- Change Summary:
-
- Revert npm_dependencies / build-npm-deps removal (but update the existing script a tad)
- Stop vendoring masonry and jquery-ui CSS.
- Description:
-
This change makes a bunch of changes to modernize our JavaScript build
process across our products: Better handle npm workspaces.
Prior to this change, we had a
reviewboard/package.jsonfile which wasthe "real" JS package file, and a symlink from the repository root into that (for the purposes of npm install). This then also specified a"workspaces" key which had .npm-workspaces/*, in which we'dautomatically create symlinks for djblets and reviewboard. This ended up kind of double-installing packages, where we'd have both the top-level reviewboard as well as a reviewboard inside the workspaces. This change removes the symlink, and creates a new top-level
package.jsonfile which just specifies the workspaces and scripts. Allactual dependencies now live only inside the reviewboard/package.jsonfile. This allows creating additional symbolic links in the workspace
directory in order to bring in development copies of spina, ink, beanbag-eslint-plugin, or whatever other JS dependencies on desires. Depending on which JS packages one wants to include in their workspace,
this may require having a shared parent directory and a symbolic link from ../node_modules to ./node_modules, since some things like to resolve to absolute paths and then crawl up the directory tree (looking at you, tsc).Update and consolidate JS dependencies.
Several updates have been made to our JS dependencies:
- We now rely on the new
@beanbag/js-buildkitmetapackage for our
eslint and typescript dependencies.
babel-polyfillhas been replaced withcore-jsand the
useBuiltInssetting for@babel/preset-env(as per Babel's
documentation). This ends up transforming the core-js library to only
include what's needed for the browserslist target.
- Most other dependencies have been updated to the latest. CodeMirror
is updated within its major version, since version 6 is completely
different.
- Update to Storybook 10.
- Update to ESLint 9.
~ Remove
npm_dependenciesandbuild-npm-deps.py~ Stop vendoring dependencies.
~ It used to be that all our JS dependencies were specified inside
~ reviewboard/dependencies.pyand then we would write out a~ We had a number of things that were vendored into our source tree, many
~ from before we used node_modulesat all.- package.jsonfile on demand. A while back we inverted that so that- package.jsonwas the authoritative list, and we would auto-generate- python code back into dependencies.py. However, none of that stuff was- actually consumed anywhere. ~ I've removed the
build-npm-deps.pyscript and the associated block~ - We were both getting
jasmine-corethrough npm as well as vendoring a
copy of jasmine 5.1.0 into our lib/js directory. I've changed it so the
js-test-libs index pulls in the relevant jasmine boot files from the
installed jasmine-core, making it easier and more reliable to upgrade in
the future. We also had vendored in sourcemapped-stacktrace and
masonry-layout, which I've changed to also come entirely from npm.
- inside reviewboard/dependencies.py.- - - - Stop vendoring jasmine.
- - We were both getting
jasmine-corethrough npm as well as vendoring a- copy of jasmine 5.1.0 into our lib/js directory. I've changed it so the - js-test-libs index pulls in the relevant jasmine boot files from the - installed jasmine-core, making it easier and more reliable to upgrade in - the future. We also had vendored in sourcemapped-stacktrace, which - I've changed to also come entirely from npm. I've also ported our old jasmine-hide-filtered and jasmine-sourcemaps
~ code to TypeScript. ~ code to TypeScript. + + -
jquery-ui's JavaScript was being pulled from
node_modules, but we
had vendored in a copy of the CSS and some of the images. Fixing this
required some build-time shenanigans inside settings.py to find the
relevant files.
+ -
Masonry (used in the admin dashboard) is a very simple update,
especially since there haven't been any new versions at all.
Simplify browserslist.
Instead of a complicated browserslist config, I've changed it to just
specify baseline widely available. This ends up pulling in a fewmore older versions of browsers than our old config did, but it seems like it's the right choice in the current age. Fix an issue in the page-banner CSS.
The newer version of LESS correctly identified
:not('.ink-c-button')as an error. I've removed the quotes so that CSS builds properly. - We now rely on the new
- Testing Done:
-
- Smoke tested the dev server.
~ - Built static media and verified that everything looked correct,
especially the core-js polyfills.
~ - Built static media and verified that everything looked correct,
especially the core-js polyfills and jQuery-UI stylesheets.
- Ran python tests.
- Ran js-tests.
- Ran eslint (eek).
- Built the rbintegrations extension to verify that static media
building still worked for that.
- Ran
build-storybook
- Ran the storybook and flipped through the couple components that are
there. Verified that things worked as expected.
+ - Verified that things that used jQuery-UI (comment dialog, autocomplete
fields) looked correct.
- Commits:
-
Summary ID opkxnmsquyvssqtotyvtqnlpnpmsnpyl opkxnmsquyvssqtotyvtqnlpnpmsnpyl - Diff:
-
Revision 2 (+698 -34940)
- Change Summary:
-
- Ensure that the beanbag plugin is actually loaded for eslint.
- Use the 3rdparty rollup config for
djblets/static/libso the new selectize index.ts doesn't bundle an extra copy of jquery.
- Commits:
-
Summary ID opkxnmsquyvssqtotyvtqnlpnpmsnpyl opkxnmsquyvssqtotyvtqnlpnpmsnpyl - Diff:
-
Revision 3 (+708 -34942)