Make the package.json file in Djblets the primary dependency source.
Review Request #12797 — Created Jan. 21, 2023 and submitted
Historically, we've auto-generated
package.jsonin Djblets in order to
have some handy variables that could be used for extension building, to
help keep versions of dependencies manageable by declaring them in
to maintain. We have to make changes to the generated
then mirror them back to
an ignored file, and we had to be careful with its contents.
This change reverses the role. Now,
djblets/package.jsonis where all
of our NPM dependencies live, and we have a symlink within the top of
the tree to there. Whenever we perform a
npm install --save ...(and,
notably, the result of that modifies
node_modules), NPM will run a new
script to edit
dependencies.pyand move those dependencies there.
This way, it should be easier to ensure that we have the right
dependencies in the tree for building static media, looking up types, or
linting the files.
There is a trade-off in that we no longer have the newly-introduced
environment variables for specifying the location of in-development
versions of our Beanbag node.js modules. These made it easier to specify
the path to a package and install it.
The workaround for that is to use
npm install --no-save <path>when we
want to test a local version, or use the
npm linkfunctionality. It's
not ideal, but the benefits outweigh the downsides.
package.jsonnow bundles the latest versions of Backbone, jQuery,
jQuery-UI, and typing modules. These will be installed in
when building the package, when building extensions, or when consuming
Djblets and using the embedded dependencies. This allows typing and
setting things up to let consumers easily bundle compatible versions of
these packages out of
Tested installing and uninstalling dependencies (modifying
in the process) and verifying the updates to
Verified that the dependencies installed with an empty
Removed unused imports.
Revision 2 (+370 -248)
Checks run (2 succeeded)
djblets/so consumers of the Python package can reference it more easily.
- Avoided some path re-computations in the new script.
Revision 3 (+380 -248)