npm run production
- Build task that generates minified scripts for productionnpm run precommit
- Run the unit tests,, and generate a minified scriptnpm run clean
- Remove thedist
foldernpm run eslint:source
- Lint the sourcenpm run eslint:common
- Lint the unit tests shared by Karma and Mochanpm run eslint:server
- Lint the unit tests for servernpm run eslint:browser
- Lint the unit tests for browsernpm run clean
- Remove the coverage report and the dist folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var babel = require('babelify'); | |
function compile(watch) { | |
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Router} 'express' | |
export default const router = Router() | |
router.get('/items', | |
(req, res, next) => { | |
Item | |
.find() | |
.exec() | |
.catch(next) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Router} 'express' | |
import {auth, logged} from 'actions/auth' | |
import {list, show} from 'actions/users' | |
import {render} from 'actions/common' | |
export default const router = Router() | |
router.use(auth) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.get('/api/users', loadUsers, json) | |
router.get('/users', loadUsers, render('users/list')) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import m from 'mithril' | |
// Function for compose header and footer into layout | |
function mixinLayout (layout, header, footer, body) { | |
return layout(header, footer, body) | |
} | |
// Layout component | |
function layout (header, footer, body) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import Firebase from 'firebase' | |
import ReactFireMixin from 'reactfire' | |
import reactMixin from 'react-mixin' | |
const ref = new Firebase('https://<APPNAME>.firebaseio.com/users') | |
class UsersList extends Component { | |
constructor (props, context) { | |
super(props, context) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import Firebase from 'firebase' | |
import ReactFireMixin from 'reactfire' | |
import reactMixin from 'react-mixin' | |
import LinkedStateMixin from 'react-addons-linked-state-mixin' | |
const ref = new Firebase('https://<APP NAME>.firebaseio.com/') | |
class Messages extends Component { | |
constructor (props, context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var prop = (prop) => (obj) => obj[prop] | |
var html = (selector) => (data) => $(selector).html(data) | |
var render = (template) => (json) => Template.render(template, json) | |
var comments = (params) => fetch('/comments', params).then(JSON.parse).then(prop('data')).then(render('commentsList')) | |
var renderComments = (params) => comments(params).then(html('.comments')) | |
renderComments({ user: 1 }).catch(err => console.error(err)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function runSerial (tasks) { | |
var result = Promise.resolve() | |
tasks.forEach(task => { | |
result = result.then(() => task()) | |
}) | |
return result | |
} |