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

generator-mrhenry

v1.4.1

Published

Mr. Henry + Lalala + Angular.js = ๐Ÿ’ƒ

Downloads

15

Readme

Production ready, but use with caution. When stuck, ask Pieter.

Trying out Yeoman to do our project setup in a breeze with some simple questions and conditional downloading.

Installation

One command to rule them all: $ npm install -g yo generator-mrhenry.

Let's get ready to rumble.

Documentation

Main generator

$ yo mrhenry

Runs a basic, one time setup of the front-end approach on top of your existing back-end files. You'll have to answer a few questions to get you started.

Note - when asked if you want to override certain files, answer yes

Note - verify that everything is working correctly by trying to run $ gulp watch

Included

Running this setup gives you a basic view for ApplicationPage (living in /pages/application/application) as an example, the base class for all resources, basic setup & configuration and the following NPM modules:

  • mr-haraway for easy assets.sh image embedding (with size optimizing & retina support, woop!)
  • mr-nav-state for all your .is-active CSS goodness
  • fd-html-content for robust HTML rendering (still to be ported to NPM)

Other just-add-water NPM modules maintained by us include:

  • mr-timeago for when 20 minutes ago works better than an UNIX timestamp

Subgenerators (Angular.js)

This is where the cool becomes awesome. Using subgenerators we can generate all neccessary views & files in a breeze.

ng-page

yo mrhenry:ng-page name [--resource resource] [--path path]

Creates an @Page instance. This name should be a Lalala page type for it to work out of the box.

Options

  • --path - specify a path where the page folder should be created.
  • --resource - create an overview & detail state for a certain resource. More on resources below.

Examples

Basic usage

Let's say you want to have a custom view for your Lalala HomePage.

$ yo mrhenry:ng-page home

Add import './pages/home/home'; to your application.js, build & you're good to start styling!

Resource overview

You have a page of type NewsPage and you want that to be an overview of Post model instances. Post will be a resource (see below) in the front-end app.

$ yo mrhenry:ng-page news --resource post

Import ./pages/news/news, build, et voila. With routes etc!

It is very easy to render the childs inside an overlay. Check with Pieter until the README is updated.

ng-resource

yo mrhenry:ng-resource name [--endpoint endpoint] [--controller]

A resource is an easy way to handle custom models in the back-end if we stick to some basic conventions concerning HTTP endpoints.

A resource has certain methods that return promises with the JSON response. Benefits are:

  1. In-memory caching: two same calls won't be made twice in one browsing session. Instead, the promise will resolve instantly.
  2. Consistent formatting: all responses will go through the resources format() method, so you can rest assured all properties will be available, making undefined is not a function a thing of the past.

Options

  • --endpoint - override default pluralization of resource name; to avoid sheeps and keep with sheep ;)
  • --controller - generate a Rails controller with index and show methods

Examples

As in the above page overview example, let's create a Post resource.

$ yo mrhenry:ng-resource post

You now have a Post service that you can @Inject everywhere. Possible calls:

Post.all.then(posts => { doSomething(posts); });
Post.find(2).then(post => { renderDetail(post); });

ng-component

$ yo mrhenry:ng-component name [--template]

Just a quick way to create a directive because hell yeah, we're lazy.

Options

  • --template - Use this flag if you want your directive to have an HTML template

ng-service

$ yo mrhenry:ng-service name

As above, a quick way to create a service because, โ€ฆ, still lazy.