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

@oneie/plugin-docs

v0.1.2

Published

ONE docs — Astro content collection with sidebar nav, search, code blocks, and versioning

Readme

@oneie/plugin-docs

ONE docs plugin — Astro content collection with sidebar nav, search, code blocks, and versioning. Ships full source to your repo (free tier).

Install

bun add @oneie/plugin-docs

one.config.ts

import { defineOne } from '@oneie/frontend'
import { docs } from '@oneie/plugin-docs'

export default defineOne({
  plugins: [
    docs({
      docsDir: 'src/content/docs',       // default
      injectRoutes: true,                 // default
      editBaseUrl: 'https://github.com/your-org/your-repo/edit/main',
      sidebar: [
        { folder: 'getting-started', label: 'Getting Started', icon: '🚀' },
        { folder: 'guides',          label: 'Guides',          icon: '📖' },
        { folder: 'reference',       label: 'Reference',       icon: '📐' },
      ],
    }),
  ],
})

Content collection schema

Create src/content/config.ts (or add to your existing one):

import { defineCollection, z } from 'astro:content'

const docs = defineCollection({
  type: 'content',
  schema: z.object({
    title: z.string(),
    description: z.string().optional(),
    /** Numeric sort order within the folder. Lower = first. */
    order: z.number().optional(),
    /** Optional category tag for filtering */
    category: z.string().optional(),
  }),
})

export const collections = { docs }

Files live at src/content/docs/**/*.md or .mdx. The first path segment becomes the sidebar folder:

src/content/docs/
  getting-started/
    introduction.md      # slug: getting-started/introduction
    installation.md      # slug: getting-started/installation
  guides/
    deployment.md        # slug: guides/deployment
  reference/
    api.md               # slug: reference/api

Usage — [slug].astro

Create src/pages/docs/[slug].astro:

---
import { getCollection, getEntry } from 'astro:content'
import DocsLayout from '@oneie/plugin-docs/DocsLayout.astro'

export async function getStaticPaths() {
  const docs = await getCollection('docs')
  return docs.map((entry) => ({
    params: { slug: entry.id },
    props: { entry },
  }))
}

const { entry } = Astro.props
const allDocs = await getCollection('docs')
const { Content, headings } = await entry.render()
---

<DocsLayout
  entry={entry}
  entries={allDocs}
  headings={headings}
  editBaseUrl="https://github.com/your-org/your-repo/edit/main/src/content/docs"
  sidebar={[
    { folder: 'getting-started', label: 'Getting Started' },
    { folder: 'guides', label: 'Guides' },
    { folder: 'reference', label: 'Reference' },
  ]}
>
  <Content />
</DocsLayout>

Docs landing page — /docs/index.astro

---
import DocsIndex from '@oneie/plugin-docs/DocsIndex.astro'
---

<DocsIndex
  title="Documentation"
  description="Everything you need to get up and running."
/>

Sidebar order

Folders render in the order declared in the sidebar array. Entries within each folder sort by order (frontmatter) then alphabetically by title. Folders not listed in sidebar append after the configured ones.

editBaseUrl — GitHub edit links

Set editBaseUrl to the raw path of your docs directory on GitHub:

https://github.com/your-org/your-repo/edit/main/src/content/docs

An "Edit this page on GitHub" link appears at the bottom of every doc, pointing to editBaseUrl/entry.id.

Components (standalone use)

import { DocSearch } from '@oneie/plugin-docs/DocSearch.tsx'
import { SidebarDocs } from '@oneie/plugin-docs/SidebarDocs.tsx'
import { CodeBlock } from '@oneie/plugin-docs/CodeBlock.tsx'

// Search bar
<DocSearch value={currentSearch} placeholder="Search…" />

// Sidebar (requires React state for collapsible folders)
<SidebarDocs entries={entries} currentSlug={slug} sidebar={sidebarConfig} />

// Code block with copy button
<CodeBlock code={`const x = 1`} language="ts" filename="example.ts" />

License

ONE License — full commercial use, keep the ONE brand link. See LICENSE.