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-fullstack-backbone

v0.1.6

Published

Scaffold out a Fullstack Backbone.js project:RequireJS;ExpressJs;Redis;Mogoose;Sequelize;Materialize,Foundation5,Bootstrap

Downloads

4

Readme

Backbone.js generator Build Status Coverage Status

A Fullstack Backbone generator for Yeoman that provides a functional boilerplate Backbone app out of the box. You also get access to a number of sub-generators which can be used to easily create individual models, views, collections and so on.

  • The Good Part: Backbone help you module your javascript code.Good for maintain and readable. Multi-SASS lib. MVC both front end and back end.
  • The bad Part: More code for the module and MVC and test. Only support IE9+.

Optional RequireJS (AMD) support has recently been added as a prompt when using the generator on new projects.

Features:

    1. Front End,you can choose RequireJS or not.
    1. Back End,we using ExpressJs,redis,mogoose,Sequelize.
    1. UI lib support,Sass(Compass):Materialize,Foundation5,Bootstrap.
    1. grunt build,support offline Manifest.
    1. grunt upload,support compress and publish package.(But you need development your own CMS server).
    1. grunt test,run test karma for client side code ; mocha for server side code.
    1. Browser Support(It's also limited by the UI lib your choose):IE9+,FireFox4+,Safari5+,Chrome7+;
    1. Mockjs(app/scripts/mock_inject.js),hijack your ajax in develop environment.Split FE&BE.

Base on:

    1. redis for fast RAM cache data and session.
    1. mongodb for NO-SQL DB.
    1. mysql most popular SQL DB.
    1. compass more function and mixin for SASS for CSS extension language.

Usage

Install: npm install -g yo grunt bower generator-fullstack-backbone

Make a new directory and cd into it:

mkdir my-new-project && cd $_

Run yo fullstack-backbone, optionally passing an app name:

yo fullstack-backbone [app-name]

Run yo fullstack-backbone:all portal,portal is the name of your new action:

yo fullstack-backbone:all [action]

Run grunt serve,start your backbone fullstack trip(The server start need redis and mongoDB).

grunt serve

Generators

Available generators:

  • fullstack-backbone:model
  • fullstack-backbone:view
  • fullstack-backbone:collection
  • fullstack-backbone:all

Typical workflow

yo fullstack-backbone # generates your application base and build workflow
yo fullstack-backbone:all blog
grunt serve

After these commands,your blog base code will be generated.But you still need do some work to make it show on the screen.

    1. Open app/scripts/routes/all.js.
    1. Add your blog view in the backbone routes.
    1. Add href to this routes.eg: http://localhost/index.html#blog

Also checkout this NetTuts write-up for a guide to building Backbone.js apps using this generator.

Options

  • sequelize mysql ORM for nodejs,you can define your table like OOP in 'server/sqldb/yourClass.model.js' and use it like:
var models  = require('../sqldb');
models.User.findAll({}).then(function(users) {
    res.render('index', {
        title: 'Express',
        users: users
    });
});
  • --skip-install

    Skips the automatic execution of bower and npm after scaffolding has finished.By default this value is false.

A note regarding JST templates and strict mode

If you use strict mode in your app and JST templates the default grunt-jst implementation will cause your app to error out as the templates will be precompiled using a 'with' statement.

This can be addressed by changing the jst grunt task as follows:

jst: {
    compile: {
        options:
        {
            templateSettings:
            {
                variable: 'data'
            }
        },
        files: {
            '.tmp/scripts/templates.js': ['<%= yeoman.app %>/scripts/templates/*.ejs']
        }
    }
},

A result of this change is that your template variable definitions must also be updated from <%= templateVariable %> to <%= data.templateVariable %>. More information on this can be found in the Underscore documentation.

Folder & Files structure explain:

app(for browser side files):
	bower_components:bower depends libs。
	images:put your images here。
	scripts(backbone MVC & libs):
		collections:backbone collections。
		helpers:backbone helpers。
		models:backbone models。
		routes:backbone routes。
		templates:backbone templates。
		vendor:common libs。
		views:backbone views。
dist:build folder。
node_modules:nodejs depends libs。
server(for express server side files):
    api:RESTful controller
    config:express server config
    models:OOP DB models
    routes:RESTful routes
    app.js:express server start scripts
    helper.js:commonJS for server common helper
test(test files)。
.bowerrc:bower config。
.editorconfig:IDE common config。
.gitattributes:Git attributes config。
.jshintrc:jshint javascript coding style。
.yo-rc.json:yoman generator config。
bower.json:bower config。
config.rb:ruby config for compass。
gruntfile.js: grunt config for grunt running scripts。
package.json:nodejs config。
pm2.json:for pm2 maintain your project on server.
karma.conf.js: karma test config.

Contribute

When submitting a bugfix, write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix.

When submitting a new feature, add tests that cover the feature.

License

BSD license