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

v0.4.2

Published

An Angular module generator supporting fractal-structured codebases.

Readme

Generator Fractal

An Angular module generator supporting fractal-structured codebases.

Yeoman

If you don't know Yeoman, check it.

Installation

npm install -g generator-fractal

Usage

To create a module, run:

yo fractal module-name

Generator will ask you a few questions, create a directory for the new component and place all the files inside it. Additionally, in case of Less and Angular files, it will find parent module and inject import string.

If unitTests flag is enabled in config file, along with directive/controller/service files, generator will yield spec files.

Naming convention

All the directories and filenames are hyphenated, as well as directives in html and css classes. Names in javascript are camelCased.

Context files

By default new component directory will be created in the current working directory. However, it is common practice to keep javascript files separated from html templates, styles or unit tests. That's why Fractal allows you to specify where you want to keep which files, grouped by file context.

In order to do that, you must run fractal under a defined context path.

E.g. this sample config, stored in your app root directory as .yo-rc.json file

{
    "generator-fractal": {
        "fileContext": {
            "html": {
            	"path": "js/"
        	},

            "js": {
            	"path": "js/"
        	},

            "css": {
            	"path": "css/"
        	},

        	"spec": {
        		"path": "test/unit/"
        	}
        },
        "templatesPath": "templates/angular/",
        "unitTests": true
    }
}

Combined with

yo fractal admin-dashboard

Will result in the following output:

js/admin-dashboard/admin-dashboard-directive.js
js/admin-dashboard/admin-dashboard-controller.js
js/admin-dashboard/admin-dashboard-service.js
js/admin-dashboard/admin-dashboard.html
js/admin-dashboard/admin-dashboard-module.js
css/admin-dashboard/admin-dashboard.less
test/unit/admin-dashboard/admin-dashboard-controller.spec.js
test/unit/admin-dashboard/admin-dashboard-service.spec.js
test/unit/admin-dashboard/admin-dashboard-directive.spec.js

Config file

fileContext is a map of contexts and its settings

templatesPath is a public templates directory (eg. the one you prefix templateCache with)

unitTests determines whether to automatically enqueue a corresponding test subgenerator for a javascript file

Subgenerators

You may want to create only a directive, controller, service, etc. Currently available:

  • fractal:comp - module definition

  • fractal:ctrl - directive

  • fractal:dir - controller

  • fractal:srv - service

  • fractal:tpl - template

  • fractal:less - less css

  • fractal:tdir - directive unit test

  • fractal:tctrl - controller unit test

  • fractal:tsrv - service unit test

In this case, the file will be crated in the current working directory.

Current supported stack

Angular 1.x, Less, Jasmine

Don't like my templates?

Change them. And save for later reuse.

I'm hoping to make this tool elastic enough to support different and custom setups in the future.

Active development

The code needs a bit of refactoring and test coverage.

If you use it, please report bugs, ask for features.

Pull requests are welcome.