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

v1.6.0

Published

Generator for AngularJS apps, with an oppinionated and tailored workflow

Downloads

11

Readme

generator nodes

Build Status Coverage Status semantic-release

Opinionated workflow and toolkit used for Angular front-end development at Nodes, feel free to use it for your own projects aswell.

Usage:

Prerequisites:

Install yo, grunt-cli, bower and generator-nodes globally:

npm install -g grunt-cli bower yo generator-mpdes

Make a new directory, and cd into it:

mkdir my-new-project && cd $_

Run yo nodes:

yo nodes

Grunt

The following grunt tasks are available:

  • grunt serve - starts a browsersync server, serving files from the app folder
  • grunt dist - starts a browsersync server, serving the production ready files from the dist folder
  • grunt build - builds the project (please have a look at the gruntfile to see the steps involved in this process, and have a look at the minification-safe section of this readme)

Generators

Available basic generators:

  • nodes (aka nodes:app)

  • nodes:constant
  • nodes:value
  • nodes:controller
  • nodes:factory
  • nodes:service
  • nodes:decorator
  • nodes:provider
  • nodes:directive
  • nodes:filter
  • nodes:route
  • nodes:module
  • nodes:html
  • nodes:scss
  • nodes:font

Available advanced generators:

  • nodes:state
  • nodes:child-state
  • nodes:model
  • nodes:component

Project structure

├── app
    ├── assets              - fonts, images, etc…
    ├── common              - Common components, sharable across modules (directives, filters, etc.)
    ├── config              - Project specific configuration files (endpoints, config/bootstrap etc.)
    ├── models              - API Communication, Buisness Models etc.
    ├── modules             - Views / Routes
    └── styles				- Application wide styles

State structure

In our experience, having some "high level" wrapper states around an application greatly improves flexibility and removes alot of noice from the $rootScope. With this in mind we have structured our states like this:

  • All states are children of the application state which is an abstract state
  • The application state is rendered in the [ui-view="root"] element.
  • All children of application are rendered in the [ui-view="application"] which is located in the _application.template.html file.

Minification safe

tl;dr: You don't need to write annotated code as the build step will handle it for you.

By default, generators produce unannotated code. Without annotations, AngularJS's DI system will break when minified. Typically, these annotations that make minification safe are added automatically at build-time, after application files are concatenated, but before they are minified. The annotations are important because minified code will rename variables, making it impossible for AngularJS to infer module names based solely on function parameters.

The recommended build process uses ng-annotate, a tool that automatically adds these annotations. However, if you'd rather not use it, you have to add these annotations manually yourself. Why would you do that though? If you find a bug in the annotated code, please file an issue at ng-annotate.

Add to index

By default, new scripts are added to the index.html file. However, this may not always be suitable. Some use cases:

  • Manually added to the file
  • Auto-added by a 3rd party plugin
  • Using this generator as a subgenerator

To skip adding them to the index, pass in the skip-add argument:

yo nodes:service serviceName --skip-add

bower components

The following modules are always installed by the generator:

  • ui.router
  • angular-loading-bar
  • cgBusy
  • angulartics + angulartics.google.analytics

The following components can be installed when running the generator:

  • nCore
  • nTranslate
  • Foundation + Angular-foundation
  • Greensock Animation Platform
  • Lodash + ngLodash
  • ngAnimate
  • ngSanitize
  • ngTouch
  • ngStorage

We keep a list of javascript modules to be ignored by wiredep in our gruntfile. Use this ie. to ignore jQuery plugins from third-party modules.