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-angular-flow

v2.0.4

Published

AngularJS+Webpack app generator for large applications with maintainable and clear file structure

Downloads

19

Readme

generator-angular-flow

Improve productivity and consistency on your AngularJS projects.
Designed for large multi-module ng apps.
Uses: angular, webpack, sass, ui-router, ui-bootstrap, angular-modals.

Features

  • easily create multiple angular modules in your project
  • each module can have it's own states, components, services, directives, modals, filters etc.
  • angular-flow components are inspired by web components so they group .js, .html, .scss files in one place.
  • easy create nested ui-router states in modules
  • use scripts for running dev server with live reload or for building for production

Author: Piotr Błaszczak

Instalation

first make sure you have installed NodeJS(tested on v4.2.0) with npm (tested on v2.14.7) then you have to install:

yeoman

npm install -g yo

angular-flow generaotr

npm install -g generator-angular-flow

create new project

Make a new directory, and cd into it

mkdir my-new-project
cd my-new-project

generate new app

yo angular-flow

Run npm run start
and go to localhost:8080/ to see the app running with live reload

Now you are ready to start developing your app.

Scripts

Helpful scripts ready for you to start your work

npm run start   to watch files for changes and build for dev.
npm run watch    watch for changes and build it to /dist/.
npm run build    build for production to /dist/.

Generators

Available generators:

Note: Generators are to be run from the root directory of your app.

App

Sets up a new AngularJS app, generating all the boilerplate you need to get started. The app generator will gide you through the process with questions.

Example:

yo angular-flow

it will generate files required to develop, build and run your app
you should look to /public/src becourse there you will be doing your work

This generator wil create the project and default module "app" with all basic configuration

Module

When you generate your app with yo angular-flow command you will have "app" module created so you can put your states, components and other stuff there
but when your application grows, it's better to separate some functionality to other modules
for this task we can se yo angular-flow:module {moduleName} command

This generator creates new module in /public/src

Example:

yo angular-flow:module user

will generate /public/src/user/user-module.js

State

Creates new ui-router state in module.
The argument should require the path of the state

notice: the path should start with module name, otherwise you will get module not found error

Example:

yo angular-flow:state user user;

creates

public/src/user/_states/user/user-state.js
public/src/user/_states/user/user-state.html
public/src/user/_states/user/user-state.scss

you can create another nested state

yo angular-flow:state user user.login;

creates

public/src/user/_states/user/login/user-login-state.js
public/src/user/_states/user/login/user-login-state.html
public/src/user/_states/user/login/user-login-state.scss

Component

A component is basically a element directive that by convention keeps all js,html and css files in one place.
This helps keep complexity low, and makes it easy to separate parts of your application into smaller and more maintainable parts.

Example:

yo angular-flow:component user login

Produces these files:

public/src/user/components/login/login.js
public/src/user/components/login/login.html
public/src/user/components/login/login.scss

Witch in turn lets you specify custom HTML tags like this to invoke a completely self contained component:

<login></login>

The view has specified a component name as a class, helping you avoid CSS collisions.
Specify your styles specific for this component in SCSS under a .login class wrapper, and only this component is targeted. This is an OK approach until shadow DOMs and web components become widely supported.

Modal

Similar to components but uses angular-modals module to register ui-bootstrap modal Example:

yo angular-flow:modal user login

Produces these files:

public/src/user/modals/login-modal/login-modal.js
public/src/user/modals/login-modal/login-modal.html
public/src/user/modals/login-modal/login-modal.scss

now to open the modal use modal directive

<button modal="login">login</button>

or $modals service

$modals.open('login').then(function(user){
    // user was logged in
}, function(error){
    // modal closed or dismised
});

check the angular-modals documentation for more info how to use it

Service

Generates an AngularJS service in module.

Example:

yo angular-flow:service user auth

Produces public/src/user/services/auth-srv.js:

and you can inject it with name authSrv

Resource

Generates an restmod resource in module.

Example:

yo angular-flow:resource user profile

Produces public/src/user/resources/profile-res.js:

and you can inject it with name profileRes

Directive

Generates an AngularJS directive in module.

Example:

yo angular-flow:directive user status

Produces public/src/user/directives/status-directive.js:

and you can use it like <div status="off"></div>

Filter

Generates an AngularJS filter in module.

Example:

yo angular-flow:service user user-name

Produces public/src/user/filters/user-name-filter.js:

and you can inject it with name {{user.id|userName}}

TODO

  • generate doc-blocks
  • generate tests
  • generate mocks

License

BSD license