Skip to content

Fix Generate Contributors PNG workflow: convert script to ESM - #9055

Open
Vaivaswat2244 wants to merge 1 commit into
processing:mainfrom
Vaivaswat2244:pngfix
Open

Fix Generate Contributors PNG workflow: convert script to ESM#9055
Vaivaswat2244 wants to merge 1 commit into
processing:mainfrom
Vaivaswat2244:pngfix

Conversation

@Vaivaswat2244

Copy link
Copy Markdown
Contributor

Changes

The Generate Contributors PNG workflow fails on every run with ReferenceError: require is not defined in ES module scope. utils/contributors-png.js is CommonJS, but package.json has "type": "module", so Node resolves it as ESM. It fails on every Node version — the script was added a month after the repo switched to ESM and has never worked, which is why contributors.png has only ever been updated by hand.

  • Renamed utils/contributors-png.jsutils/contributors-png.mjs and converted it to ESM (import instead of require, top-level await instead of the async IIFE). Matches utils/, where every other script is already .mjs.
  • Updated the run: step in .github/workflows/contributors-png.yml.

No behaviour change beyond the module format.

The workflow can't run on a PR (on: push filtered to .all-contributorsrc, gated on refs/heads/main), so tested on a fork: . This is a stopgap — the script is meant to be replaced by processing/all-contributors-image#4.

Screenshots of the change

PR Checklist

@p5-bot

p5-bot Bot commented Aug 8, 2026

Copy link
Copy Markdown

Continuous Release

CDN link

Published Packages

Commit hash: cef6e05

Previous deployments

This is an automated message.

@skyash-dev

skyash-dev commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

@Vaivaswat2244 thank you for spotting this one, good work!

traced this back to the branch switch(#8871), when 2.x became main. the workflow had previously been running against the v1 branch, where contributors-png.js was treated as cjs. on the new main, package.json has "type": "module", so node treats the .js generator as esm and require() fails.

tldr; the script worked fine before the default branch switched to v2.

also tested the fix locally, @ksen0 we can merge this one!
image

@Vaivaswat2244

Copy link
Copy Markdown
Contributor Author

Thanks for the confirmation @skyash-dev . Though this is still a stopgap and this should be perma fixed with processing/all-contributors-image#4

I have left some reviews there, which should help the pr converge to approval soon. Thanks again

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.

2 participants