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 🙏

© 2025 – Pkg Stats / Ryan Hefner

generator-ptor

v0.0.3

Published

A generator for Yeoman

Readme

generator-ptor Build Status

A generator for Yeoman.

Getting Started

What is Yeoman?

Trick question. It's not a thing. It's this guy:

Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.

Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.

$ npm install -g yo

Yeoman Generators

Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.

What does this generator provide?

1- Folder Structure

    ├── bin
    │   ├── element_explorer.sh
    │   ├── install.sh
    │   ├── selenium-server.sh
    │   ├── test-sauce-browser.sh
    │   ├── test-sauce.sh
    │   └── test.sh
    ├── bower.json
    ├── Gruntfile.js
    ├── lib
    │   └── pageObject.js
    ├── node_modules
    │   ├── [...]
    ├── package.json
    ├── pageObjects
    │   └── builtWithAngular.js/coffee
    ├── protractor.conf.js
    ├── protractor-sauce.conf.js
    ├── README.md
    └── specs
        └── builtWithAngularSpec.js/coffee

2- Project Generation script includes downloading all moving parts to get a StandAlone Selenium Server and the Chrome Driver.

3- PageObject and Spec Generators for Javascript and CoffeeScript. See points C and D below.

4- PageObject and Spec Samples for Javascript and CoffeeScript.

5- Protractor configuration for sauce labs and standalone server. Adapted for CS and JS.

6- Yeoman will prompt the user to select between JS and CS. It will adapt files and configuration based on selection.

7- Gruntfile + some convenience Shell Scripts already configured and setup. Such as a Grunt task to run same test in multiple browsers and a different task to pass the browser name by parameters.

8- A small pageObject factory is included to reduce boilerplate on PageObject definitions. This will be turned into an optional dependency soon.

9- README file containing instructions on:

- how to install the generator;
- usage to create a new project, page and spec;
- how to run the tests locally, remotely;
- how to test a suite in a defined browser via parameter or in a pre-configured set of browsers.
- how to debug the test using WebStorm
- CI job integration approaches.

A- Install the generator

npm install -g generator-ptor

B- Creating a Project

mkdir projectName && cd projectName
yo ptor "ProjectName"

or

yo ptor

If you dont pass a name then package.json will take a generic name for the app. Yeoman will ask if you would like to user CoffeScript. If you say yes the sample and configuration files will be adapted for CoffeeScript.

Explanation

This script is actually doing the following steps:

1- Install all dependencies

npm install

2- Install selenium standalone server and chrome driver (./bin/install.sh)

./node_modules/protractor/bin/webdriver-manager update

C- Creating a Spec

yo ptor:spec "TestName"

Yeoman will generate the file TestNameSpec.js under specs folder.

If you already have a CoffeeScript inside your Spec folder, then Yeoman will create a coffeescript pageObject for you. If you dont and you would like to force the coffeescript creation, you may run:

yo ptor:spec "TestName" --coffee

D- Creating a page Object

yo ptor:page "PageName"

If you already have a CoffeeScript inside your pageObjects folder, then Yeoman will create a coffeescript pageObject for you. If you dont and you would like to force the coffeescript creation, you may run:

yo ptor:page "PageName" --coffee

Generator Development Notes

Install package locally:

sudo npm link

Verify if package is installed

sudo npm ls --global generator-ptor

Remove package

sudo npm rm --global generator-ptor

License

MIT License