Add OpenProcessing example synchronization tooling - #1577
Conversation
|
Hi @Yisakor-Mirany Thank you for your work so far on this PR. While testing "npm run sync:openprocessing" on Windows, I encountered the following error: ENOENT: no such file or directory, open ...\p5js-website-2.0\code.js I also checked the attribution requirement from #1445. The new exampleAttribution.ts utility and the existing src/layouts/ExampleLayout.astro file each work out the authors, collective attribution year, and licence separately. This means the same attribution rules are still written in two places. Since #1445 asks for these rules to be defined once, could they be moved into one shared function that is used by both the website layout and the OpenProcessing sketch comments? Thank you. |
|
Hi @Nwakaego-Ego . Thank you for the detailed feedback! I’ve addressed both points. I updated the path handling to use dirname() and join() so it works correctly across operating systems and added test coverage for Windows-style paths. I also refactored the attribution logic so the shared rules are defined in one place and reused by both the website layout and OpenProcessing synchronization. I pushed the updates to the PR, and all tests/checks are now passing. Please let me know if there’s anything else you’d like me to adjust. |
Summary
This PR begins implementing #1445 by adding tooling to synchronize p5.js website examples with an OpenProcessing curation.
The current implementation loads the English examples from the p5.js website, prepares their code and attribution data, connects to the OpenProcessing API, and compares the website examples against a configured OpenProcessing curation.
What changed
OPENPROCESSING_TOKENandOPENPROCESSING_CURATION_IDenvironment variables.npm run sync:openprocessing.Current behavior
The sync command currently performs a safe dry run:
It:
No OpenProcessing sketches are modified during the dry run.
Testing
Full test suite:
Project checks:
I also tested the sync script against a separate OpenProcessing test curation.
Screenshots
OpenProcessing sync dry run
Automated tests
Configuration
The integration expects the following environment variables:
No API credentials are committed to the repository.
Remaining work / feedback requested
The current PR establishes the synchronization, comparison, API, and attribution foundation.
I would especially appreciate guidance on the intended OpenProcessing API endpoint/payload for creating or updating the actual sketches before adding them to the curation by
visualID.Once that flow is confirmed, the synchronization can be extended to create/update missing sketches and remove outdated entries from the curation.
Related to #1445