Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@strv/docs

Package Overview
Dependencies
Maintainers
4
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@strv/docs

An opinionated Docusaurus preset by @strvcom

  • 0.1.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

@strv/docs

Built with ❤️ at STRV

An opinionated Docusaurus setup by @strvcom, used to help document products.

Introduction

This library is a pre-configured Docusarus setup generator, originally used to create the documentation for the STRV Website. It is composed of a set of defaults that aim at simplifying and standardizing the process of documenting projects – inside, and possibly beyond STRV.

If used to the fullest, this setup includes:

  • An index homepage
  • A general documentation builder (getting started, contributing, etc)
  • A components documentation (architecture, codebase, etc)
  • A section for ADRs (for architectural decision records)
  • A client-side search system for the above
  • Navbar links for the above
  • A code-fragment rehype plugin

All of these are opt-outs, meaning they can easily be disabled through configuration, but will be on by default.

In the end, @strv/docs main output is a Docusaurus config, and further configurations are possible and expected for each project's specific needs.

Setup

1. Install the library:

yarn add --dev @strv/docs

2. Setup docusaurus.config.js:

Create a docusaurus.config.js file on the root folder. This is a minimal example:

module.exports = require('@strv/docs').docs({
  title: 'Example Project',
  url: 'https://docs-website.com/',
  baseUrl: '/',
})

For a more complete example, check the example project's configuration.

3. Add docs scripts (optional):

Add Docusaurus building scripts to package.json:

{
  "scripts": {
    "docs:start": "docusaurus start -p 8001",
    "docs:build": "docusaurus build --out-dir build-docs",
    "docs:clear": "docusaurus clear",
    "docs:serve": "docusaurus serve -p 8001 --dir build-docs"
  }
}

Configuration

By default, @strv/docs will try to guess which features you want to enable by checking the presence of some files in your project. Alternatively, these features can be turn-off manually at the docusaurus.config.js:

module.exports = require('@strv/docs').docs({
  customFields: {
    strv: {
      homepage: false, // disable the homepage index
      pages: false, // disable pages plugin
      docs: false, // disable general docs, found at /docs/general
      adr: false, // disable adr docs, found ar /docs/adr
      components: false, // disable components docs, spread across /src files
      changelog: false, // disable Changelog link adding
      github: false, // disable GitHub links
    },
  },
})

For some configuration above, no extra effort is needed. Some of them, however, require that you start creating docs in specific locations. Furthermore, the doc generating modules – docs, adr, and `component``- will use automated sidebars, which can be overriden by placing a sidebar file on specific locations:

ModuleDescriptionWatched filesCustom sidebar
PagesAdd isolated React or MDX pages. You should add these pages to navbar or other links to get access to them../docs/pages/**/*.(md|mdx|js|jsx|ts|tsx)
GeneralMeant for general docs, not related to application logic./docs/general/**/*.(md|mdx)./docs/general/sidebar.js
ADRMeant for architectural decision records./docs/adr/**/*.(md|mdx)./docs/adr/sidebar.js
ComponentsMeant for documenting current codebase components./src/**/*.(md|mdx)./docs/components-sidebar.js

Custom components source path

In case you want the components documentation to watch a different directory than /src, you can configure it in the docusaurus.config.js like so:

module.exports = require('@strv/docs').docs({
  customFields: {
    strv: {
      components: 'source', // would look for doc files under ./source/ dir
    },
  },
})

Be careful not to set a path that overlaps any other documentation kinds.

Keywords

FAQs

Package last updated on 04 Apr 2022

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