• 
      

    Make the package.json file in Djblets the primary dependency source.

    Review Request #12797 — Created Jan. 21, 2023 and submitted — Latest diff uploaded

    Information

    Djblets
    release-4.x

    Reviewers

    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 generated package.json and
    then mirror them back to dependencies.py. The package.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 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 we
    want to test a local version, or use the npm 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 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.

    Tested installing and uninstalling dependencies (modifying package.json
    in the process) and verifying the updates to dependencies.py.

    Verified that the dependencies installed with an empty node_modules
    using setup.py develop.

    Commits

    Files