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

jlafer-es6pkg

v1.0.7

Published

A starter ES6 package that can be required or imported

Downloads

16

Readme

es6pkg

This is a sample/starter project for building a library package, including bundles in three formats: UMD, CJS and ES.

The build pipeline uses Babel and Rollup to transpile and bundle your JavaScript code for the required deployment scenarios: UMD for browser script tags; CommonJS (CJS) for NodeJS applications using require statements; and ES for applications using ES6 import statements.

Your package code can be developed using ES6 (ES2015) features of JavaScript, including export and import statements.

Installation

git clone [email protected]:jlafer/es6pkg.git <pkgname>
cd <pkgname>
npm install

Usage

The sample source files can be removed from the /src sub-folder, where you can place your project's source code. Code development can proceed using ES2015 features, as Babel is used in the build process to transpile all source files to ES5-compliant format.

If the package is imported using CommonJS require statements, all properties of the package will be imported. If imported using ES6 module import statements, then tree-shaking will be performed and only the required properties of your package will be bundled into the consuming application.

Use npm run build to build and bundle the package files in the /dist sub-folder.

Testing

As this package is designed for building library packages, the suggested (i.e., TDD) development pattern would involve putting functions and their test cases in the package and testing locally. Jest is already included and can be invoked using npm test. The babel-jest package is installed along with a babel.config.js file, so Jest automatically transpiles ES6-style test files prior to execution. See src/index.test.js for a sample test case file.

Local Usage

During active development you can also use the npm run dev command to run Rollup in "watch" mode - the executable packages are updated as changes are saved to the source files. So, for instance, if you put calling code in index.js you could run it in NodeJS using the command node dist/bundle.cjs.js.