Comparing version 1.7.4 to 1.8.0
@@ -30,3 +30,3 @@ var fs = require('fs'); | ||
return pack; | ||
} | ||
}; | ||
@@ -36,14 +36,19 @@ // our list of dependencies for each | ||
express: { | ||
"express": "3.x.x", | ||
"jade": "1.x.x", | ||
"helmet": "0.1.2", | ||
"moonboots": "1.x.x", | ||
"semi-static": "0.0.5" | ||
"body-parser": "^1.4.3", | ||
"compression": "^1.0.8", | ||
"cookie-parser": "^1.3.2", | ||
"express": "^4.6.1", | ||
"helmet": "^0.3.2", | ||
"jade": "^1.3.1", | ||
"moonboots-express": "^0.1.0", | ||
"semi-static": "^0.0.5", | ||
"serve-static": "^1.3.2" | ||
}, | ||
hapi: { | ||
"hapi": "6.x.x", | ||
"moonboots_hapi": "2.x.x" | ||
"hapi": "^6.0.2", | ||
"moonboots_hapi": "^2.3.2" | ||
} | ||
}; | ||
// because I'm anal | ||
@@ -50,0 +55,0 @@ function sortObjectKeysAlphabetically(object) { |
{ | ||
"name": "ampersand", | ||
"description": "CLI tool for generating single page apps a. la. http://humanjavascript.com", | ||
"version": "1.7.4", | ||
"version": "1.8.0", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -6,0 +6,0 @@ "bin": { |
@@ -98,3 +98,3 @@ # The Ampersand CLI | ||
f: false, // overwrite | ||
force: false, // overwrite flag, longform. | ||
force: false, // overwrite flag, longform | ||
quotes: 'single' // can be 'single' or 'double' | ||
@@ -101,0 +101,0 @@ }; |
@@ -1,8 +0,12 @@ | ||
/*global console*/ | ||
/* global console */ | ||
var path = require('path'); | ||
var express = require('express'); | ||
var helmet = require('helmet'); | ||
var Moonboots = require('moonboots'); | ||
var bodyParser = require('body-parser'); | ||
var cookieParser = require('cookie-parser'); | ||
var Moonboots = require('moonboots-express'); | ||
var compress = require('compression'); | ||
var config = require('getconfig'); | ||
var semiStatic = require('semi-static'); | ||
var serveStatic = require('serve-static'); | ||
var stylizer = require('stylizer'); | ||
@@ -21,11 +25,15 @@ var templatizer = require('templatizer'); | ||
// ----------------- | ||
app.use(express.compress()); | ||
app.use(express.static(fixPath('public'))); | ||
app.use(compress()); | ||
app.use(serveStatic(fixPath('public'))); | ||
// we only want to expose tests in dev | ||
if (config.isDev) { | ||
app.use(express.static(fixPath('test/assets'))); | ||
app.use(express.static(fixPath('test/spacemonkey'))); | ||
app.use(serveStatic(fixPath('test/assets'))); | ||
app.use(serveStatic(fixPath('test/spacemonkey'))); | ||
} | ||
app.use(express.bodyParser()); | ||
app.use(express.cookieParser()); | ||
app.use(cookieParser()); | ||
app.use(bodyParser.urlencoded({ extended: false })); | ||
app.use(bodyParser.json()); | ||
// in order to test this with spacemonkey we need frames | ||
@@ -35,50 +43,11 @@ if (!config.isDev) { | ||
} | ||
app.use(helmet.iexss()); | ||
app.use(helmet.contentTypeOptions()); | ||
app.use(helmet.xssFilter()); | ||
app.use(helmet.nosniff()); | ||
app.set('view engine', 'jade'); | ||
// --------------------------------------------------- | ||
// Configure Moonboots to serve our client application | ||
// --------------------------------------------------- | ||
var clientApp = new Moonboots({ | ||
jsFileName: '{{{machineName}}}', | ||
cssFileName: '{{{machineName}}}', | ||
main: fixPath('client/app.js'), | ||
developmentMode: config.isDev, | ||
libraries: [ | ||
fixPath('client/libraries/zepto.js') | ||
], | ||
stylesheets: [ | ||
fixPath('public/css/bootstrap.css'), | ||
fixPath('public/css/app.css') | ||
], | ||
browserify: { | ||
debug: false | ||
}, | ||
server: app, | ||
beforeBuildJS: function () { | ||
// This re-builds our template files from jade each time the app's main | ||
// js file is requested. Which means you can seamlessly change jade and | ||
// refresh in your browser to get new templates. | ||
if (config.isDev) { | ||
templatizer(fixPath('templates'), fixPath('client/templates.js')); | ||
} | ||
}, | ||
beforeBuildCSS: function (done) { | ||
// This re-builds css from stylus each time the app's main | ||
// css file is requested. Which means you can seamlessly change stylus files | ||
// and see new styles on refresh. | ||
if (config.isDev) { | ||
stylizer({ | ||
infile: fixPath('public/css/app.styl'), | ||
outfile: fixPath('public/css/app.css'), | ||
development: true | ||
}, done); | ||
} | ||
} | ||
}); | ||
// ----------------- | ||
// Set up our little demo API | ||
// ----------------- | ||
var api = require('./fakeApi'); | ||
@@ -91,3 +60,6 @@ app.get('/api/people', api.list); | ||
// ----------------- | ||
// Enable the functional test site in development | ||
// ----------------- | ||
if (config.isDev) { | ||
@@ -100,13 +72,60 @@ app.get('/test*', semiStatic({ | ||
// use a cookie to send config items to client | ||
var clientSettingsMiddleware = function (req, res, next) { | ||
// ----------------- | ||
// Set our client config cookie | ||
// ----------------- | ||
app.use(function (req, res, next) { | ||
res.cookie('config', JSON.stringify(config.client)); | ||
next(); | ||
}; | ||
}); | ||
// configure our main route that will serve our moonboots app | ||
app.get('*', clientSettingsMiddleware, clientApp.html()); | ||
// --------------------------------------------------- | ||
// Configure Moonboots to serve our client application | ||
// --------------------------------------------------- | ||
new Moonboots({ | ||
moonboots: { | ||
jsFileName: '{{{machineName}}}', | ||
cssFileName: '{{{machineName}}}', | ||
main: fixPath('client/app.js'), | ||
developmentMode: config.isDev, | ||
libraries: [ | ||
fixPath('client/libraries/zepto.js') | ||
], | ||
stylesheets: [ | ||
fixPath('public/css/bootstrap.css'), | ||
fixPath('public/css/app.css') | ||
], | ||
browserify: { | ||
debug: false | ||
}, | ||
beforeBuildJS: function () { | ||
// This re-builds our template files from jade each time the app's main | ||
// js file is requested. Which means you can seamlessly change jade and | ||
// refresh in your browser to get new templates. | ||
if (config.isDev) { | ||
templatizer(fixPath('templates'), fixPath('client/templates.js')); | ||
} | ||
}, | ||
beforeBuildCSS: function (done) { | ||
// This re-builds css from stylus each time the app's main | ||
// css file is requested. Which means you can seamlessly change stylus files | ||
// and see new styles on refresh. | ||
if (config.isDev) { | ||
stylizer({ | ||
infile: fixPath('public/css/app.styl'), | ||
outfile: fixPath('public/css/app.css'), | ||
development: true | ||
}, done); | ||
} else { | ||
done(); | ||
} | ||
} | ||
}, | ||
server: app | ||
}); | ||
// listen for incoming http requests on the port as specified in our config | ||
app.listen(config.http.port); | ||
console.log("{{{title}}} is running at: http://localhost:" + config.http.port + " Yep. That\'s pretty awesome."); |
@@ -34,3 +34,3 @@ /*global app, me, $*/ | ||
// it's inserted and rendered for me | ||
document.title = _.result(newView.pageTitle) || "{{{title}}}"; | ||
document.title = _.result(newView, 'pageTitle') || "{{{title}}}"; | ||
document.scrollTop = 0; | ||
@@ -37,0 +37,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
629212
98
12692
1