Modernize Review Board JavaScript setup.

Review Request #14647 — Created Oct. 31, 2025 and updated

Information

Review Board
release-7.1.x

Reviewers

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.json file which was
the "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'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.json file which just specifies the workspaces and scripts. All
actual dependencies now live only inside the reviewboard/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-buildkit metapackage for our
    eslint and typescript dependencies.
  • babel-polyfill has been replaced with core-js and the
    useBuiltIns setting 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_dependencies and build-npm-deps.py

It used to be that all our JS dependencies were specified inside
reviewboard/dependencies.py and then we would write out a
package.json file on demand. A while back we inverted that so that
package.json was 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.py script and the associated block
inside reviewboard/dependencies.py.

Stop vendoring jasmine.

We were both getting jasmine-core through 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.

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.
  • 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.
Summary ID
Modernize Review Board JavaScript setup.
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.json` file which was the "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'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.json` file which just specifies the workspaces and scripts. All actual dependencies now live only inside the `reviewboard/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-buildkit` metapackage for our eslint and typescript dependencies. - `babel-polyfill` has been replaced with `core-js` and the `useBuiltIns` setting 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_dependencies` and `build-npm-deps.py` It used to be that all our JS dependencies were specified inside `reviewboard/dependencies.py` and then we would write out a `package.json` file on demand. A while back we inverted that so that `package.json` was 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.py` script and the associated block inside `reviewboard/dependencies.py`. # Stop vendoring jasmine. We were both getting `jasmine-core` through 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. # 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. Testing Done: - Smoke tested the dev server. - Built static media and verified that everything looked correct, especially the core-js polyfills. - 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.
opkxnmsquyvssqtotyvtqnlpnpmsnpyl
Description From Last Updated

module level import not at top of file Column: 1 Error code: E402

reviewbotreviewbot

module level import not at top of file Column: 1 Error code: E402

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8