0.5.1 • Published 3 years ago

pkgtoc v0.5.1

Weekly downloads
104
License
Apache-2.0
Repository
-
Last release
3 years ago

pkgtoc

Markdown table of contents creator for packages

Exploring a monorepo can be really tedious and confusing at first glance. Adding a table of packages to your markdown file will improve discoverablility and allow new users to jump directly to the packages they recognize.

Install

yarn add pkgtoc

Usage

yarn pkgtoc <filename>

Options

  <filename>             File to write table to [README.md]
  --columns <n>          Columns to use [2]
  --dry-run              Don't write file [false]
  --file                 File to write table to [README.md]
  --glob <s>             Glob pattern to search for packages [packages/*]
  --lerna                Use lerna.json packages glob [false]
  --shields              Show NPM versions w/ shields.io [false]
  --shields-auto         Create shields using dynamic URL to support private [false]
  --shields-color <s>    Shield hex color [cb3837]

Shields and Versioning

To support private repos, pkgtoc auto-constructs shields from shields.io. The --shields flag will enable this feature.

By default the shields are set to NPM's red color, you can pass a different hex color in with the --shields-color flag.

Private repos

If you have private repos, you can enable the --shields-auto flag to dynamically construct a shield based on reading your package.json file.

Note: Auto-constructing version shields will cause extra churn in your README file.

Lerna

Passing the --lerna flag will instruct pkgtoc to read from your lerna.json file to grab all of your packages. You can also automate this during releases by the below script to the version script in package.json.

yarn pkgtoc && git add README.md

Custom glob patterns

You can pass a custom glob pattern (e.g. foo/*) with --glob to point to where you keep your packages. Currently only supports a single glob.

Table placement

Tables will go to the top of the file if START/END comments are missing. You can move the comments around to move the placement of the table. These comments <!-- START pkgtoc, keep to allow update --> are for finding/replacing any table content.

Example (create-react-app)

yarn pkgtoc --shields
VersionPackages
babel-plugin-named-asset-import npm badge)babel-plugin-named-asset-importBabel plugin for named asset imports in Create React App
babel-preset-react-app npm badge)babel-preset-react-appBabel preset used by Create React App
confusing-browser-globals npm badge)confusing-browser-globalsA list of browser globals that are often used by mistake instead of local variables
create-react-app npm badge)create-react-appCreate React apps with no build configuration.
eslint-config-react-app npm badge)eslint-config-react-appESLint configuration used by Create React App
react-dev-utils npm badge)react-dev-utilsWebpack utilities used by Create React App
react-error-overlay npm badge)react-error-overlayAn overlay for displaying stack frames.
react-scripts npm badge)react-scriptsConfiguration and scripts for Create React App.
0.5.2-alpha.7

3 years ago

0.5.2-alpha.6

3 years ago

0.5.2-alpha.5

3 years ago

0.5.2-alpha.2

4 years ago

0.5.2-alpha.0

4 years ago

0.5.1

4 years ago

0.5.1-alpha.0

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.5.0

5 years ago

0.4.5-alpha.1

5 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago