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

@puppet/uikit

v1.0.17

Published

A toolkit for generating React projects, components, etc.

Downloads

7

Readme

Puppet UI Toolkit

A toolkit for generating React projects, components, etc.

Prerequisites

Install a recent version of Node.js (including npm), typically the latest LTS version, e.g.:

brew install node@10

Installation

To install uikit (or update it to the latest version) globally, making the uikit command available in your shell:

npm install -g @puppet/uikit

Generators

The uikit includes a script for generating arbitrary boilerplate through template files. Available templates:

  • Project: uikit generate project my-project Generates a puppet React project
  • Page: uikit generate page MyPage Run from the root of a project (generated with the above command). Creates a route, item in navigation, and view component for a new page.
  • Component: uikit generate component MyComponent Generates component boilerplate, including a test and scss file
  • Method: uikit generate method myMethod Generates utility method boilerplate
  • Library: uikit generate library my-library Generates a React library appropriate for publishing as a consumable package

Specifying a directory:

By default the script will generate the template in the current working directory. Optionally you may specify a path to another directory with the --directory (-d) option:

uikit generate <template> <name> -d <path to directory>

Sass modules

Passing a --modules=true or -m option will generate code with scss module support

Contributing

Filing issues

uikit and other design-system projects use the Puppet Design System project in Jira for tracking tickets: https://tickets.puppetlabs.com/browse/PDS

Local uikit for development

If you want to develop in this project but still want access to the scripts globally, clone this repo then run:

npm link

Then any script run with uikit <command> will access the most recent code in your local repo.

Adding a generator

The uikit generator script will execute a command of the form uikit generate <template> <name> if there is a matching template in /templates and the specified template is 'registered' as a valid cli option.

To create a new generator template:

  1. Add the name of your template to TEMPLATE_OPTIONS in bin/uikit.js.
  2. Create a directory with your desired template files. If a file in your template has the .handlebars extension, the generator script will compile it as a handlebars template, stripping the .handlebars extension from the filename. The handlebars template will have access to the following variables:
  • name: An object with name variants derived from the CLI argument:
    • name.original: The unmodified CLI argument
    • name.humanized: Capitalized words with spaces (e.g. My Component)
    • name.pascalized: Upper camel-cased aka Pascal cased name (e.g. MyComponent)
    • name.camelized: Lower camel-cased name (e.g. myComponent)
    • name.dasherized: Kebab-cased name (e.g. my-component)

In addition, the filename itself of .handlebars files will be compiled as a handlebars template. This is useful if you want to generate named files such as MyComponent.jsx.

  1. Optionally, add a .uikitrc.js file to the template directory. The file should optionally export a preGenerate and postGenerate action, each passed the destination directory of the resulting templated output.
module.exports = {
  preGenerate({ dest }) {
    // ...
  },
  postGenerate({ dest }) {
    // ...
  },
};