Repository navigation
Fix: Add migration scripts for legacy YouTube _media properties (fixes #49) - #50
Conversation
This needs to be solved elsewhere. It should be fine to have a plugin with no |
Do you mean the migration script isn't needed or that the schema default fix should happen in a separate PR? |
Add two migration scripts for the adapt-youtube plugin: - migrations/v1.js: migration from v1.0.2–<1.2.0 to 1.2.0. Renames global _globals._youtube.transcriptButton to skipToTranscript, adds _media._controls and _media._allowFullscreen to youtube components when missing, ensures _transcript exists on components, updates plugin metadata to 1.2.0, and includes unit tests and guards. - migrations/v2.js: migration from v2.1.0–<2.1.1 to 2.1.1. Adds _media._playsinline (false) to youtube components that have _media but lack _playsinline, updates plugin metadata to 2.1.1, and includes tests and stop conditions. Both files include checks to validate changes and test cases covering expected and guard scenarios.
|
Adding migrations for v1 & v2. |
Add // @ts-nocheck to the migration file, change direct assignment of _transcript to use _.set for safer mutation, and update a testStopWhere description to clarify that no migration is needed when YouTube components already have the required properties.
|
🎉 This PR is included in version 3.3.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Fixes #49
Fix
migrations/directory (the plugin previously shipped none). The new migration reconciles legacy course content against the current component schema so it imports cleanly into the Adapt Authoring Tool instead of aborting._media._aspectRatiofrom a string (e.g."1.778") to a number. Non-numeric strings are left untouched so no data is destroyed, and values already stored as numbers are skipped._media._progressColorfrom the stray value"default"(never a member of the schema enum) to"red", matching the modern schema default. Existing"red"/"white"values are left alone._progressColorfrom"default"to"red", so the Authoring Tool stops writing the invalid value into new content.Dependencies
semantic-release-replace-pluginso the migration's@@CURRENT_VERSION/@@RELEASE_VERSIONplaceholders resolve to real version numbers on release. This required bumpingsemantic-releaseto^21.0.1(the replace plugin's peer requirement), matching other adaptlearning plugins that ship migrations.Testing
grunt migration:test --file=adapt-youtube._media._aspectRatiois a quoted string, import it into an Authoring Tool instance whose framework types that field as a number, and confirm the import now succeeds without manual JSON edits.Posted via collaboration with Claude Code