NPM is the defacto package manager for CommonJS style modules leveraged by a Node application on the server. However, a set of best practices has recently emerged advocating the use of NPM to manage client packages over other client package managers such as Bower. Client packages are essentially packaged the in the same fashion as server packages, but package metadata and lifecycle scripts are used when necessary to facilitate the creation of artifacts that are consumed by the client. This concept is now being extended to isomorphic JavaScript applications. This talk will explore a real world use case focused on these best practices at WalmartLabs that is being used to package and build isomorphic web applications. The talk will cover the metadata schema and OSS build tools that are used to create various types of artifacts from node module packages. A demo will showcase the automated construction of an applica
This file contains 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 root = this.attributes.model.toJSON(); | |
var diameter = 960; | |
var format = d3.format(',d'); | |
var color = d3.scale.category20c(); | |
var bubble = d3.layout.pack() | |
.sort(null) | |
.size([diameter, diameter]) | |
.padding(1.5); | |
var svg = d3.select(this.el).append('svg') | |
.attr('width', diameter) |
This file contains 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
define(['lazoSyncher'], function (LazoSyncher) { | |
'use strict'; | |
return LazoSyncher.extend({ | |
fetch: function (options) { | |
var path = 'json!' + options.params.resource + '/' + options.params.locale + '.json' | |
LAZO.require([path], function (json) { | |
options.success(json); |
This file contains 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
define(['lazoView'], function (LazoView) { | |
'use strict'; | |
return LazoView.extend({ | |
serializeData: function (options) { | |
var self = this; | |
someAsnycFunc(function (err, localized) { | |
if (err) { |
This file contains 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
// repo is a model | |
{ | |
"lazo": { | |
"model": true | |
} | |
} | |
// repo is component with a dist | |
{ | |
"lazo": { |
This file contains 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
// https://github.com/walmartlabs/lazojs/wiki/Server-Setup | |
// app/server/server.js | |
define(['lazoServer'], function (LazoServer) { | |
'use strict'; | |
return LazoServer.extend({ | |
setup: function (hapi, pack, servers, options) { | |
for (var k in servers) { |
This file contains 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
define(['lazoApp', 'app/filters/auth'], function (LazoApp, authFilter) { | |
'use strict'; | |
return LazoApp.extend({ | |
initialize: function (callback) { | |
LAZO.app.addRequestFilter('.*', authFilter); | |
callback(); | |
} |
This file contains 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
// app/server/synchers/base.js | |
define(['lazoSyncher'], function (LazoSyncher) { | |
'use strict'; | |
// set up mongo connection here; not sure of best practices for establishing connections | |
// https://www.npmjs.org/package/mongodb | |
return LazoSyncer.extend({ |
This file contains 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
|- application | |
|- imports | |
hp.html (base element; includes polymer) | |
avatar.html | |
share.html | |
|- components | |
|- profile | |
|- imports | |
index.html |
This file contains 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
define(['lazoView'], function (View) { | |
'use strict'; | |
return View.extend({ | |
widgets: { | |
Avatar: 'app/widget-defs/avatar' | |
}, | |