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

bhoos-cli

v2.2.1

Published

Bhoos CLI

Downloads

15

Readme

bhoos-cli

Bhoos cli for internal use. Bhoos CLI can

  • install packages & applications
  • run applications throught Agent.
    • Agent takes care of respawing the worker process if they die
    • sends logs to ManagementServer
    • watches for updates, and gracefully updates running application
  • publish packages to the internal registry

also, you can add new commands to Bhoos CLI if they serve useful purpose to everyone (see CONTIBUTING#New Commands).

Installation

  1. Install the package. Either
	yarn global add bhoos-cli
  1. Register your auth token and create config files:
bhoos auth --token <<TOKEN>> --name <<YOUR NAME>>

This will register your token to management server, and create/update ~/.bhoosrc and ~/.npmrc config files.

Config files

These files are created by bhoos auth automatically.

  1. ~/.bhoosrc file is created with following content:
	{
		"packageUrl":"https://pkg.bhoos.com",
		"cloudUrl":"https://cloud.bhoos.com",
		"accessToken" : "<<TOKEN>>"
	}

It specifies the registry and management server url, and your authentication token.

  1. And .npmrc file will look like:
//npm.pkg.github.com/:_authToken=<<TOKEN>>
//npm.pkg.github.com/bhoos/:_authToken=<<TOKEN>>
//pkg.bhoos.com/:_authToken=<<TOKEN>>
@bhoos:registry=https://pkg.bhoos.com/

This directs yarn and npm to use https://pkg.bhoos.com as the registry for @bhoos/ packages. If the requested pacakge is not found there the registry will itself redirect yarn|npm to the main registry https://npm.pkg.github.com. So, the token for both the registries must be same.

Use

  1. Installing a package
	bhoos install @bhoos/engine-server@latest

Some example pacakge name: - @bhoos/engine-server@dev - @bhoos/[email protected] - @bhoos/[email protected]

this will install the pacakge inside ~/.bhoos directory

  1. Running the installed application
	bhoos run @bhoos/engine-server@latest

this will run the installed application (at ~/.bhoos) directory under the supervision of bhoos-cli Agent. It will then send logs, and other stats to the management server, and auto update itself if new updates arrive.

Note: Agent tries to store logs inside /var/log/bhoos/ at /var/log/bhoos/@bhoos directory. So, make sure those directories exist and the application has write premissions. If they don't exist, log won't be presisted locally. However error logs are always send to management server (at the cloudUrl specified in .bhoorc). Also if you want logrotation create a config at /etc/logrotate.d/ accordingly (See CONTRIBUTING#LogRotation for a sample)

  1. Publishing a package
	bhoos publish ./path/to/package/dir -m "publish message" -t "tag"

Publishes the application to registry. See bhoos help publish for further details.

There are three types of packages. And the publish action depends on the type of application being published.

  • node-app : These are application thay need to be run. node_modules is included in the bundle along with other files. So, there are no dependencies to install. Just the bundle file is sufficient.
  • npm : node_modules is not included. There are libraries intended to be imported in other projects.
  • react-native: Android and iOS bundles which can be loaded by mobile application are published.

Note:

  • once package is published to latest or staging, it is locked. And pacakges with same version cannot be published again.
  • yarn build command must be defined
  • For react-native application, yarn setup must also be defined. (See the FAQ section)
  • Published bundles contain only dist and es6 files by default. If other files need to be bundled you have to specify them in package.json files field.
  • Bhoos CLI tries to determine the type of package but if it guesses wrong (shown during publish operation) , you have to specify the type of package in bhoos->pkg-type field of package.json
  1. Changing tag of published package (i.e. tagging package)
	bhoos tag ./ -t latest

Changes the tag of package at ./ to latest. (name and version number is taken from package.json)

	bhoos tag -pkg @bhoos/[email protected] -t staging

Changes the tag of @bhoos/[email protected] package to staging

FAQ

Checksum / Integrity check failed

Q: I tried to yarn or yarn install in my repo and yarn says checksum failed for a package I had published to registry proxy. Solution: remove your yarn.lock file. Even better, remove the entry for the offending package from the yarn.lock file.

Reason: This happens when you have published a version multiple times in the registry proxy, and yarn installed in the past. So, yarn remembers the checksum of the older package it installed. This is completely normal, and a result of our intented use cases.

Publish your react native bundle to Management Server

bhoos publish on a react native project is intended to create react native bundles for ios and android and then upload them to server. But this requires some hacks, and configuration.

  1. Create a metro-asset-plugin.js [See at doc/] file in your react native project and include this plugin in the metro.config.js:
module.exports = {
  transformer: {
	//...
	assetPlugins: [require.resolve('./metro-asset-plugin')],
	//...
  },
  // ...
};
  1. In your package.json make following changes:

2.1. Specify that your package is a react-native package and be published by bhoos publish as such. To do this, add a field in the package.json:

  "bhoos": {
	"pkg-type": "react-native"
  },

2.2. Specify the root react-native directory (default: './') relative to package.json and the location of react native entry file (default: './index.js') relative to the root directory. E.g.

	"bhoos" : {
	   //...
	   "react-native" : {
		   "root" : "./",
		   "entry-file" : "./index.js"
	   }
	}

2.3. Add a setup script to package.json that runs the fixResolveAssetSource.js (See at doc/) script. This script patches the react-native package to fit our needs.

  "scripts" : {
	// ...
	"setup" : "node fixResolveAssetSource.js"
  }