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

prebuilt

v0.2.4

Published

Package and deploy prebuilt versions of node_modules to bypass gcc node-gyp issues.

Downloads

451

Readme

NPM

A simple CLI/API tool to package and deploy prebuilt versions of node_modules packages to bypass gcc node-gyp issues. This is another level up from node-pre-gyp, if one of your target node_modules does not precompile, you can use this to bundle versions of that entire library.

Now rewrites package.json of target package to ensure it will not run node-gyp on future installs after it is deployed.

Build Status codecov

NPM

Install (For npm script or API usage)

npm i -D prebuilt

Install (global)

npm i -g prebuilt

Usage

CLI / NPM scripts

Pack an installed (and built) package from a VM:

prebuilt --pack package_name

# shorthand
prebuilt -p package_name

Install prebuilt packages on a machine, node version, platform and bitness will be handled automatically:

prebuilt --install package_name

# shorthand
prebuilt -i package_name

API

import { pack, install } from 'prebuilt'
import util from 'util'

const printResult = x => console.log(util.inspect(x))
const printError = err => console.error(err)

/** Pack an installed package for later distribution */
pack('package_name')
  .then(printResult)
  .catch(printError)

/** Install a prebuilt packed package */
install('package_name')
  .then(printResult)
  .catch(printError)

TEST

Unit tests output for current release:

prebuilt: rewriting C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package\package.json to remove node-gyp install step. running node-gyp clean for package at C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package running node-gyp configure for package at C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package running node-gyp build for package at C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package in debug mode running node-gyp build for package at C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package in release mode pack: node-gyp finished executing! prebuilt: rewriting C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package\package.json to remove node-gyp install step. running node-gyp clean for package at C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package running node-gyp configure for package at C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package running node-gyp build for package at C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package in debug mode running node-gyp build for package at C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package in release mode pack: node-gyp finished executing! extracting package at prebuilt/win32/x64/v6.2.2/invalid-package.7z to C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\invalid-package... extracting package at prebuilt/win32/x64/v6.2.2/fake-package.7z to C:\Users\ColeChamberlain\noderaider\prebuilt\node_modules\fake-package...

TOC

lib

should exist.

return should.exist(lib);

#default

should not have a default function export.

return should.not.exist(lib.default);

#pack

should exist.

return should.exist(pack);

should be a function.

return pack.should.be.a('function');

should not throw for non-existant package name.

return function () {
  return pack().should.be.rejected;
}.should.not.throw();

should reject non-existant package name.

return pack().should.be.rejected;

should reject invalid package name.

return pack('invalid-package').should.be.rejected;

should pack valid package.

this.timeout(5000);
return pack('fake-package').should.be.fulfilled;

should create prebuilt.

this.timeout(5000);
pack('fake-package').then(function () {
  return access(fakePackagePath);
}).catch(function (err) {
  console.error(util.inspect(err));
  should.not.exist(err);
}).finally(function () {
  done();
});

#install

should exist.

return should.exist(install);

should be a function.

return install.should.be.a('function');

should not throw for non-existant package name.

return function () {
  return install().should.be.rejected;
}.should.not.throw();

should reject non-existant package name.

return install().should.be.rejected;

should reject invalid package name.

return install('invalid-package').should.be.rejected;

should install valid package.

return install('fake-package').should.be.fulfilled;

#query