Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ampersand

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand - npm Package Compare versions

Comparing version 2.0.5 to 3.0.0

.jshintrc

12

lib/app/generateApp.js

@@ -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) {

4

lib/app/getPackageFile.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc