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

bonsai-book

v2.0.5

Published

<p align="center"> <img src="/src/static/logo.png" height="150px" /> <span align="center" style="font-weight:bold;font-size:35px;">Bonsai Book</span> </p>

Downloads

33

Readme

Introduction

I started Bonsai with the idea of providing an alternative to storybook focused on react and providing less functionnality but with a more quicker way to start using it. If your looking for highly customisable book for sharing your component, i strongly advise you to look at storybook.

If you want a quick way to start a book of your react components, bonsai might be for you.

To provide that powerfull tool without the least amount of configuration needed as possible, bonsai is based on NextJs. It uses the power of Next to provide HMR/auto-reloading of your react components and a routing based on folder structure of your stories.

Getting Started

First you need to add bonsai to your project:

$ yarn add bonsai-book

or

$ npm install bonsai-book

Once it's done, you can create a folder called stories at the root of your project. you can start adding your stories like this :

// index.js
import React from 'react'

export default () => <span style={{ color: 'red' }}>Hello world of bonsai.</span>

To launch your bonsai book add this command to your script in package.json :

// package.json
"scripts": {
  "bonsai": "bonsai-book"
}

By default, bonsai will look for stories at the root of your project, you can change that using configuration.

Once launched, go to http://localhost:3000 and start using bonsai !

Configuration

By default you don't need to provide any configuration, but if you need to modify some behavior, like the directory for stories or adding some configuration to next or webpack, you can add a file bonsai.config.js that return an object, this is the default config used by bonsai :

const config = {
  stories_dir: './stories',
  output_dir: './output',
  next: {},
  include: [process.cwd()],
  webpack: (webpackConfig, opts) => {},
}

To know more about next options and webpack options, you can go to the nextJs config : NextJs Website

Right now the output dir is not used, i hope to add the possibility to export statically the book to upload it later for example.

Issues right now

I'm working on this project for now and the major issue if with reloading the stories after an error in one of your stories. Webpack doesn't reaload after an error in your stories and you need to restart your server.

I'm still working on this and currently have an issue on the plugins, you can follow here if you want to help or just know where thing are heading : #copy-webpack-plugin/#307

Plan

Obvisouly there is still a lot to be done on this project and i will keep working on it as long as i'm interested, obviously if people start using it, i will keep updating and fixing bugs.