Comparing version 2.0.5 to 3.0.0
@@ -39,4 +39,8 @@ var fs = require('fs'); | ||
transform: function (readable, writeable, file) { | ||
var transform = new TransformStream(config); | ||
readable.pipe(transform).pipe(writeable); | ||
if (isImageFile(file.name)) { | ||
readable.pipe(writeable); | ||
} else { | ||
var transform = new TransformStream(config); | ||
readable.pipe(transform).pipe(writeable); | ||
} | ||
} | ||
@@ -55,2 +59,6 @@ }, function (err) { | ||
function isImageFile(path) { | ||
return /\.(jpe?g|gif|png)$/.test(path); | ||
} | ||
function copyFilesInDir(dir, options) { | ||
@@ -57,0 +65,0 @@ fs.readdirSync(dir).forEach(function (filename) { |
@@ -46,4 +46,4 @@ var fs = require('fs'); | ||
hapi: { | ||
"hapi": "^6.0.2", | ||
"moonboots_hapi": "^2.4.0" | ||
"hapi": "^8.0.0", | ||
"moonboots_hapi": "^4.0.0" | ||
} | ||
@@ -50,0 +50,0 @@ }; |
@@ -8,2 +8,3 @@ { | ||
"andlog": "^1.0.0", | ||
"ampersand-app": "^1.0.0", | ||
"ampersand-dom": "^1.2.1", | ||
@@ -23,2 +24,3 @@ "ampersand-form-view": "^2.0.0", | ||
"getconfig": "^1.0.0", | ||
"local-links": "^1.2.0", | ||
"stylizer": "^1.0.0", | ||
@@ -25,0 +27,0 @@ "templatizer": "^1.0.0", |
{ | ||
"name": "ampersand", | ||
"description": "CLI tool for generating single page apps a. la. http://humanjavascript.com", | ||
"version": "2.0.5", | ||
"version": "3.0.0", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -14,15 +14,15 @@ "bin": { | ||
"escodegen": "^1.3.3", | ||
"esprima": "~1.2.2", | ||
"find-root": "~0.1.1", | ||
"fs-extra": "~0.8.1", | ||
"humps": "0.0.1", | ||
"esprima": "^1.2.2", | ||
"find-root": "^0.1.1", | ||
"fs-extra": "^0.14.0", | ||
"humps": "^0.4.2", | ||
"inquirer": "^0.8.0", | ||
"jade": "~1.0.2", | ||
"multiline": "~0.2.0", | ||
"ncp": "0.4.2", | ||
"rc": "~0.3.4", | ||
"readable-stream": "1.0.2", | ||
"repeat-string": "~0.1.2", | ||
"rimraf": "~2.2.6", | ||
"slugger": "0.0.3", | ||
"jade": "^1.8.2", | ||
"multiline": "^1.0.1", | ||
"ncp": "^1.0.1", | ||
"rc": "^0.5.5", | ||
"readable-stream": "^1.0.2", | ||
"repeat-string": "^1.2.0", | ||
"rimraf": "^2.2.6", | ||
"slugger": "^1.0.0", | ||
"underscore": "1.5.2" | ||
@@ -29,0 +29,0 @@ }, |
@@ -91,7 +91,7 @@ /* global console */ | ||
stylesheets: [ | ||
fixPath('public/css/bootstrap.css'), | ||
fixPath('public/css/app.css') | ||
fixPath('stylesheets/bootstrap.css'), | ||
fixPath('stylesheets/app.css') | ||
], | ||
browserify: { | ||
debug: false | ||
debug: config.isDev | ||
}, | ||
@@ -112,4 +112,4 @@ beforeBuildJS: function () { | ||
stylizer({ | ||
infile: fixPath('public/css/app.styl'), | ||
outfile: fixPath('public/css/app.css'), | ||
infile: fixPath('stylesheets/app.styl'), | ||
outfile: fixPath('stylesheets/app.css'), | ||
development: true | ||
@@ -116,0 +116,0 @@ }, done); |
@@ -47,6 +47,4 @@ var _ = require('underscore'); | ||
exports.name = 'fake_api'; | ||
exports.version = '0.0.0'; | ||
exports.register = function (plugin, options, next) { | ||
plugin.route({ | ||
exports.register = function (server, options, next) { | ||
server.route({ | ||
method: 'GET', | ||
@@ -59,3 +57,3 @@ path: '/api/people', | ||
plugin.route({ | ||
server.route({ | ||
method: 'POST', | ||
@@ -71,3 +69,3 @@ path: '/api/people', | ||
plugin.route({ | ||
server.route({ | ||
method: 'GET', | ||
@@ -81,3 +79,3 @@ path: '/api/people/{id}', | ||
plugin.route({ | ||
server.route({ | ||
method: 'DELETE', | ||
@@ -92,3 +90,3 @@ path: '/api/people/{id}', | ||
plugin.route({ | ||
server.route({ | ||
method: 'PUT', | ||
@@ -105,1 +103,6 @@ path: '/api/people/{id}', | ||
}; | ||
exports.register.attributes = { | ||
version: '0.0.0', | ||
name: 'fake_api' | ||
}; |
@@ -7,3 +7,3 @@ var config = require('getconfig'); | ||
var appDir = __dirname + '/client'; | ||
var cssDir = __dirname + '/public/css'; | ||
var cssDir = __dirname + '/stylesheets'; | ||
@@ -39,2 +39,5 @@ | ||
], | ||
browserify: { | ||
debug: config.isDev | ||
}, | ||
beforeBuildJS: function () { | ||
@@ -41,0 +44,0 @@ // This re-builds our template files from jade each time the app's main |
var Hapi = require('hapi'); | ||
var config = require('getconfig'); | ||
var server = new Hapi.Server(config.http.listen, config.http.port); | ||
var MoonBootsHapi = require('moonboots_hapi'); | ||
var moonbootsConfig = require('./moonbootsConfig'); | ||
var fakeApi = require('./fakeApi'); | ||
var staticRoutes = require('./staticRoutes'); | ||
var internals = {}; | ||
var server = new Hapi.Server(); | ||
server.connection({ host: config.http.listen, port: config.http.port }); | ||
// set clientconfig cookie | ||
@@ -21,19 +25,25 @@ internals.configStateConfig = { | ||
} | ||
else { | ||
return reply(); | ||
} | ||
return reply.continue(); | ||
}); | ||
// require moonboots_hapi plugin | ||
server.pack.register({plugin: require('moonboots_hapi'), options: moonbootsConfig}, function (err) { | ||
server.register([ | ||
{ | ||
register: MoonBootsHapi.register, | ||
options: moonbootsConfig | ||
}, | ||
{ | ||
register: fakeApi.register | ||
}, | ||
{ | ||
register: staticRoutes | ||
} | ||
], function (err) { | ||
if (err) throw err; | ||
server.pack.register(fakeApi, function (err) { | ||
// If everything loaded correctly, start the server: | ||
server.start(function (err) { | ||
if (err) throw err; | ||
// If everything loaded correctly, start the server: | ||
server.start(function (err) { | ||
if (err) throw err; | ||
console.log('{{{title}}} is running at: http://localhost:' + config.http.port + ' Yep. That\'s pretty awesome.'); | ||
}); | ||
console.log('{{{title}}} is running at: http://' + config.http.listen + ':' + config.http.port); | ||
}); | ||
}); |
@@ -1,8 +0,5 @@ | ||
/*global app, me, $*/ | ||
var app = require('ampersand-app'); | ||
var _ = require('underscore'); | ||
var logger = require('andlog'); | ||
var config = require('clientconfig'); | ||
var Router = require('./router'); | ||
var tracking = require('./helpers/metrics'); | ||
var MainView = require('./views/main'); | ||
@@ -13,44 +10,37 @@ var Me = require('./models/me'); | ||
// attach our app to `window` so we can | ||
// easily access it from the console. | ||
window.app = app; | ||
module.exports = { | ||
// this is the the whole app initter | ||
blastoff: function () { | ||
var self = window.app = this; | ||
// Extends our main app singleton | ||
app.extend({ | ||
me: new Me(), | ||
people: new People(), | ||
router: new Router(), | ||
// This is where it all starts | ||
init: function() { | ||
// Create and attach our main view | ||
this.mainView = new MainView({ | ||
model: this.me, | ||
el: document.body | ||
}); | ||
// create our global 'me' object and an empty collection for our people models. | ||
window.me = new Me(); | ||
this.people = new People(); | ||
// init our URL handlers and the history tracker | ||
this.router = new Router(); | ||
// wait for document ready to render our main view | ||
// this ensures the document has a body, etc. | ||
domReady(function () { | ||
// init our main view | ||
var mainView = self.view = new MainView({ | ||
model: me, | ||
el: document.body | ||
}); | ||
// ...and render it | ||
mainView.render(); | ||
// we have what we need, we can now start our router and show the appropriate page | ||
self.router.history.start({pushState: true, root: '/'}); | ||
}); | ||
// this kicks off our backbutton tracking (browser history) | ||
// and will cause the first matching handler in the router | ||
// to fire. | ||
this.router.history.start({ pushState: true }); | ||
}, | ||
// This is how you navigate around the app. | ||
// This is a helper for navigating around the app. | ||
// this gets called by a global click handler that handles | ||
// all the <a> tags in the app. | ||
// it expects a url without a leading slash. | ||
// for example: "costello/settings". | ||
navigate: function (page) { | ||
// it expects a url pathname for example: "/costello/settings" | ||
navigate: function(page) { | ||
var url = (page.charAt(0) === '/') ? page.slice(1) : page; | ||
this.router.history.navigate(url, {trigger: true}); | ||
this.router.history.navigate(url, { | ||
trigger: true | ||
}); | ||
} | ||
}; | ||
}); | ||
// run it | ||
module.exports.blastoff(); | ||
// run it on domReady | ||
domReady(_.bind(app.init, app)); |
@@ -10,3 +10,3 @@ var AmpersandModel = require('ampersand-model'); | ||
lastName: ['string', true, ''], | ||
username: ['string'], | ||
username: ['string'] | ||
}, | ||
@@ -13,0 +13,0 @@ derived: { |
@@ -47,5 +47,5 @@ var PageView = require('./base'); | ||
lastName: lastNames[getRandom(0, lastNames.length - 1)], | ||
coolnessFactor: getRandom(0, 15) | ||
coolnessFactor: getRandom(0, 11) | ||
}); | ||
} | ||
}); |
@@ -1,2 +0,2 @@ | ||
/*global app*/ | ||
var app = require('ampersand-app'); | ||
var PageView = require('./base'); | ||
@@ -3,0 +3,0 @@ var templates = require('../templates'); |
@@ -1,2 +0,3 @@ | ||
/*global app, alert*/ | ||
/*global alert*/ | ||
var app = require('ampersand-app'); | ||
var PageView = require('./base'); | ||
@@ -3,0 +4,0 @@ var templates = require('../templates'); |
@@ -1,2 +0,3 @@ | ||
/*global app, alert*/ | ||
/*global alert*/ | ||
var app = require('ampersand-app'); | ||
var PageView = require('./base'); | ||
@@ -3,0 +4,0 @@ var templates = require('../templates'); |
@@ -1,2 +0,2 @@ | ||
/*global me, app*/ | ||
var app = require('ampersand-app'); | ||
var Router = require('ampersand-router'); | ||
@@ -24,4 +24,4 @@ var HomePage = require('./pages/home'); | ||
home: function () { | ||
this.trigger('page', new HomePage({ | ||
model: me | ||
app.trigger('page', new HomePage({ | ||
model: app.me | ||
})); | ||
@@ -31,4 +31,4 @@ }, | ||
collectionDemo: function () { | ||
this.trigger('page', new CollectionDemo({ | ||
model: me, | ||
app.trigger('page', new CollectionDemo({ | ||
model: app.me, | ||
collection: app.people | ||
@@ -39,4 +39,4 @@ })); | ||
info: function () { | ||
this.trigger('page', new InfoPage({ | ||
model: me | ||
app.trigger('page', new InfoPage({ | ||
model: app.me | ||
})); | ||
@@ -46,7 +46,7 @@ }, | ||
personAdd: function () { | ||
this.trigger('page', new PersonAddPage()); | ||
app.trigger('page', new PersonAddPage()); | ||
}, | ||
personEdit: function (id) { | ||
this.trigger('page', new PersonEditPage({ | ||
app.trigger('page', new PersonEditPage({ | ||
id: id | ||
@@ -57,3 +57,3 @@ })); | ||
personView: function (id) { | ||
this.trigger('page', new PersonViewPage({ | ||
app.trigger('page', new PersonViewPage({ | ||
id: id | ||
@@ -60,0 +60,0 @@ })); |
@@ -1,14 +0,12 @@ | ||
/*global app, me, $*/ | ||
// This app view is responsible for rendering all content that goes into | ||
// <html>. It's initted right away and renders itself on DOM ready. | ||
// This view also handles all the 'document' level events such as keyboard shortcuts. | ||
var app = require('ampersand-app'); | ||
var setFavicon = require('favicon-setter'); | ||
var View = require('ampersand-view'); | ||
var dom = require('ampersand-dom'); | ||
var ViewSwitcher = require('ampersand-view-switcher'); | ||
var _ = require('underscore'); | ||
var domify = require('domify'); | ||
var dom = require('ampersand-dom'); | ||
var localLinks = require('local-links'); | ||
var templates = require('../templates'); | ||
var tracking = require('../helpers/metrics'); | ||
var setFavicon = require('favicon-setter'); | ||
@@ -18,5 +16,6 @@ | ||
template: templates.body, | ||
autoRender: true, | ||
initialize: function () { | ||
// this marks the correct nav item selected | ||
this.listenTo(app.router, 'page', this.handleNewPage); | ||
this.listenTo(app, 'page', this.handleNewPage); | ||
}, | ||
@@ -31,3 +30,3 @@ events: { | ||
// main renderer | ||
this.renderWithTemplate({me: me}); | ||
this.renderWithTemplate(this); | ||
@@ -50,3 +49,3 @@ // init and configure our page switcher | ||
// setting a favicon for fun (note, it's dynamic) | ||
setFavicon('/images/ampersand.png'); | ||
setFavicon('/favicon.ico'); | ||
return this; | ||
@@ -63,11 +62,16 @@ }, | ||
// Handles all `<a>` clicks in the app not handled | ||
// by another view. This lets us determine if this is | ||
// a click that should be handled internally by the app. | ||
handleLinkClick: function (e) { | ||
var aTag = e.target; | ||
var local = aTag.host === window.location.host; | ||
// if it's a plain click (no modifier keys) | ||
// and it's a local url, navigate internally | ||
if (local && !e.ctrlKey && !e.shiftKey && !e.altKey && !e.metaKey && !e.defaultPrevented) { | ||
// This module determines whether a click event is | ||
// a local click (making sure the for modifier keys, etc) | ||
// and dealing with browser quirks to determine if this | ||
// event was from clicking an internal link. That we should | ||
// treat like local navigation. | ||
var localPath = localLinks.pathname(e); | ||
if (localPath) { | ||
e.preventDefault(); | ||
app.navigate(aTag.pathname); | ||
app.navigate(localPath); | ||
} | ||
@@ -74,0 +78,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
/*global _ QUnit ok*/ | ||
/*global $, _, QUnit, ok*/ | ||
@@ -3,0 +3,0 @@ // mustache style templating |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
449401
92
12180
1
+ Addedacorn@1.2.22.7.0(transitive)
+ Addedacorn-globals@1.0.9(transitive)
+ Addedalign-text@0.1.4(transitive)
+ Addedasap@1.0.0(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcenter-align@0.1.3(transitive)
+ Addedcharacter-parser@1.2.1(transitive)
+ Addedclean-css@3.4.28(transitive)
+ Addedcliui@2.1.0(transitive)
+ Addedcommander@2.6.02.8.1(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconstantinople@3.0.2(transitive)
+ Addedfs-extra@0.14.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedget-stdin@4.0.1(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedgraceful-readlink@1.0.1(transitive)
+ Addedhumps@0.4.2(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedini@1.3.8(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-promise@2.2.2(transitive)
+ Addedjade@1.11.0(transitive)
+ Addedjsonfile@2.4.0(transitive)
+ Addedjstransformer@0.0.2(transitive)
+ Addedkind-of@3.2.2(transitive)
+ Addedlazy-cache@1.0.4(transitive)
+ Addedlongest@1.0.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedmultiline@1.0.2(transitive)
+ Addedncp@1.0.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpromise@6.1.0(transitive)
+ Addedrc@0.5.5(transitive)
+ Addedreadable-stream@1.1.14(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedright-align@0.1.3(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedslugger@1.0.1(transitive)
+ Addedsource-map@0.4.40.5.7(transitive)
+ Addedstrip-indent@1.0.1(transitive)
+ Addedstrip-json-comments@0.1.3(transitive)
+ Addeduglify-js@2.8.29(transitive)
+ Addedvoid-elements@2.0.1(transitive)
+ Addedwith@4.0.3(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedyargs@3.10.0(transitive)
- Removedasync@0.2.10(transitive)
- Removedbrace-expansion@2.0.1(transitive)
- Removedcharacter-parser@1.2.0(transitive)
- Removedcommander@2.0.0(transitive)
- Removedconstantinople@1.0.2(transitive)
- Removedfs-extra@0.8.1(transitive)
- Removedhumps@0.0.1(transitive)
- Removedini@1.1.0(transitive)
- Removedjade@1.0.2(transitive)
- Removedjsonfile@1.1.1(transitive)
- Removedminimatch@10.0.1(transitive)
- Removedmkdirp@0.3.5(transitive)
- Removedmonocle@1.1.50(transitive)
- Removedmultiline@0.2.0(transitive)
- Removedncp@0.4.2(transitive)
- Removedrc@0.3.5(transitive)
- Removedreadable-stream@1.0.2(transitive)
- Removedreaddirp@0.2.5(transitive)
- Removedrepeat-string@0.1.2(transitive)
- Removedrimraf@2.2.8(transitive)
- Removedslugger@0.0.3(transitive)
- Removedsource-map@0.1.34(transitive)
- Removeduglify-js@2.4.02.4.24(transitive)
- Removedwith@2.0.0(transitive)
- Removedyargs@3.5.4(transitive)
Updatedesprima@^1.2.2
Updatedfind-root@^0.1.1
Updatedfs-extra@^0.14.0
Updatedhumps@^0.4.2
Updatedjade@^1.8.2
Updatedmultiline@^1.0.1
Updatedncp@^1.0.1
Updatedrc@^0.5.5
Updatedreadable-stream@^1.0.2
Updatedrepeat-string@^1.2.0
Updatedrimraf@^2.2.6
Updatedslugger@^1.0.0