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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yotoplay/twee2yoto

v1.2.0

Published

Convert Twine/Twee JSON to Yoto format

Downloads

11

Readme

twee2yoto

A TypeScript library for converting Twine/TweeJSON to YotoJSON format for interactive audio content.

Related Packages

This package is designed to work together with @yotoplay/twee2json to provide a complete Twee to Yoto conversion pipeline:

  • @yotoplay/twee2json: Converts Twee format to TweeJSON
  • @yotoplay/twee2yoto: Converts TweeJSON to YotoJSON

Complete Workflow

# Convert Twee to TweeJSON
npm install @yotoplay/twee2json
# Then convert TweeJSON to YotoJSON
npm install @yotoplay/twee2yoto

Installation

npm install twee2yoto

Usage

import { convertTweeToYoto, generateTracks } from "twee2yoto";

// Convert Twee JSON to Yoto format
const tweeJson = {
  metadata: {
    title: "My Story",
    init: null,
    data: {
      start: "Start",
      ifid: "12345678-1234-1234-1234-123456789012",
      creator: "Author Name",
    },
  },
  variables: {
    cover: "https://example.com/cover.jpg",
    resumeTimeout: 3600,
  },
  passages: [
    {
      name: "Start",
      metadata: null,
      content: "This is the start of the story.",
      choices: [{ text: "Go to next", link: "Next" }],
      tags: ["start"],
    },
    {
      name: "Next",
      metadata: null,
      content: "This is the next passage.",
      choices: [{ text: "Go back", link: "Start" }],
      tags: ["middle"],
    },
  ],
};

const yotoJson = convertTweeToYoto(tweeJson, { useTags: false });
console.log(yotoJson);

// Generate tracks from audio data
const audioData = [
  {
    key: "passage1",
    contentAudioUrl: "https://example.com/audio1.mp3",
    choices: [{ text: "Next", link: "passage2" }],
  },
];

const tracks = generateTracks(audioData, "aac");
console.log(tracks);

API

convertTweeToYoto(tweeJson: TweeJSON, options: { useTags: boolean }): YotoJSON

Converts a Twee JSON object to Yoto format.

Parameters

  • tweeJson (TweeJSON): The Twee JSON object to convert
  • options (object): Configuration options
    • useTags (boolean): Whether to include passage tags in chapter titles

Returns

A YotoJSON object with the following structure:

interface YotoJSON {
  title?: string;
  slug: string;
  sortkey: string;
  metadata: YotoMetadata;
  updatedAt: string;
  content: YotoContent;
}

generateTracks(audios: GeneratedAudio[], format?: string): Track[]

Generates Yoto track objects from audio data.

Parameters

  • audios (GeneratedAudio[]): Array of audio data objects
  • format (string, optional): Audio format (default: 'aac')

Returns

An array of Track objects with events for interactive navigation.

Types

TweeJSON

interface TweeJSON {
  metadata: Metadata;
  variables: { [key: string]: any };
  passages: Passage[];
}

YotoJSON

interface YotoJSON {
  title?: string;
  slug: string;
  sortkey: string;
  metadata: YotoMetadata;
  updatedAt: string;
  content: YotoContent;
}

GeneratedAudio

interface GeneratedAudio {
  key: string;
  contentAudioUrl: string;
  choices: Choice[];
}

Features

  • Converts Twee JSON to Yoto interactive format
  • Generates navigation events for left/right button and end actions
  • Supports custom cover images and metadata
  • Handles passage tags and choice navigation
  • Configurable audio format support
  • Automatic slug generation from titles
  • Default values for missing metadata

Development

# Install dependencies
npm install

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Build the package
npm run build

# Lint code
npm run lint

# Format code
npm run format:fix

# Run semantic-release locally (for testing)
npm run release

Releases

This project uses semantic-release for automated versioning and publishing. The release process is triggered automatically when changes are pushed to the main branch.

Commit Message Format

To ensure proper versioning, commit messages should follow the Conventional Commits specification:

  • feat: - New features (triggers minor version bump)
  • fix: - Bug fixes (triggers patch version bump)
  • BREAKING CHANGE: - Breaking changes (triggers major version bump)
  • docs: - Documentation changes (no version bump)
  • style: - Code style changes (no version bump)
  • refactor: - Code refactoring (no version bump)
  • test: - Adding or updating tests (no version bump)
  • chore: - Maintenance tasks (no version bump)

Release Process

  1. Push changes to the main branch
  2. GitHub Actions automatically runs tests and builds
  3. If tests pass, semantic-release analyzes commit messages
  4. If a new version is needed, it:
    • Updates the version in package.json
    • Generates release notes
    • Updates CHANGELOG.md
    • Publishes to npm
    • Creates a GitHub release

Manual Release

To run semantic-release locally (for testing):

npm run release

License

MIT