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-fish

v0.9.2

Published

AKFish's generator

Downloads

5

Readme

generator-fish NPM version Build Status Dependency Status

AKFish's generator

Installation

First, install Yeoman and generator-fish using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-fish

Then generate your new project:

yo fish

Usage

In your project folder, run:

yo fish

Then follow the instructions.

Select tasks via CLI argument:

yo fish --coffee --mocha

Or run in standalone mode:

yo fish:coffee

Supported gulp tasks:

  • coffee
  • mocha
  • es6(babel)
  • browserify
  • watch
  • clean
  • copy

(Optional) You can override configurations with CLI arguments passed to gulp command.

Run:

yo fish:cli

To configure CLI mapping.

Getting To Know Yeoman

Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced. Feel free to learn more about him.

Development

Add New Task

Run the internal fish:fish generator in generator-fish project folder:

yo fish:fish

Modify the generated generators/#new#/index.js

'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var Fish = require('../../lib/base');

module.exports = Fish.buildTask('coffee', ['gulp-coffee'],
  {
    defaultSrc: "./coffee/**/*.coffee",
    defaultDst: "./lib",
    ignoreSrc: false, // toggle `src` question
    ignoreDst: false, // toggle `dst` question
    supportSourceMap: true, // toggle `sourceMap` question
    questions: [
      {
        type: 'confirm',
        name: 'bare',
        message: '--bare',
        default: true
      },
    ]
  },
  {
    // TODO: custom prototype methods
  });

When running, the prompts will generate props in its 'flatten' form:

{
  src: '',
  dst: '',
  // other fields
}

When stored to gulpconfig.json under the task's namespace, fields other than generic and private ones will be moved to opts field.

{
  src: '',
  dst: '',
  // other fields
  opts: {
    // other fields
  }
}

The opts field will be used as gulp plugin options.

Notes:

  • Generic questions will be asked before custom questions:
    • taskName
    • src, toggled by ignoreSrc
    • dst, toggled by ignoreDst
    • sourceMap, toggled by supportSourceMap
  • Questions with _ as prefix in their names are private.
  • Special custom prototype methods:
    • _doPrompt - called right after this.props is set but before it's stored to gulpconfig
    • _doWriting - called after gulpfile.coffee, gulpconfig.json and task templates are written
    • _doInstall - called after fish:app and task's dependencies are installed

Modify the generated generators/#new#/templates/task.coffee

A typical task.coffee should be like this:

# require dependencies
module.exports = (profile = 'default') ->
  cfg = config["name:#{profile}"]

  # gulp.task
  • It's a template file with this.props as its parameters
  • It should expose a function that takes profile name as the only option
  • Following objects are exposed to global in gulpfile.coffee:
    • gulp
    • heap - gulp-heap
    • config - all configurations
  • Task specific configurations are stored in config[name:profile]

License

MIT © akfish