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

generator-flight

v0.8.0

Published

Generator for scaffolding out a Flight web app

Downloads

64

Readme

Flight generator

Build Status

A Yeoman generator for Flight, Twitter's client-side JavaScript framework. Get up and running with everything you need to create an application.

NOTE: A separate Flight package generator is available for creating standalone Flight components.

Recommended setup

Install Node.js (which comes with npm). It's best to have npm version 1.2.x or above installed.

Next, globally install the Flight generator. This will automatically install Bower and Yo as global dependencies. These tools will help manage your dependencies and generate the boilerplate Flight application.

npm install -g generator-flight

Make a new directory, and cd into it:

mkdir flight-app && cd $_

You're now ready to generate an app!

Main generator

To generate a Flight-based application:

yo flight <app-name>

N.B. All your Node and client-side dependencies will be installed automatically unless you include the --skip-install option.

All generators and their output

Available generators (to be run in the root directory of a project).

  • flight <app-name> (aka flight:app)
  • flight:component <component-name>
  • flight:mixin <mixin-name>
  • flight:page <page-name>
  • flight:all

flight:app

Scaffolds a Flight application file structure, installs all the library code you need, and correctly configures your test setup. The app generator will prompt you to optionally install Bootstrap or Normalize.css.

Example:

yo flight my_app

Produces:

.
├── app
│   ├── bower_components
│   │   ├── es5-shim
│   │   ├── flight
│   │   ├── jasmine-flight
│   │   ├── jquery
│   │   └── requirejs
│   ├── css
│   │   └── main.css
│   ├── img
│   ├── js
│   │   ├── component
│   │   ├── page
│   │   │   └── default.js
│   │   └── main.js
│   ├── 404.html
│   ├── favicon.ico
│   ├── index.html
│   └── robots.txt
├── node_modules
├── test
│   └── test-main.js
├── .bowerrc
├── .gitattributes
├── .gitignore
├── .jshintrc
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── bower.json
├── gulpfile.js
├── karma.conf.js
└── package.json

Locally installed software

Automatically installs all the Flight framework dependencies, and sets up a Node-based toolchain for your development workflow.

via Bower

via npm

  • Flight generator (installed as a local dependency)
  • Gulp task runner
  • Karma unit test runner
  • Node-Static file server

flight:component

Generates a component in app/js/component.

Example:

yo flight:component tweet_box

Produces app/js/component/tweet_box.js:

define(function (require) {
  var defineComponent = require('flight/lib/component');

  return defineComponent(tweetBox);

  function tweetBox() {
    this.attributes({});
    this.after('initialize', function () {});
  }
});

And the test file test/spec/component/tweet_box.spec.js:

describeComponent('component/tweet_box', function () {
  // Initialize the component and attach it to the DOM
  beforeEach(function () {
    this.setupComponent();
  });

  it('should be defined', function () {
    expect(this.component).toBeDefined();
  });

  it('should do something', function () {
    expect(true).toBe(false);
  });
});

flight:mixin

Generates a mixin component in app/js/component.

Example:

yo flight:mixin tweet_actions

Produces app/js/component/with_tweet_actions.js:

define(function (require) {
  return withTweetActions;

  function withTweetActions() {
    this.attributes({});
    this.after('initialize', function () {});
  }
});

And the test file test/spec/component/with_tweet_box.spec.js:

describeMixin('component/with_tweet_box', function () {
  // Initialize the component and attach it to the DOM
  beforeEach(function () {
    this.setupComponent();
  });

  it('should be defined', function () {
    expect(this.component).toBeDefined();
  });

  it('should do something');
});

flight:page

Generates a page component in app/js/page.

Example:

yo flight:page settings

Produces app/js/page/settings.js:

define(function (require) {
  // var myComponent = require('component/my_component');

  return initialize;

  function initialize() {
    // myComponent.attachTo(document);
  }
});

flight:all

Shortcut that runs flight:app, flight:component my_component, and flight:mixin my_mixin.

Developing your application

The generated application's README contains instructions on how to run the tests, server, and other tasks.

Contributing to this project

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.

Authors

License

Copyright 2013 Twitter, Inc and other contributors.

Licensed under the MIT License.