Skip to content

feat(gamut-codemods): move Video imports and add Markdown video overrides - #40

Open
dreamwasp wants to merge 6 commits into
cass-gmt-1790-scope-renamefrom
cass-gmt-1790-video-markdown
Open

dreamwasp wants to merge 6 commits into
cass-gmt-1790-scope-renamefrom
cass-gmt-1790-video-markdown

Conversation

@dreamwasp

@dreamwasp dreamwasp commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Breaking change: Video and VideoProps are no longer on the root export, and <Markdown> no longer renders <iframe> and <video> through Video by default. This PR has the codemod for both, plus the Gamut-side Video and Markdown fixes.

Stack (split from #28, merge in order):

  1. feat(gamut-codemods): add the codemods CLI and an empty scope-swap preset #38 Scaffold, based on main
  2. feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39 Package scope rename and gamut-kit removal, based on feat(gamut-codemods): add the codemods CLI and an empty scope-swap preset #38
  3. feat(gamut-codemods): move Video imports and add Markdown video overrides #40 Video and Markdown, based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39 👈 this PR
  4. feat(gamut)!: promote deep imports to the root, renaming Menu and SelectDropdown elements #41 Deep imports and Menu/SelectDropdown renames, based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39
  5. feat(gamut-codemods): rename the ESLint plugin prefix in scope-swap #42 ESLint plugin prefix, based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39
  6. feat(gamut-codemods): warn about esmExternals: false in next.config #43 Next.js esmExternals warning, based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39
  7. build(deps): make @skillsoft packages easier to install #44 Simpler dependencies (independent), based on main
  8. feat(gamut-agent-tools): add the gamut-scope-swap skill #45 gamut-scope-swap skill (open last), based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39, includes feat(gamut-codemods): move Video imports and add Markdown video overrides #40–feat(gamut-codemods): warn about esmExternals: false in next.config #43

Codemod

  • moved-exports moves Video/VideoProps imports to @skillsoft/gamut/Video. It splits mixed imports and merges into an existing /Video import. Namespace imports, export *, and mocks that stub Video get a warning instead.
  • markdown-video-overrides adds iframeOverride / videoOverride, with Iframe and MarkdownVideo imported from /Video, to each <Markdown> that didn't opt out, so output stays the same.
    • It replaces the removed skipDefaultOverrides.iframe / .video keys, writing iframeOverride={undefined} where a skip was true.
    • It skips itself when every @codecademy/gamut range in the repo is already 74.0.0 or newer.
  • tsconfig-dom (report only) warns about tsconfigs whose lib has no "dom". Video used to supply the DOM types through the root import.
  • Checklist: the run ends with the @vidstack/react and react-player peers to install.

@skillsoft/gamut

  • Video stub: a Video/package.json stub makes @skillsoft/gamut/Video resolve under moduleResolution: "node". The attw no-resolution ignore that was hiding this is removed.
  • MarkdownVideo: no longer passes NaN width or height when the <video> has none.
  • One-line <video>: <video>...</video> on one line is no longer wrapped in a <p>.
  • Docs: Video's requirements (a bundler that handles CSS imports, and the /Video import path).

PR Checklist

  • Related to designs: N/A
  • Related to JIRA ticket: GMT-1790
  • Changeset added
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions for the code change
  • Package previews from this PR are passing end-to-end tests in all relevant consuming repositories

Testing Instructions

  1. yarn nx test gamut-codemods. Expect 83 tests to pass.

  2. yarn nx test gamut. That includes the two new Markdown tests.

  3. yarn nx run gamut:verify-package. attw now runs without the no-resolution ignore.

  4. Build and run on a throwaway repo:

    yarn nx build gamut-codemods
    mkdir -p /tmp/swap && cd /tmp/swap && git init -q
    printf "import { Box, Markdown, Video } from '@codecademy/gamut';\nexport const P = () => <Box><Markdown text=\"x\" /><Video videoUrl=\"y\" /></Box>;\n" > a.tsx
    echo '{ "compilerOptions": { "lib": ["es2020"] } }' > tsconfig.json
    git add -A && git commit -qm init
    node <repo>/packages/gamut-codemods/dist/bin.js scope-swap .

    a.tsx should import Video, Iframe, and MarkdownVideo from @skillsoft/gamut/Video, and <Markdown> should have both overrides. The next steps should list the Video peers and the tsconfig dom item.

  5. Storybook: the Markdown stories with video still render, and a one-line <video> isn't inside a <p>.

Stacked PRs don't publish pkg.pr.new previews, because preview.yml only runs for PRs into main.

PR Links and Envs

Repository PR Link
Mono N/A

🤖 Generated with Claude Code

…ides

moved-exports moves Video and VideoProps from the root to
@Codecademy/gamut/Video (scope-rename then swaps the scope).
markdown-video-overrides adds explicit iframeOverride/videoOverride to
each <Markdown>, since it no longer renders video through Video by
default, and drops the removed skipDefaultOverrides keys. tsconfig-dom
warns about tsconfigs without "dom", which Video used to supply.

On the Gamut side, a Video/package.json stub makes the subpath resolve
under node10, MarkdownVideo no longer passes NaN sizes, and a one-line
<video> is no longer wrapped in a <p>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dreamwasp and others added 3 commits October 20, 2026 11:10
…migrations

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rkdown

# Conflicts:
#	packages/gamut-codemods/src/presets/scope-swap/index.ts
@dreamwasp
dreamwasp marked this pull request as ready for review October 20, 2026 15:39
@dreamwasp
dreamwasp requested a review from a team as a code owner October 20, 2026 15:39

@LinKCoding LinKCoding left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

I also ran scope-swap on this and got these in next steps:
— next steps —

  1. Video needs two peer dependencies that Gamut no longer installs for you: @vidstack/react and react-player. Gamut supports @vidstack/react 1.12.x only (its npm latest tag is 0.6.x). Install them: yarn add @vidstack/react@~1.12.12 react-player@^3.4.0.
  2. Some tsconfig files set "lib" without "dom" (see the tsconfig-dom warnings). Video no longer loads with the root import, and it was supplying the DOM types. Add "dom" to those files if type-checking fails on document, HTMLElement, ResizeObserver, and so on.
  3. Run your formatter and lint autofix (prettier --write, then eslint --fix). Split imports come out in recast style, @skillsoft sorts differently from @codecademy for import-order rules like simple-import-sort, and the shorter scope lets some wrapped imports fit on one line.
  4. Reinstall (yarn), then type-check and run your tests.
  5. Work through the warnings above and the leftovers list.

^ steps 1 + 2 is 👍

The video + markdown pages in SB loads and works - I didn't see any <video> elements in <p> elements

This branch has not been deployed

No deployments
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