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

nuk

v2.0.1

Published

A package manager that installs only what you need.

Downloads

33

Readme

💣nuk

A package manager that installs only what you need.

Motivation

It often happens to add resources hosted on CDN to websites or web applications. CDNs, I know, are very convenient and quick to include a lib. But how safe is it to do it? How many times does it happen that these are unreachable for traffic reasons? For example, it happens to me with unkpg.com. Get the files from the node_modules folder? No! it is not done. Too big. So I thought of creating a simple package manager (I don't know if I can call it that) that simply downloads the resources you want in a folder.

The files should be kept "local". If you have your own CDN, even better. 😎

Installation

$ npm install -g nuk

Usage

Do you need to install only the UMD version of React?

$ nuk install react/umd

After this a vendors/react/umd folder will be created with only the files of the React umd folder present in the package on npm. Now, you can include your file:

<script src="vendors/react/umd/react.production.min.js"></script>

PS: if it doesn't already exist, a configuration file called nuk.json will be automatically created. This serves as a configuration.

Please don't remove nuk-lock.json useful for keeping track of installed packages.

You can also install multiple packages

$ nuk install react/umd doz/dist

Obviously you can install the version you want (recommended):

$ nuk install [email protected]/umd

For updating the package to the latest version use update

$ nuk update react

If you want to know quickly which files you can include in a given package then you can use list:

$ nuk list react

You will receive an output like this:

nuk install react/cjs
nuk install react/cjs/react.development.js
nuk install react/cjs/react.production.min.js
nuk install react/index.js
nuk install react/index.min.js
nuk install react/umd
nuk install react/umd/react.development.js
nuk install react/umd/react.production.min.js
nuk install react/umd/react.profiling.min.js

I understand that inserting so many scripts into your html page could be tiring. So nuk gives you another command called "bundle". This command will only take minified files that conventionally have "min." in the file name and will concatenate them into one file bundle.js and bundle.css. It does nothing else. It is not a real bundler. The files will be created inside the "vendors" folder.

$ nuk bundle

if you need to exclude certain files or change the order in which nuk generates the bundle then you can add the "bundleFiles" property to your nuk.json:

{
  "bundleFiles": [
    "swiper/css/swiper.min.css",
    "react/umd/react.production.min.js"  
  ]
}

It will provide two files:

  • vendors/bundle.js
  • vendors/bundle.css

So, you can include just this:

<script src="vendors/bundle.js"></script>
<link href="vendors/bundle.css" rel="stylesheet" type="text/css">

if you need to diversify the bundles you can then do so:

{
    "bundleFiles": {
        "bundle1": [
            "swiper/css/swiper.min.css",
            "react/umd/react.production.min.js"
        ],
        "bundle2": [
            "react/umd/react.profiling.min.js"
        ]
    }
}

In this case it will provide three files:

  • vendors/bundle1.js
  • vendors/bundle1.css
  • vendors/bundle2.js

Do you need to uninstall?

$ nuk uninstall react

if you need to change the name of the vendors folder then add this property to the nuk.json file:

{
  "folderName": "my-vendors"
}

Changelog

You can view the changelog here

License

nuk is open-sourced software licensed under the MIT license

Author

Fabio Ricali