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

@clef/generator-es6-npm-module

v3.2.2

Published

Yeoman generator for starting ES6 npm module with Mocha, Istanbul, Travis, Karma

Downloads

40

Readme

generator-es6-npm-module

This generator creates an npm-compatible module with support for ES6, Webpack (building), Mocha (testing), Chai (assertion), Karma (test running), and TravisCI (continuous integration).

Out of the box, you'll get green tests with coverage and helpful NPM scripts for versioning and publishing.

Getting Started

npm install -g yo @clef/generator-es6-npm-module
mkdir my-project && cd my-project
yo @clef/es6-npm-module

Or you can create folder with your project and just copy\paste this code to terminal (you should be located under your project folder)

npm install -g yo @clef/generator-es6-npm-module && yo @clef/es6-npm-module

Project structure

When project is generated you will get project with that structure:

|-- my-project
  |-- src
  |  |-- index.js
  |-- spec
  |  |-- my-project.spec.js
  |-- .babelrc
  |-- .editorconfig
  |-- .gitignore
  |-- .npmignore
  |-- .travis.yml
  |-- karma.conf.js
  |-- package.json
  |-- webpack.config.js
  |-- LICENSE
  |-- README.md

Common questions

How do I develop two packages at once?

npm provides good tooling for developing many packages at once. You're likely in the following situation:

  • You have package-b which depends on package-b
  • You'd like to work on them at the same time

To achieve this, we will npm link package-b into the global space and then link it back into package-a. Follow these steps:

cd /path/to/package-b
npm link
cd /path/to/package-a
npm link package-b

You can read more about npm link here.

When do I add to "dependencies" vs. a "peerDependencies"?

Because our build system uses both Webpack and Browserify, we can run into issues where dependencies are built into our distributed source twice. This is very bad. To address this, we use peerDependencies extensively.

  • peerDependencies - any module that is shared by one or more of our components should be added to peerDependencies. If you add a module to peerDependencies, you should also add it to devDependencies, so that it will be installed for testing and development (peerDependencies are not installed by default in npm > 3).
  • dependencies - any module that only this component relies on should be added to dependencies.

This is a pain in the butt and we are working on a solution.

Known issues

Duplicate module import

This issue crops up in the following situation:

  • We have two packages package-a and package-b which both depend on react (or another module)
  • We npm link package-a into package-b
  • We try build package-a with browserify

It will manifest as this error:

Uncaught Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

In this situation, react will be loaded twice in the browserify bundle.

To fix this, follow the steps outlined here.

cd /path/to/project-b
cd node_modules/react
npm link
cd /path/to/project-a
npm link react

This issue only affects packages when thay are connected using npm link.