Skip to content

Instantly share code, notes, and snippets.

View nexdrew's full-sized avatar

Andrew Goode nexdrew

View GitHub Profile
@nexdrew
nexdrew / republish.sh
Last active November 29, 2016 15:56 — forked from soldair/republish.sh
publish modules from the public registry to another registry
#!/bin/bash
mkdir -p ./publish-tmp
cd publish-tmp
if [ "$?" != "0" ]; then
echo "failed to create publish tmp dir"
exit 1
fi
@nexdrew
nexdrew / npme-users.js
Created October 26, 2016 20:41
Node executable script that prints a list of all known users for an npm Enterprise instance (should be run on the npme host)
#!/usr/bin/env node
// assumes that the Docker bridge is using ip 172.17.0.1
var client = require('redis').createClient('redis://172.17.0.1:6379')
var users = {}
client.keys('user-*', function (err, keys) {
var numKeys = keys.length
var numChecked = 0
keys.forEach(function (key) {
client.get(key, function (err, value) {
@nexdrew
nexdrew / virtual_appliance.md
Last active September 19, 2016 17:38
Install npm Enterprise as a virtual appliance

Open Virtualization Format

npm Enterprise can now be installed as a virtual appliance conforming to the Open Virtualization Format. If you already use a hypervisor or virtualization platform for your infrastructure (such as VMware), you can import and run an instance of this virtual appliance as a host VM instead of installing npm Enterprise on one of your existing hosts.

The appliance is distributed as an .ova file, which is essentially a tarball containing a virtual machine template (.ovf file), a virtual hard drive (.vmdk file), and a manifest (.mf file). Download the virtual appliance here.

Once you have downloaded the virtual appliance, check for binary completeness by comparing a SHA256 checksum of your download against the respective checksum file listed.

Virtual Appliance Default Specs

yargs module contracts

command

  • index function accepts yargs instance, usage instance, and validation instance; returns command instance
  • addHandler(cmd, description, builder, handler) accepts the following; returns undefined
    • command string or full object/module
    • optional help text description as string (or false for hidden command)
    • optional options object or builder function that accepts a yargs instance; optionally returns yargs or yargs.argv
    • optional handler function that accepts argv; returns anything (currently ignored)

Uninstalling npm Enterprise

While installing npme handles the installation of dependencies, uninstalling npme does not uninstall its dependencies. Here's a quick guide to uninstall and remove the different components that make up the Enterprise product.

  1. Uninstall the npme package

    sudo npm uninstall -g npme
    

Keybase proof

I hereby claim:

  • I am nexdrew on github.
  • I am nexdrew (https://keybase.io/nexdrew) on keybase.
  • I have a public key whose fingerprint is 4CEE 1709 9522 09E1 0BE3 D30D EEC1 7B84 0F8D DA89

To claim this, I am signing this object:

Why Buy npm?

Here are just a few reasons why it makes sense to invest in npm's products.

  • npm is the de facto standard when it comes to building and sharing JavaScript/Node packages
  • The public registry is the largest artifact registry of any platform/language in the world, hosting over 300,000 packages and serving over a billion downloads a week
  • Empower your developers with the same best-of-class tools used every day by more than 3 million open source developers
  • Make your company more appealing to current and future software developers
  • npm is a key player in the InnerSource movement, helping companies leverage the best practices, workflows, and tools that work so well in open source

npm Enterprise Network Requirements

Assume HTTP and HTTPS traffic for all of the domains listed.

In addition to this list, you should make sure your host has access to the yum or apt repositories it needs for standard OS and kernal upgrades.

Egress

Docker

Problematic Dependencies

When using npm Enterprise, we sometimes encounter public packages in our private registry that need to fetch resources from the public internet when being installed by a client via npm install.

Unfortunately, this poses a problem for developers who work in an environment with limited or no access to the public internet.

In this article, we're going to look at some of the more common types of problems in this area and talk about ways we can work around them.

Note that these problems are not specific to npm Enterprise as a product, but are specific to using certain public packages in a limited-access environment. That being said, there are some things that npm (as an organization and software vendor) can do to better prevent or handle some of these problems, and we will be working towards that goal in the near future.

Size comparison of popular CLI modules

Inspired by yargs issue 468.

Here are the numbers by my count, using Node 5.9.1 and npm 3.8.5 on OS X 10.11.4:

yargs@4.4.0
  • 49 dependencies
  • 64 total directories