Skip to content

Manage vis-network via foreign-resources#99

Merged
alistair3149 merged 1 commit into
masterfrom
manage-vis-network
May 8, 2026
Merged

Manage vis-network via foreign-resources#99
alistair3149 merged 1 commit into
masterfrom
manage-vis-network

Conversation

@alistair3149
Copy link
Copy Markdown
Member

@alistair3149 alistair3149 commented May 8, 2026

Summary

Bring the bundled vis-network library under MediaWiki's foreign-resources management. The 1.5 MB blob at resources/lib/vis-network.js previously had no metadata; now its source URL, version, license, homepage, authors, and SRI hash are declared explicitly, future upgrades flow through manageForeignResources.php, and CI fails if the on-disk bytes drift from the declared integrity.

  • extension.json gains a top-level ForeignResourcesDir: "resources/lib" attribute (the convention manageForeignResources.php --extension Network recognises).
  • New resources/lib/foreign-resources.yaml declares vis-network 8.5.5 as a type: tar entry against the npm tarball (registry.npmjs.org/vis-network/-/vis-network-8.5.5.tgz) with sha384 integrity, purl, license, homepage, and version. The dest map extracts the standalone UMD JS plus both LICENSE files (Apache-2.0 and MIT, since the package is dual-licensed).
  • Library relocation: resources/lib/vis-network.jsresources/lib/vis-network/vis-network.js, matching the layout manageForeignResources update produces. Pure 100%-similarity git rename — bytes unchanged, runtime behaviour unchanged. ext.network's scripts path is updated accordingly.
  • License files vendored at resources/lib/vis-network/LICENSE-APACHE-2.0 and resources/lib/vis-network/LICENSE-MIT, extracted from the upstream tarball.
  • README.md gains an "Upgrading vis-network" subsection under "Development" documenting the make-sri / update / verify / make-cdx workflow.
  • CI: the static-analysis job runs manageForeignResources verify --extension Network to catch any future drift between the on-disk bytes and the declared integrity hash.

The vis-network version (8.5.5) is unchanged in this PR. With the management infrastructure in place a future version bump becomes mostly a YAML edit plus regression-testing the new release's behaviour.

Test plan

  • php maintenance/run.php manageForeignResources verify --extension Network succeeds (the on-disk bytes match the declared integrity)
  • php maintenance/run.php manageForeignResources update --extension Network round-trips: re-downloads the tarball, extracts the same files into the same locations, verify still passes
  • composer phpunit — 36/36
  • vendor/bin/phpcs -p -s — clean
  • vendor/bin/phpstan analyse — No errors
  • vendor/bin/psalm — No errors found
  • HTTP 200 on the new `/w/extensions/Network/resources/lib/vis-network/vis-network.js` URL; runtime smoke shows networks still render
  • CI: all 5 PHPUnit matrix rows + static-analysis (with the new `Verify foreign resources` step) + code-style pass

Declares the bundled vis-network library through MediaWiki's
foreign-resources mechanism, so source URL, version, license,
homepage, and integrity (SRI) hash are recorded explicitly and
future upgrades flow through manageForeignResources.php.

- extension.json gets a top-level ForeignResourcesDir attribute
  pointing at resources/lib, the convention recognised by
  manageForeignResources.php's --extension flag.
- A new resources/lib/foreign-resources.yaml declares vis-network
  8.5.5 as a 'tar' entry pointing at the npm tarball, with a
  sha384 integrity matching the upstream tarball, plus purl,
  license, homepage, authors, and version. The dest map extracts
  the standalone UMD vis-network.js plus both LICENSE files
  (Apache-2.0, MIT) for compliance.
- The library moves from resources/lib/vis-network.js to
  resources/lib/vis-network/vis-network.js to match the file
  layout manageForeignResources.php's update action produces.
  Bytes unchanged; runtime behaviour unchanged. The ext.network
  ResourceModule's script path is updated.
- The two LICENSE files are vendored alongside the library.
- README.md gains an 'Upgrading vis-network' subsection under
  Development that documents the make-sri / update / verify /
  make-cdx workflow.
- CI's static-analysis job runs 'manageForeignResources verify'
  to catch drift between the on-disk file and the declared
  integrity hash.

The current vis-network version (8.5.5) is unchanged here. With the
infrastructure in place a version bump becomes mostly a YAML edit
plus regression-testing the new behaviour.
@alistair3149 alistair3149 marked this pull request as ready for review May 8, 2026 21:19
@alistair3149 alistair3149 merged commit bc4fe95 into master May 8, 2026
7 checks passed
@alistair3149 alistair3149 deleted the manage-vis-network branch May 8, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant