diff --git a/.jshintrc b/.jshintrc index cda3a5c..f343edf 100644 --- a/.jshintrc +++ b/.jshintrc @@ -20,6 +20,7 @@ "Wreqr": true, "require": true, "module": true, - "define": true + "define": true, + "exports": true } } diff --git a/Gruntfile.js b/Gruntfile.js index 5dbc67b..91f3e97 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,14 +6,14 @@ module.exports = function(grunt) { pkg: grunt.file.readJSON('package.json'), meta: { version: '<%= pkg.version %>', - banner: + banner: '// Backbone.Wreqr (Backbone.Marionette)\n' + - '// ----------------------------------\n' + + '// ----------------------------------\n' + '// v<%= pkg.version %>\n' + - '//\n' + + '//\n' + '// Copyright (c)<%= grunt.template.today("yyyy") %> Derick Bailey, Muted Solutions, LLC.\n' + '// Distributed under MIT license\n' + - '//\n' + + '//\n' + '// http://github.com/marionettejs/backbone.wreqr\n' + '\n\n' }, @@ -27,12 +27,7 @@ module.exports = function(grunt) { files: { 'lib/backbone.wreqr.js' : 'src/wreqr.js' } - }, - core_amd: { - files: { - 'lib/amd/backbone.wreqr.js' : 'src/amd.js' - } - }, + } }, concat: { @@ -49,10 +44,6 @@ module.exports = function(grunt) { options: { banner: "<%= meta.banner %>" }, - amd : { - src : 'lib/amd/backbone.wreqr.js', - dest : 'lib/amd/backbone.wreqr.min.js' - }, core : { src : 'lib/backbone.wreqr.js', dest : 'lib/backbone.wreqr.min.js', diff --git a/component.json b/component.json index 8d5ea82..9722a20 100644 --- a/component.json +++ b/component.json @@ -28,8 +28,8 @@ "jashkenas/backbone": "*", "jashkenas/underscore": "*" }, - "main": "lib/amd/backbone.wreqr.js", + "main": "lib/backbone.wreqr.js", "scripts": [ - "lib/amd/backbone.wreqr.js" + "lib/backbone.wreqr.js" ] } diff --git a/package.json b/package.json index 94b7e00..512a69f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "A Simple Service Bus For Backbone and Backbone.Marionette", "version": "1.2.0", "homepage": "https://github.com/marionettejs/backbone.wreqr", - "main": "lib/amd/backbone.wreqr.js", + "main": "lib/backbone.wreqr.js", "keywords": [ "backbone", "plugin", diff --git a/src/amd.js b/src/amd.js deleted file mode 100644 index e66773e..0000000 --- a/src/amd.js +++ /dev/null @@ -1,21 +0,0 @@ -(function (root, factory) { - if (typeof exports === 'object') { - - var underscore = require('underscore'); - var backbone = require('backbone'); - - module.exports = factory(underscore, backbone); - - } else if (typeof define === 'function' && define.amd) { - - define(['underscore', 'backbone'], factory); - - } -}(this, function (_, Backbone) { - "use strict"; - - // @include wreqr.js - return Backbone.Wreqr; - -})); - diff --git a/src/wreqr.js b/src/wreqr.js index 7605472..b878acc 100644 --- a/src/wreqr.js +++ b/src/wreqr.js @@ -1,6 +1,21 @@ -Backbone.Wreqr = (function(Backbone, Marionette, _){ +(function(root, factory) { + + if (typeof define === 'function' && define.amd) { + define(['exports', 'backbone', 'underscore'], function(exports, Backbone, _) { + factory(exports, Backbone, _); + }); + } else if (typeof exports !== 'undefined') { + var Backbone = require('backbone'); + var _ = require('underscore'); + factory(exports, Backbone, _); + } else { + factory({}, root.Backbone, root._); + } + +}(this, function(Wreqr, Backbone, _) { "use strict"; - var Wreqr = {}; + + Backbone.Wreqr = Wreqr; // @include wreqr.handlers.js // @include wreqr.commandStorage.js @@ -10,5 +25,4 @@ Backbone.Wreqr = (function(Backbone, Marionette, _){ // @include wreqr.channel.js // @include wreqr.radio.js - return Wreqr; -})(Backbone, Backbone.Marionette, _); +}));