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

phantom-phoenix

v1.4.6

Published

Redis based phantomjs queue and runner

Downloads

3

Readme

Phoenix Build Status

Redis based phantomjs queue

Instructions

  • Install redis (https://github.com/antirez/redis)
  • Install npm modules($ npm install)
  • Run tests (npm test)

Usage

By default it subscribes to a single channel specified in the config Before you start using the application, assure that a redis server is running ($ redis-server). Phoenix will refuse to start if redis is down

  • Run app.js ($ node app.js)

This trigger the node application to spawn a new phantomjs child process and opens the website.

You can see the config.sample.yml for a sample configuration. Note that some options are incompatible with each other, for eg you can't send a request body in a GET request.

Do not edit default.yml unless you are working on phoenix itself.

Injection

By setting the js key in config.yml you can run code on the loaded web page before the page is loaded itself.

Logging

phoenix logs every phantomjs instance. For every instance that is created, a new temporary directory is created in the logs directory. The config passed to phantomjs is stored in the config.json file. The output from the phantomjs instance is stored in two files: browser.log and page.log.

browser.log is the higher level log file, which records events and errors made by the browser instance. Such as Injection events and final status of the page load.

page.log holds the log from the page context. This includes any console.log statements made from the page and any alert/confirm/prompt calls as well.

Usage

Instead of cloning and running the entire repo for each project, you can use the npm package (called phantom-phoenix), which has its own binary called phoenix which you can run.

To run phoenix in a directory, the following conditions must be true:

  • a valid config.yml file must exist in the directory

After that you can append messages to the list specified in the config, and phoenix will start runners for each of your requests once you publish the id

You can append two things to the list:

  • A complete valid http/https url. This replaces the url provided in the config
  • A partial querystring (such as a=1&b=2). This overrides and merges with existing query params in the config

This way, you can send an id=1 and phoenix will open the correct url.

Redis

Instead of just using a redis pubsub, we use a hybrid pubsub+list model as queue to store logs. Instead of directly publishing the request to the channel, you push it to a list, and then publish the index of the just pushed item on the list. The list is maintained at $channel:queue, where $channel is the queue name specified in the config.

For, eg if the channel name is the default (phoenix), you do the following:

  • run phoenix
  • redis-cli
RPUSH phoenix:queue "http://google.com"`
(integer) 8
PUBLISH phoenix 7

phoenix will pick this up and give something like following as output:

START: phoenix-11634lNeXLbHqhRM3
STOP : phoenix-11634lNeXLbHqhRM3