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

ng-console

v1.7.3

Published

Small directive for angular, to implement a console that's able to execute commands.

Downloads

10

Readme

ngConsole

Small directive for angular, to implement a console that's able to execute commands. You can see a demo here.

With this directive, developers can avoid to design and create a user interface for small tasks like cleaning server cache, restart some backend tasks and so on. Just create the logic, and ngConsole will allow you to execute all these actions from the same place.

Installation

To install ngConsole on your project, follow these steps:

  1. Make a npm install ng-console.
  2. Copy the file node_modules/ng-console/build/ngConsole.js to your project's folder.
  3. Declare ngConsole as a dependency for your module angular.module('myApp' ['ngConsole'])
  4. Save it. You are done!

Use

Now, you just have to write <ng-console></ng-console> on your code, and that's it, you already have a console installed on your Angular website.

You can use different attributes to customize it:

  • open: Open by default (boolean)
  • fixed: Embeded in your HTML, or fixed and hidden (boolean)
    • If it's fixed, you should press º to open it.
  • fullsize: When fixed, filling the entire screen (boolean)
  • custom-height: Set a custom height, this will be ignored if fullsize is true (number).
  • custom-prefix: The prefix displayed (string)
  • custom-commands: An array with commands that you wanna add to the console. (boolean)

Custom commands

Custom commands must have particular properties to make them work. Each command must have:

  • name: The keyword used to execute the command (string)
  • description: A short description to show with help command (string)
  • params: A list of parameters that can be used with this command (Object: {name: "string", description: "string"})
  • action: The function that's gonna be executed (function(printLn, params){ whatever(); }).

If user wants to use parameters, he/she can use any of these combinations:

  • say --text Hello world
  • say --text "Hello world"
  • say --text=Hello world
  • say --text="Hello world"

In our live example, our custom command say accepts params, so if you execute say --text Something, it's going to prompt you "something". And we are able to get it by doing this: function(printLn, params){   if(params && params.text){     printLn(params.text);   } }

Custom theme

If you want to customize ngConsole's default colors, you can specify a customTheme on your options object.

  • If you want to use a stock theme, just write its name, like this: $scope.options.customTheme = "light"
  • If you want to create a new theme, that's going to be available on your console, write this:

$scope.options.customTheme = {   name: "my theme name",     data:{       bg: "any-css-color",       color: "any-css-color",       boldColor: "any-css-color",       fontfamily: number,       fontsize: "string-font-name"     },     labels:{       bg: "The color name that's going to be displayed",       color: "The color name that's going to be displayed",       boldColor: "The color name that's going to be displayed"     }   } }