New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ds-pack/babel-plugin-docs

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ds-pack/babel-plugin-docs

A collection of babel tooling for collecting documentation from source code of components and hooks.

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Babel Plugin Docs

A collection of babel tooling for collecting documentation from source code of components and hooks.

Usage

⚠️ This plugin might not be ready for primetime! I encourage experimenting with it and reporting any issues you encounter!

Installation

yarn add @ds-pack/babel-plugin-docs -D
# or if you use npm
npm install -D @ds-pack/babel-plugin-docs

Configuring

Within your babel config, add the following:

plugins: [
  [
    '@ds-pack/babel-plugin-docs/plugin',
    {
      // optional, defaults to `'src'`
      // Where the source code exists for the library within the project
      sourceDirectory: 'src',
      // optional, defaults to `'dist'`
      // Where babel will generally output the compiled files to
      outputDirectory: 'dist',
      // optional, defaults to false
      // If true, the metadata file won't be written to the filesystem
      // if false, the metadata file will be written to `<outputDirectory>/<filename>.metadata.js`
      skipWriteFile: false,
      // optional, defualts to `'metadata'`
      // Will be the postfix on the generated file (if skipWriteFile is false)
      // e.g. if your filename is `AvatarButton.js` the output will be
      // `AvatarButton.metadata.js`
      outputPostfix: 'metadata',
    },
  ],
]

Tools:

  • Babel
  • Jest

TODO:

  • Add functionality for propertyControls
  • Enumerate all open TODOs in the code
  • Add tests for open TODOs

Architecture and Design

This project is meant to be collection of babel tooling around documenting code. Currently (as of June 2020) it primarily ships a babel plugin that extracts documentation from React components and custom React hooks. In the future it might split the visitors out as individual exports to enable a plugin-like architecture.

We have opted to write to an external file instead of ammending the current file being visited by babel to ensure that the code added via this plugin doesn't impact the production bundle size of applications consuming your library.

FAQs

Package last updated on 19 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc