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.json
in 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
djblets/dependencies.py
.As we've evolved our JavaScript ecosystem, this has become more tedious
to maintain. We have to make changes to the generatedpackage.json
and
then mirror them back todependencies.py
. Thepackage.json
file was
an ignored file, and we had to be careful with its contents.This change reverses the role. Now,
djblets/package.json
is where all
of our NPM dependencies live, and we have a symlink within the top of
the tree to there. Whenever we perform anpm install --save ...
(and,
notably, the result of that modifiesnode_modules
), NPM will run a new
script to editdependencies.py
and 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 thenpm link
functionality. It's
not ideal, but the benefits outweigh the downsides.Our
package.json
now bundles the latest versions of Backbone, jQuery,
jQuery-UI, and typing modules. These will be installed innode_modules
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 ofnode_modules
if desired.
Tested installing and uninstalling dependencies (modifying
package.json
in the process) and verifying the updates todependencies.py
.Verified that the dependencies installed with an empty
node_modules
usingsetup.py develop
.
- Change Summary:
-
Removed unused imports.
- Commits:
-
Summary ID d9c6ef54597f33f1c57c7ab93048e35dc9e4b7e4 520ab380566bd7aac83d769623a52ef520fe62a4
Checks run (2 succeeded)
- Change Summary:
-
- Moved
package.json
todjblets/
so consumers of the Python package can reference it more easily. - Avoided some path re-computations in the new script.
- Moved
- Description:
-
Historically, we've auto-generated
package.json
in Djblets in order tohave some handy variables that could be used for extension building, to help keep versions of dependencies manageable by declaring them in djblets/dependencies.py
.As we've evolved our JavaScript ecosystem, this has become more tedious
to maintain. We have to make changes to the generated package.json
andthen mirror them back to dependencies.py
. Thepackage.json
file wasan ignored file, and we had to be careful with its contents. ~ This change reverses the role. Now,
package.json
is where all of our~ NPM dependencies live. 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.py
and move those dependencies~ there. ~ This change reverses the role. Now,
djblets/package.json
is 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.py
and 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 wewant to test a local version, or use the npm link
functionality. It'snot ideal, but the benefits outweigh the downsides. ~ Our
package.json
now bundles the latest versions of both Backbone and~ jQuery. These will be installed for any consumers or extensions, ~ allowing typing and setting things up to let consumers easily bundle ~ compatible versions of these packages out of node_modules
if desired.~ Our
package.json
now bundles the latest versions of Backbone, jQuery,~ jQuery-UI, and typing modules. These will be installed in node_modules
~ 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 node_modules
if desired. - Commits:
-
Summary ID 520ab380566bd7aac83d769623a52ef520fe62a4 de3722110c79f61b765d5aa41dcfefef80766e1d