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

fh-fhc-beta

v1.0.8-17

Published

A Command Line Interface for FeedHenry

Downloads

8

Readme

FHC - FeedHenry Command Line Interface NPM version

FeedHenry CLI, the command line interface to FeedHenry.

Installation

fhc should now be available your command line.
fhc -v will tell you what version of fhc you have installed.

Finally, install FHC bash completion: fhc completion >> ~/.bashrc (or ~/.zshrc)

Usage

From the Command Line

To see the list of commands available, just run fhc.
See fhc help for general help, or fhc help <someCommand> for help on a specific command.

To get started with fhc, set the FeedHenry target and then login:

$ fhc target https://apps.feedhenry.com

$ fhc login <your-email-address> <your-password>

To list your projects, use:

$ fhc projects

To create an app from a git repository use:

fhc app create --project=SomeProjectId --title=WelcomeApp git://github.com/feedhenry-templates/welcome-app.git

As a Node.js Module

You can also use fh-fhc as a Node.js module in your scripts. This is useful for scripting automated tests, mobile app client builds and cloud deploys. First, install & add it to your project dependencies by doing npm install --save fh-fhc from your project root.
Then, you can require it in your code like so:

var fhc = require('./lib/fhc');
fhc.load(function(err){
  if (err){
    // Something went wrong
  }
  // FHC started up OK - we can now perform commands, like listing projects:
  fhc.projects({_ : []}, function(err, projects){
    if (err){
      // Handle error
    }
    console.log(projects);
  });
});

Some commands require params to be passed in - these are typically passed like so:

fhc.app.create({ title : 'Some title', project : 'someProjectId'}, function(){
});

Older fhc commands still pass arguments in an ordered array, as below. The environment is still specified outside the array.

fhc.app.logs({_ : ['projectId', 'appId'], env : 'dev' }, function(){
});

Extending

Version 1.0 of fh-fhc updates the structure of commands:

lib
  cmd # all commands go here
    common # stuff which applies to both versions of feedhenry
    fh2    # feedhenry 2-specific commands go here (e.g. `account`)
    fh3    # feedhenry 3 specific commands go here (e.g. `project`)
  internal # internal piping goes here
  

The common, fh2 and fh3 directory structure doesn't get exposed to the user, but everything underneath does - meaning we can have a command lib/cmd/common/fooGroup/barCommand.js, another lib/cmd/common/fh3/fooGroup/anotherCommand.js, and be able to run both fhc fooGroup barCommand and fhc fooGroup anotherCommand.
Internal commands in the internal directory are hidden from help output, but are still call-able.

Writing new commands is a little different than before. Old commands export a function - new style commands export an object.

Commands are DRY'd up substantially - see App List lib/cmd/fh3/app/list.js as an example of what a command definition looks like. Using the 'demand' syntax, yargs look after all all validation - you don't need to worry about it. Commands can be DRY'd up even more if they're very similar - e.g. app start. This extends from a base class - anything with an _ prefix doesn't go into the command tree.

There's no longer need to require() new commands in many different places - no need to require() new commands at all, just put them in the relevant tree structure within in lib/cmd. Tests are turbo'd, nock for mocks, coverage is at least a little better than before.

Setting a Proxy Server

fhc fhcfg set proxy http://host:port
# eg:
fhc fhcfg set proxy http://127.0.0.1:8080

Tests

grunt test