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

ngbuilder

v0.3.2

Published

AngularJS component builder

Downloads

8

Readme

Angular app builder

TL;DR

A wrapper for common tasks in a frontend project, using Gulp, Browserify and friends.

Install with npm

$ npm install -g ngbuilder

Goals

Write a modular/pluggable app builder that does the common things of AngularJS projects through plugins that wrap gulp tasks (watch, uglify, browserify, cssmin, ngAnnotate...)

Plugins

ngbuilder-src

  • You write all your .js files inside a "/src" folder. Angular annotations in the sources are handled with ng-annotate. ES6 syntax is handed to traceur. The files go through JSHint to check for common mistakes. The sources are concatenated, and the result is write to index.js in the module root. The name "index.js" has a reason: Browserify can find it with a simple require('/path/to/module');

ngbuilder-sass

  • You write your .scss/.less/.whatever files in a "scss/less/whatever" folder, then the plugin outputs a module.css file in the module root

ngbuilder-templatecache

  • You write your views (.html partials) in a "views" folder and they are bundled as JS files, using AngularJS $templateCache. The views are saved to /src/views.js

ngbuilder-browserify

The steps above will generate some files that can be put together to make an app. For the JS files, browserify can generate a final bundle with all the dependencies.

What else?

Plugins are really simple to write. They're just Gulp wrappers.

Command-line

See the usage options right from the command-line. On a terminal, run this:

$ ngbuilder

Module structure

Each module should have a structure similar to this:


/src			module JS sources (expected: module.js + **/*.js)
/views			HTML partials (mostly directive templates)
/test			Unit tests
/scss			SCSS sources

// soon
/i18n			Translation tables

App structure

Apps follow the same structure of a module. Modules and apps are barely the same thing. The only difference is that an app will import all the module it needs and have them declared as module dependencies.

So, if your app called foo have user and store as module dependencies, your app would be like this:


var $module = angular.module('foo', ['user', 'store']);
export $module;

$module.controller('MyCtrl', ...)
// ...

Since we have Browserify and ES6 support built-in, you would do it this way:


import user from 'user';
import store from 'store';

angular.module('foo', [user.name, store.name]);
// ...

The reason for this is:

  • The ES6 modules syntax will be converted to require() syntax to be used by Browserify. It is also super clean and beautiful :D

  • Each module you import will be actually a reference to the Angular's module object (that one returned by angular.module('modulename')), which has a name property. So, using this property, you are actually pointing to that module.