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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-documentor

v1.0.4

Published

Living documentation for your components with build in routing

Downloads

6

Readme

Vue documentor

Vue-documentor

As your project and codebase grows the number of components grows rapidly with it and you will properly have a hard time to remember what a component is used for and what props it'll take. With this in mind i have created vue-documentor.

An easy to use and easy to extend package for displaying component documentation.

Vue-documentor will scaffold routing and documentation for all of your components. Vue-documentor is a addon for the vue router. Simply just pull in the package and add a method to your routing. Voila. You got component documentation!

Installation

Vue-documentor is available as a npm package at

yarn add vue-documentor

or

npm install vue-documentor

Getting started

  1. Install vue-documentor

    yarn add vue-documentor

  2. Add vue-documentor to routing and parse your components
  3. Profit!

You need to add three properties to your components. A name, an introduction and a token (the html tag).

All props on a component need to be defined as Objects with a type and a note.

In your router-file import vue-documentor and use the mapDocumentorRoutes-function.

Example components:

export default {
    name: 'component-a',
    introduction: 'This is the ComponentA',
    description: 'Renders a collection of items',
    token: '<component-a :items="[{}]" />',
    props: {
        items: {
            type: Array, 
            required: true, 
            note: 'The collection that will be rendered'
        }
    }
}

Router

import {mapDocumentorRoutes} from 'vue-documentor' 
import ComponentA from '@/components/ComponentA'
import ComponentB from '@/components/ComponentB'
import ComponentC from '@/components/ComponentC'

new Router({
    // Define your own routes
    // {path: '/', name: 'Home', component: Home},
    ...mapDocumentorRoutes({
        ComponentA,
        ComponentB,
        ComponentC,
        // ...
    })
})

Export all components at once

An easy way to include all your components is to create a file that exports all of them.

// components/index.js

import ComponentA from './ComponentA'
import ComponentB from './ComponentB'
import ComponentC from './ComponentC'

export {
    ComponentA,
    ComponentB,
    ComponentC
}

You will then in your router file be able to get rid of all those imports

You will now be able to import * from the component-file

eg:

import * as AllComponents from './components'

new Router({
    ...mapDocumentorRoutes(AllComponents)
})

You will now be able to visit /#/documentor to see your vue-documentor

Theming

You can easily create your own theme by copying the vue-documentor/style directory to your own assets.

cp node_modules/vue-documentor/style src/assets/vue-documentor-theme

Inspired by

This package is inspired by https://github.com/propellant/doctor/.

TODO:

  • [x] Options: Add uri
  • [ ] Options: Add ability to use own component for rendering a collection of components
  • [ ] Options: Add ability to use own component for rendering a single doc item
  • [ ] Add testing utils to pull in for testing your own component