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

devbridge

v0.1.0

Published

CLI tool to facilitate homebridge plugin development

Downloads

8

Readme

devbridge

Devbridge is a CLI tool that automates homebridge plugin development and allows you to quickly build and iterate your plugins during the development process.

Features

  • Run and test multiple plugins – Devbridge provisions and starts Homebridge servers using a different username, pin code, and port per plugin.
  • Plugin builds – Devbridge will a run your plugin's build script if one is present.
  • Automated Homebridge Configuration – Devbridge keeps Homebridge config files isolated per plugin so you can run and test them in isolation.
  • Debug with breakpoints – Devbridge allows you to set breakpoints for easy debugging with your favorite IDE.

Prerequisites

  • node v9 or higher
  • homebridge installed and available via your PATH

Install

npm install -g devbridge

Configure Your Plugin

First you'll need to configure your plugin by creating a config.json file under a directory named .devbridge at the root of your plugin.

Alternatively, you can run devbridge init to generate a sample config:

$ cd /dev/homebridge-plugin
$ devbridge init

✔ Create /dev/homebridge-plugin/.devbridge
✔ Write sample config /dev/homebridge-plugin/.devbridge/config.json

The generated config file looks like this:

{
	"name": "homebridge-plugin",
	"homebridge": {
		"platform": "Plugin Name",
		"someOption": "Any other config options your plugin requires"
	}
}

This file will be used when generating the homebridge config file when running your plugin.

You must have either platform or accessory in your config, depending on which type of plugin it is. The value is the "pretty name" of your plugin. This is also where you would add other options that your plugin might use, such as username and password.

For example, the generated Homebridge config.json file for a plugin with the above config would look like this:

{
	"bridge": {
		"name": "Devbridge",
		"username": "FC:11:DE:D6:12:2D",
		"port": 29893,
		"pin": "461-73-439"
	},
	"platforms": [{
		"platform": "Plugin Name",
		"someOption": "Any other config options your plugin requires"
	}],
	"accessories": []
}

Building

Devbridge checks to see if the package.json file in your plugin's directory contains a build script. If one exists, Devbridge will use it to build your plugin.

The build process is skipped if there's no build script.

Commands

Run

The run command goes through the entire flow of checking your configuration, building your plugin, and starting a Homebridge server with your plugin loaded.

Available options can be found by using the --help flag:

$ devbridge run --help

  Usage: run [options]

  Build a plugin and start a new homebridge server with the plugin config

  Options:

    -d, --debug       Run in debug mode
    -s, --skip-build  Skip build process
    -c, --clear       Clear homebridge cache
    -r, --refresh     Apply new homebridge configuration
    -h, --help        output usage information

Debug with Breakpoints

Flag: -d or --debug

This will start a Homebridge server using the Node remote debugger. You can attach to the debugger on port 9229 in an IDE that supports it, such as VS Code.

Skip build

Flag: -s or --skip-build

Skips the build flow but still applies any necessary configuration and starts a Homebridge server.

Clear homebridge cache

Flag: -c or --clear

Clear out the Homebridge cache and start a fresh server.

Refresh configuration

Flag: -r or --refresh

Applies any new changes made to your .devbridge/config.json file.

Example Run

$ devbridge run

✔ Checking plugin config
✔ Checking build script
✔ Building homebridge-coolplugin
✔ Found homebridge config
✔ Starting homebridge
[6/30/2018, 10:19:05 AM] Loaded config.json with 0 accessories and 1 platforms.
[6/30/2018, 10:19:05 AM] ---
[6/30/2018, 10:19:05 AM] Loaded plugin: homebridge-coolplugin
[6/30/2018, 10:19:05 AM] Registering platform 'homebridge-coolplugin.CoolPlugin'
[6/30/2018, 10:19:05 AM] ---
[6/30/2018, 10:19:05 AM] Loading 1 platforms...
[6/30/2018, 10:19:05 AM] [Sesame] Initializing CoolPlugin platform...
[6/30/2018, 10:19:05 AM] Loading 0 accessories...

Build

devbridge build will only build your plugin and nothing else.

Example Build

$ devbridge build

✔ Checking plugin config
✔ Checking build script
✔ Building homebridge-coolplugin