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-n3dst4-package

v3.6.0

Published

Yeoman generator for npm packages the way I likes 'em

Downloads

6

Readme

generator-n3dst4-package

Travis Status

Generates npm packages the way I likes 'em.

Installation

If you don't already have yo (the Yeoman runner) installed:

npm install -g yo

Then install this package:

npm install generator-n3dst4-package -g

Usage

yo n3dst4-package

Options

The generator will ask you a series of questions. Here's what they all mean:

? 'Allo ! What would you like to do?

This is the first question that yo will ask you unless you specified a generator on the command line. This where you tell yeoman what to do. You should pick this package generator.

Package name

This should be a minimal but complete name in "kebab-case".

Should this package be namespaced?

By default all packages are not namespace. If you're creating a package mainly for private use, you can choose to have it namespaced (it will pick your currently logged in npm username).

Description

A one-line description of what the package does. Try not to skip this step!

Your email address (and) Your name

These will be taken from your git config by default.

Do you want to create a SPA (single-page web app)?

If you're looking to kick off a new UI project, answer Yes to this question. If you're just looking to create a shareable package, answer No.

Do you want your SPA to use React, Radium, & Redux?

This will only be asked if you answered Yes to the SPA question. Answer Yes to have the project automatically set up with a React/Redux architecture.

Do you want an executable bin script?

If you're creating a command line utility, answer Yes to this question. Otherwise answer no.

Executable script name (without extension)

This will only be asked if you answered Yes to the question about having a bin script. The answer to this question should be the name of the script that will be generated. It defaults to the name of the package.

Do you want your code compiled with Babel?

Babel is a code transpiler that translates "new" JS syntax into old, fully browser-compatible syntax. Answer Yes to this question if you'd like to write your code in ES6+ and have it automatically compiled to ES5. Answer No if you're happy to write in ES5.

Do you want a Mocha test suite?

Answer Yes to generate the start of a test suite, which you can run by typing npm test. Only answer No if you have a very very good reason for doing so.

Do you want the test suite to run in a browser (through Karma)?

This question will only be asked if you answered Yes to the question about Mocha, above. Answer Yes to this question to have the tests set jup to run through Karma, which will launch a browser to run the tests so you know that your code is browser-compatible.

Do you want to run "npm install" at the end?

As a convenience, the generator can run npm install on your behalf if you answer Yes to this question.

Generators

n3dst4-package

This builds a minimal package, with the following features:

  • .gitignore and .npmignoreset up with sensible defaults
  • package.json set up as if you'd run npm init
  • Linting configured using ESLint and my personal eslint config
  • Optional babel transpilation. If selected, an npm prepublish step will be set up to precompile your package.

n3dst4-package:bin

Adds a src/bin/ folder with a script set up for command-line execution.

n3dst4-package:mocha

This will add a basic mocha test suite with one failing test to your app, which can be run using npm test, or just mocha.

n3dst4-package:karma

This will upgrade your Mocha-based test suite to run inside Karma

Developer notes!

So, this kind of project can get a bit confusing because it's code-that-generates-code, so sometime you lose track of whether you're looking at code that's part of the genarator code, or code that's just there to be copied into the output.

Remember:

  • Yeoman generators can have one main generator, and zero or more sub-generators.
  • All the generators live in generators/
  • The main generator (what you get when you just call yo n3dst4-package) is in generators/app (app is the Yeoman's default name).
  • Within each generator, any files that might get copied over are in templates/
  • The main generator in this case is written to ask you which subgenerators you want, and will run them automatically if needed. You can also run them on their own afterwards, e.g. yo n3dst4-package:karma to add Karma to an existing project.