Skip to content

feat(ui): added support for Effect.ts playground links#3082

Open
nikelborm wants to merge 1 commit into
npmx-dev:mainfrom
nikelborm:effect-playground
Open

feat(ui): added support for Effect.ts playground links#3082
nikelborm wants to merge 1 commit into
npmx-dev:mainfrom
nikelborm:effect-playground

Conversation

@nikelborm

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Resolves: #3081

🧭 Context

Effect.ts is an ecosystem of libraries that's gaining popularity (26 million downloads/week already for the main effect package). It has a playground page where people can share specific environments prepared for their libraries.

📚 Description

This PR makes packages with Effect.ts playground links in Readmes have them rendered in the right sidebar to encourage experimentation.

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Jul 25, 2026 6:02pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Jul 25, 2026 6:02pm
npmx-lunaria Ignored Ignored Jul 25, 2026 6:02pm

Request Review

@github-actions

Copy link
Copy Markdown

Hello! Thank you for opening your first PR to npmx, @nikelborm! 🚀

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any issues you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 630da15d-54fc-4a93-b63e-a45157af21e2

📥 Commits

Reviewing files that changed from the base of the PR and between d90fea5 and c6eca4f.

📒 Files selected for processing (4)
  • app/components/Package/Playgrounds.vue
  • server/utils/readme.ts
  • test/unit/server/utils/readme.spec.ts
  • uno.theme.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • uno.theme.ts
  • app/components/Package/Playgrounds.vue

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for Effect.ts Playground links in README content (including both hash and base64 ?code= variants).
    • Added Effect provider branding to the UI, including provider-specific icon and color styling.
    • Effect.ts Playground links now display correctly across relevant playground selectors and link rendering.

Walkthrough

Adds Effect.ts playground support by recognising effect.website/play links, validating hash and encoded query variants, and rendering the detected provider with dedicated icon and colour mappings.

Changes

Effect.ts playground support

Layer / File(s) Summary
Playground provider detection
server/utils/readme.ts, test/unit/server/utils/readme.spec.ts
Registers effect-ts-playground for effect.website and /play, with tests covering hash-based and ?code= links.
Provider presentation mapping
uno.theme.ts, app/components/Package/Playgrounds.vue
Adds the Effect provider colour token and maps the provider to its icon and text-colour classes.

Sequence Diagram(s)

sequenceDiagram
  participant ReadmeContent
  participant renderReadmeHtml
  participant PLAYGROUND_PROVIDERS
  participant PlaygroundsVue
  ReadmeContent->>renderReadmeHtml: render Effect.ts playground link
  renderReadmeHtml->>PLAYGROUND_PROVIDERS: match effect.website/play
  PLAYGROUND_PROVIDERS-->>renderReadmeHtml: effect-ts-playground
  renderReadmeHtml-->>PlaygroundsVue: provide playground link
  PlaygroundsVue->>PlaygroundsVue: resolve Effect icon and colour classes
Loading

