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

@nfuncm/nfuncm-packager

v1.0.1

Published

Function packager for NfuncM

Downloads

1

Readme

NfuncM Package

Assists in packaging code to be ready to be consumed as an NfuncM Function.

Usage

To use, just navigate to the directory where your function lives, and run:

nfuncm-pack

What NfuncM Package Does

By default all NfuncM will do, is read your package.json for some data, such as the author of the application, the version, license, and some other details, and add those as a comment at the top of your output file.

Optionally, you can enable minification of your file, to ensure users get the smallest file possible.

If no minification is enabled, the source code file is modified in place, adding the top level comment.

A quick note about how the license is handled: If no license key is found, but a license file is, that whole file will be added as a top level comment instead. But if a license key exists, that will be used instead.

Example:

The data present in the package.json:

{
  "name": "nfuncm-packager",
  "version": "1.0.0",
  "description": "Function packager for NfuncM",
  "main": "./src/index.js",
  "author": "confused-Techie",
  "license": "MIT"
}

The resulting comment:

/**
  * nfuncm-packager
  * Version: 1.0.0
  *
  * Function packager for NfuncM
  *
  * Author: confused-Techie
  * License: MIT
  *
  */

Configuration

If you'd like to enable minification there's a few ways this can be done:

First within the nfm object in your package.json add minify.

minify can be any of the following:

  • Boolean: If a boolean true is used as the value of nfm.minify then minification is enabled with NfuncM's defaults as well as all terser defaults.
  • String: If a string is specified then this path will be used instead of the default path when saving the new minified file.
  • Object: If minify is an object this object will instead be used to control all options passed to terser allowing tersers default, and NfuncM's defaults to all be overridden.

Defaults

Without modification from the above options these are the following defaults for minification behavior:

  • Minify Options: All of tersers defaults, as well as the following options are changed:
    • sourceMap: false
    • compress.drop_console: true
    • compress.drop_debugger: true
  • Minify File Path: By default the new file will be save to ./dist/Original File Name
  • Minification Enabled: By default minification is not enabled, unless the nfm.minify key is present, in any of the above forms.