npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@dytesdk/upgrade-to-rtk

v0.0.3

Published

Transforms all dyte imports to new cloudflare realtimekit imports

Readme

Dyte to RTK Codemod

This repository contains an executable script to update all your code references that use imports and packages from @dytesdk/** packages to @cloudflare/** packages.

The package also removes the previous dytesdk packages and installs the new cloudflare pacakges

eg.

import { DyteParticipantTile } from "@dytesdk/react-ui-kit";
import { useDyteMeeting } from "@dytesdk/react-web-core";

function Meeting() {
  const { meeting } = useDyteMeeting();
  <DyteParticipantTile
    ...
    meeting={meeting}
    ...
  />;
}

will get automatically udpated to

import { RtkParticipantTile } from '@cloudflare/realtimekit-react-ui';
import { useRealtimeKitMeeting } from '@cloudflare/realtimekit-react';

function Meeting() {
  const { meeting } = useRealtimeKitMeeting();
  <RtkParticipantTile
    ...
    meeting={meeting}
    ...
  />;
}

The script also accomodates

Alias imports

import {
  DyteProvider as YoloProvider,
  useDyteClient as useYoloClient,
} from "@dytesdk/react-web-core";

function App() {
  const [meeting, initMeeting] = useYoloClient();

  useEffect(() => {
    initMeeting({
      authToken: "",
      defaults: {
        audio: false,
        video: false,
      },
    });
  }, []);

  <YoloProvider value={meeting}>
    <Meeting />
  </YoloProvider>;
}

gets updated to

// @ts-nocheck
import {
  RealtimeKitProvider as YoloProvider,
  useRealtimeKitClient as useYoloClient,
} from "@cloudflare/realtimekit-react";

function App() {
  const [meeting, initMeeting] = useYoloClient();

  useEffect(() => {
    initMeeting({
      authToken: "",
      defaults: {
        audio: false,
        video: false,
      },
    });
  }, []);

  <YoloProvider value={meeting}>
    <Meeting />
  </YoloProvider>;
}

Namespace imports

import * as DyteComponents from "@dytesdk/react-ui-kit";

function Spinner() {
  return <DyteComponents.DyteSpinner className="w-12 h-12 text-blue-600" />;
}

gets updated to

import * as DyteComponents from "@cloudflare/realtimekit-react-ui";

function Spinner() {
  return <DyteComponents.RtkSpinner className="w-12 h-12 text-blue-600" />;
}

(You would have to change your Namespaces accordingly)

Direct type imports

import { DyteSidebarView } from "@dytesdk/ui-kit/dist/types/components/dyte-sidebar-ui/dyte-sidebar-ui";
import { DyteSidebarSection } from "@dytesdk/ui-kit/dist/types/components/dyte-sidebar/dyte-sidebar";
import type { DyteParticipant, DytePlugin, DyteSelf } from "@dytesdk/web-core";

function SidebarWithCustomUI() {
  const [view, setView] = useState<DyteSidebarView>("sidebar");
  const [section, setSection] = useState<DyteSidebarSection>();
  const pluginsRef = useRef<DytePlugin[]>([]);
  const screensharesRef = useRef<(DyteParticipant | DyteSelf)[]>([]);
}

gets updated to

import { RtkSidebarView } from "@cloudflare/realtimekit-ui/dist/types/components/rtk-sidebar-ui/rtk-sidebar-ui";
import { RtkSidebarSection } from "@cloudflare/realtimekit-ui/dist/types/components/rtk-sidebar/rtk-sidebar";
import type {
  RTKParticipant,
  RTKPlugin,
  RTKSelf,
} from "@cloudflare/realtimekit";

function SidebarWithCustomUI() {
  const [view, setView] = useState<RtkSidebarView>("sidebar");
  const [section, setSection] = useState<RtkSidebarSection>();
  const pluginsRef = useRef<RTKPlugin[]>([]);
  const screensharesRef = useRef<(RTKParticipant | RTKSelf)[]>([]);
}

Event listener names

There was one case from the ui-kit where we had an event being emitted called dyteStateUpdate and uses of this are also updated to rtkStateUpdate

document.body.addEventListener("dyteStateUpdate", handleDyteStateUpdate);
document.body.on("dyteStateUpdate", handleDyteStateUpdate);

return () => {
  document.body.removeEventListener("dyteStateUpdate", handleDyteStateUpdate);
  document.body.off("dyteStateUpdate", handleDyteStateUpdate);
};

gets updated to

document.body.addEventListener("rtkStateUpdate", handleDyteStateUpdate);
document.body.on("rtkStateUpdate", handleDyteStateUpdate);

return () => {
  document.body.removeEventListener("rtkStateUpdate", handleDyteStateUpdate);
  document.body.off("rtkStateUpdate", handleDyteStateUpdate);
};

Usage

npx @dytesdk/upgrade-to-rtk <path> # . by default

Ensure that the path you are running on is the parent folder containing the package.json

Setting up locally

  1. The best way to test is creating an expected *.input.* file and a corresponding expected *.output.* file in the bin/transforms/__testfixtures__ folder

  2. After that add the test to bin/transforms/__tests__/dyte-to-rtk.ts

  3. Finally, running npm t should test your changes with all existing files and the new change you have created.

If you would like to run the codemod locally on a repo you may run,

npm i
npm run dev
cd /path/to/desired/repo
npx /path/to/upgrade-to-rtk-repo

Issues

The entire codemod was tested with the dyte react samples repo and hence most test cases and conditions are derived from there, if you see any issues on your codebase please raise and issue! And as always PRs are welcome :)