Suggested reviewers: alexdln

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: Effect.ts playground link support.
Description check ✅ Passed The description is directly related to rendering Effect.ts playground links in the sidebar.
Linked Issues check ✅ Passed The changes match #3081 by detecting, matching, and rendering Effect.ts playground links in the right sidebar.
Out of Scope Changes check ✅ Passed All changes are relevant to Effect.ts playground support, including matching, rendering, styling, and tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@server/utils/readme.ts`:
- Around line 102-107: Update the route matching logic used by the readme
entries so the `effect-ts-playground` path `/play` matches only the exact
pathname or descendants beginning with `/play/`, not prefix-only near matches
such as `/playground` or `/player`. Add a regression test covering these
near-match paths while preserving valid `/play` and nested-route behavior.

In `@test/unit/server/utils/readme.spec.ts`:
- Around line 94-104: Update the test around renderReadmeHtml to assert that
each result.playgroundLinks contains an element before accessing index 0. Add
the presence or expected-length assertion for both result1 and result2, then
retain the existing provider assertions without non-null assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 74d35806-342b-4f99-b7a9-8c889cc86885

📥 Commits

Reviewing files that changed from the base of the PR and between 0690eef and d90fea5.

📒 Files selected for processing (4)
  • app/components/Package/Playgrounds.vue
  • server/utils/readme.ts
  • test/unit/server/utils/readme.spec.ts
  • uno.theme.ts

Comment thread server/utils/readme.ts
Comment on lines +102 to +107
{
id: 'effect-ts-playground',
name: 'Effect.ts Playground',
domains: ['effect.website'],
paths: ['/play'],
icon: 'effect',

@coderabbitai coderabbitai Bot Jul 25, 2026

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Avoid prefix matching for the /play route.

The matcher uses pathname.startsWith(path), so this entry also classifies URLs such as /playground and /player as Effect.ts playgrounds. Match the exact route or a segment descendant (/play and /play/...) and add a near-match regression test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/utils/readme.ts` around lines 102 - 107, Update the route matching
logic used by the readme entries so the `effect-ts-playground` path `/play`
matches only the exact pathname or descendants beginning with `/play/`, not
prefix-only near matches such as `/playground` or `/player`. Add a regression
test covering these near-match paths while preserving valid `/play` and
nested-route behavior.

@nikelborm nikelborm Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The same feedback applies to the TypeScript case, which was used as a base for this addition. Fixing the prefix issue needs refactoring that is outside the scope of this PR.

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.

@nikelborm, agreed — this is pre-existing shared matcher behaviour, including the TypeScript provider, rather than a regression unique to the Effect.ts addition. I’ll leave it out of this PR. Would you like me to open a follow-up issue to tighten path matching across all providers?

Comment on lines +94 to +104
it('extracts Effect.ts playground links', async () => {
const markdown1 = `[Try it!](https://effect.website/play#3efe9f827b7d)`
const result1 = await renderReadmeHtml(markdown1, 'test-pkg')

expect(result1.playgroundLinks[0]!.provider).toBe('effect-ts-playground')

const markdown2 = `[Try it!](https://effect.website/play?code=Y29uc29sZS5sb2coKQ==)`
const result2 = await renderReadmeHtml(markdown2, 'test-pkg')

expect(result2.playgroundLinks[0]!.provider).toBe('effect-ts-playground')
})

@coderabbitai coderabbitai Bot Jul 25, 2026

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the link exists before indexing the array.

Both assertions use playgroundLinks[0]!; if extraction regresses, the test throws an unhelpful runtime error rather than reporting a failed assertion. Assert the expected length or element presence before reading index 0.

As per coding guidelines, array values accessed by index must be checked.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/unit/server/utils/readme.spec.ts` around lines 94 - 104, Update the test
around renderReadmeHtml to assert that each result.playgroundLinks contains an
element before accessing index 0. Add the presence or expected-length assertion
for both result1 and result2, then retain the existing provider assertions
without non-null assertions.

Source: Coding guidelines

@nikelborm nikelborm Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The same feedback applies to the test, which was used as a base for this addition. Polishing the tests regarding this issue needs refactoring that is outside the scope of this PR.

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.

@nikelborm Understood. Keeping this focused on Effect.ts playground support is reasonable; the assertion-pattern cleanup can be handled consistently in a separate test refactor.

Would you like me to open a follow-up issue for it?
🐇💭

@nikelborm

nikelborm commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@nikelborm

nikelborm commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

I would appreciate any hints on how to adapt it better to theme changes. Because I assume it needs refactoring of the underlying component, and it doesn't seem to be in the scope of this PR. Effect.ts's logo is monochrome and doesn't really have the accent color, as all other playground logos do. The brand guidelines explicitly state not to use any color other than black and white here: https://www.effect.website/brand-assets

Screenshot From 2026-07-25 21-09-55 Screenshot From 2026-07-25 21-09-43

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.

Add support for Effect.ts playground links

1 participant