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

flatiron-cli-users

v0.1.10

Published

Encapsulated commands for managing users in flatiron CLI apps

Downloads

25

Readme

flatiron-cli-users

Encapsulated commands for managing users in flatiron CLI apps

Example

At its core flatiron-cli-users is a broadway-compatible plugin which can be used by any flatiron application:

  var flatiron = require('flatiron'),
      app = flatiron.app;

  //
  // Configure the Application to be a CLI app with
  // a JSON configuration file `test-config.json`
  //
  app.name = 'app.js';
  app.config.file({ file: 'test-config.json' });
  app.use(flatiron.plugins.cli, {
    usage: 'A simple CLI app using flatiron-cli-users'
  });

  //
  // Expose CLI commands using `flatiron-cli-users`
  //
  app.use(require('flatiron-cli-users'));
  
  if (!module.parent) {
    //
    // Start the application
    //
    app.start();
  }

If you run the above script:

  $ node app.js users create

The output will be:

  help:   To signup, first you will need to provide a username
  prompt: username: foobar
  help:   Next, we will require your email address
  prompt: email: [email protected]
  help:   Finally, we will need a password for this account
  prompt: password: 
  prompt: confirm password: 
  info:   You account is now being created
  info:   Account creation successful!

And the contents of test-config.json will have the specified user information.

API Documentation

Expected API endpoints

This flatiron plugin expects an API endpoint to be present on the application through app.users. You may implement this API endpoint however you wish. We would suggest using resourceful and director, but you are free to use express or other node.js frameworks.

app.users.auth(function (err, result))

Responds with a valid indicating if the current user is authenticated.

app.users.availabile(username, function (err, result))

Responds with a valid indicating if the desired username is available.

app.users.create(user, function (err, result))

Creates a user with the specified properties.

app.users.update(username, props, function (err, result))

Updates the user with username with specified props.

app.users.forgot(username, props, function (err, result))

Attempts to reset the password for the username with the specified props

Commands exposed

  $ node examples/app.js help users
  help:   `app.js users *` commands allow you to work with new
  help:   or existing user accounts.
  help:   
  help:   app.js users available <username>
  help:   app.js users changepassword
  help:   app.js users confirm <username> <inviteCode>
  help:   app.js users create
  help:   app.js users forgot <username> <shake>
  help:   app.js users login
  help:   app.js users logout
  help:   app.js users whoami
  help:   
  help:   You will be prompted for additional user information
  help:   as required.

Options

  {
    //
    // Set of functions which will execute after named commands: create, login, logout, etc.
    //
    after: { login: function () { ... } },

    //
    // Set of functions which will execute before named commands: create, login, logout, etc.
    //
    before: { login: function () { ... } }
  }

Installation

Installing npm (node package manager)

  $ curl http://npmjs.org/install.sh | sh

Installing flatiron-cli-users

  $ [sudo] npm install flatiron-cli-users

Run Tests

Tests are written in vows and give complete coverage of all APIs and storage engines.

  $ npm test

Author: Charlie Robbins

License: MIT