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

create-rollup-library

v1.0.0-alpha.5

Published

A minimal configuration for creating rollup based micro-library.

Downloads

21

Readme

rollup-based-library

A minimal configuration for creating a rollup based micro-library.

Covering:

  • Rollup setup
  • Production configuration that builds the production bundle to a production build folder in the following formats:
    • IIFE Output for browser
    • ESM output
    • CJS output
  • Babel setup
  • Unit tests setup
  • Configuration for Auto-rerun of test cases on source file change.
  • Testing environment configuration
  • Production environment configuration for build
  • ESLint configuration
    • optionally add eslint configuration
    • add a prominent eslint config rule set (airbnb, standard or google).

Installing create-rollup-library

npm install create-rollup-library -g

Steps for creating the library

  • cd into /destination folder and enter the command
        create-rollup-library library-name
  • library-name folder gets created in destination - destination/library-name

About the default configuration

  • version: The version will be 1.0.0-alpha by default. You can either change this at the time of installation or edit it later in package.json.

  • private: true is set in package.json to avoid accidental publishing of the package.

  • Some imports from dependencies are not able to be resolved by rollup.

    • This error frequently occurs with CommonJS modules converted by rollup-plugin-commonjs.

    • https://rollupjs.org/guide/en#error-name-is-not-exported-by-module-

  • Running tests in watch mode requires git, so after library is created, make sure to initiate a local git repository by running

    git init

    in the library root directory.

About the default test configuration

  • Packages used:
    • "jest": "^23.6.0",
    • "babel-jest": "^23.6.0",
    • "@babel/core": "^7.2.2",
    • "babel-core": "^7.0.0-bridge.0",
    • "@babel/preset-env": "^7.2.3",
  • The reasons for having both babel-core and @babel/core:
    • If you are using babel version 7 you have to install babel-jest with npm install --save-dev babel-jest babel-core@^7.0.0-0 @babel/core. (https://github.com/facebook/jest/issues/5525)

    • It is because babel-jest has a dependency one babel-core. This results in need for both babel-core as well as @babel/core as dependencies. However trying to install babel-core@^7.0.0-0 results in installing "^7.0.0-bridge.0" version of babel-core. The babel-bridge project (https://github.com/babel/babel-bridge) is a solution for easy transition of old projects using babel-core as a dependency from babel-core to the updated scoped package @babel/core.

    • Once babel-jest is updated by the jest team to use scoped babel packages, the above workaround will no longer be needed. So, make sure to check the latest releases and the corresponding release notes of babel-jest once in a while.