Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed scope of d4 var to work with how browserify compiles #45

Merged
merged 4 commits into from
Mar 29, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
@@ -53,6 +53,14 @@ module.exports = function(grunt) {
}
}
},
browserify: {
specs: {
src: ["test/tests/browserify-test.js"],
dest: "test/tests/d4-bundle.js",
options: {
}
}
},
mocha: {
options: {
run: true,
@@ -124,8 +132,9 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-plato');
grunt.loadNpmTasks('grunt-remove-logging');
grunt.loadNpmTasks('grunt-browserify');

grunt.registerTask('test', ['concat', 'mocha']);
grunt.registerTask('test', ['concat', 'browserify', 'mocha']);
grunt.registerTask('quality', ['plato']);
grunt.registerTask('default', ['jsbeautifier', 'jshint', 'test']);
grunt.registerTask('release', ['default', 'concat', 'uglify', 'removelogging']);
9 changes: 6 additions & 3 deletions d4.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! d4 - v0.9.5
/*! d4 - v0.9.6
* License: MIT Expat
* Date: 2016-03-10
* Date: 2016-03-28
* Copyright: Mark Daggett, D4 Team
*/
/*!
@@ -9,14 +9,17 @@
(c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
Underscore may be freely distributed under the MIT license.
*/

var d4;

(function() {
'use strict';

var root = this;
var breaker = {};

// Create a safe reference to the d4 object.
var d4 = function(obj) {
d4 = function(obj) {
if (obj instanceof d4) {
return obj;
}
66 changes: 33 additions & 33 deletions d4.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
"chai": "~1.9.0",
"chai-spies": "~0.5.1",
"grunt": "~0.4.0",
"grunt-browserify": "^5.0.0",
"grunt-cli": "~0.1.11",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-jshint": "~0.1.1",
5 changes: 4 additions & 1 deletion src/base.js
Original file line number Diff line number Diff line change
@@ -4,14 +4,17 @@
(c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
Underscore may be freely distributed under the MIT license.
*/

var d4;

(function() {
'use strict';

var root = this;
var breaker = {};

// Create a safe reference to the d4 object.
var d4 = function(obj) {
d4 = function(obj) {
if (obj instanceof d4) {
return obj;
}
1 change: 1 addition & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
<link href="lib/mocha.css" rel="stylesheet"></link>
<title>d4 test suite</title>
<script src="../bower_components/d3/d3.js"></script>
<script src="tests/d4-bundle.js"></script>
<script src="lib/d4.js"></script>
<script src="tests/axis-tests.js"></script>
<script src="tests/base-test.js"></script>
13 changes: 13 additions & 0 deletions test/tests/browserify-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*global describe:true*/
/*global it:true*/
/*global beforeEach:true*/
/*global document:true*/

'use strict';

describe( 'using browserify', function(){
it('should compile d4 with require', function() {
var d4 = require( '../lib/d4.js' );
expect(d4).to.not.be.an('undefined');
});
});