0.0.9 • Published 2 years ago

@krofdrakula/prop-docs-storybook v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

This package is part of the @krofdrakula/prop-docs-* ecosystem. Please visit the monorepository for a complete guide:

https://github.com/krofdrakula/prop-docs

Storybook

yarn add @krofdrakula/prop-docs-storybook

When provided with an extracted Type this package will enable you to create an ArgTypes description for a specific component.

For example, extracting a Preact component requires parsing the components using @krofdrakula/prop-docs-preact and then using convertType to return the correct description:

import { Project } from "ts-morph";
import { getPropsType } from "@krofdrakula/prop-docs-preact";
import { extractCSF, convertType } from "@krofdrakula/prop-docs-storybook";

const project = new Project();
// this project assumes that `components.tsx` exists as in the Preact example
const { Profile } = extractCSF(project, "components.tsx", getPropsType);
const profileArgTypes = convertType(Profile);
//    ^? {
//         name: {
//           type: { name: "string", required: true },
//           description: "Person's name"
//         },
//         image: {
//           type: { name: "string", required: true },
//           description: "Person's image URL"
//         }
//       }
0.0.3

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago