This repository has been archived by the owner on Apr 19, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UMD support (based on misoproject/d3.chart#117)
- Loading branch information
Showing
21 changed files
with
223 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"disallowMixedSpacesAndTabs": true, | ||
"maximumLineLength": 80, | ||
"validateIndentation": "\t", | ||
"validateQuoteMarks": "\"" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"curly": true, | ||
"unused": true, | ||
"undef": true, | ||
"trailing": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,21 @@ | ||
module.exports = function(grunt) { | ||
"use strict"; | ||
|
||
grunt.initConfig({ | ||
"use strict"; | ||
|
||
meta: { | ||
pkg: grunt.file.readJSON("package.json"), | ||
grunt.loadTasks("build/tasks"); | ||
|
||
source: ["src/**/*.js", '!src/wrapper/*'], | ||
grunt.registerTask("build", ["webpack:dist", "webpack:dist-min"]); | ||
|
||
banner: "/*!\n" + | ||
" * <%= meta.pkg.name %> - v<%= meta.pkg.version %>\n" + | ||
" * <%= meta.pkg.homepage %>\n" + | ||
" * \n" + | ||
" * Copyright (c) 2015 <%= meta.pkg.author %>\n" + | ||
" * Library released under <%= meta.pkg.license %> license.\n" + | ||
" */\n" | ||
}, | ||
grunt.registerTask("test-unit", ["mocha:unit"]); | ||
grunt.registerTask( | ||
"test-build", | ||
[ | ||
"webpack:test", "browserify", "mocha:exportsAmd", | ||
"mocha:exportsCommonjs", "mocha:exportsGlobal" | ||
] | ||
); | ||
grunt.registerTask("test", ["jshint", "jscs", "test-unit", "test-build"]); | ||
|
||
watch: { | ||
scripts: { | ||
files: "<%= meta.source %>", | ||
tasks: ["concat"] | ||
} | ||
}, | ||
|
||
jshint: { | ||
options: { | ||
curly: true, | ||
undef: true | ||
}, | ||
chart: { | ||
options: { | ||
browser: true, | ||
globals: { | ||
d3: true | ||
} | ||
}, | ||
files: { | ||
src: "<%= meta.source %>" | ||
} | ||
}, | ||
grunt: { | ||
options: { | ||
node: true | ||
}, | ||
files: { | ||
src: ["Gruntfile.js"] | ||
} | ||
} | ||
}, | ||
|
||
concat: { | ||
options: { | ||
banner: "<%= meta.banner %>" | ||
}, | ||
build: { | ||
files: { | ||
"d3.chart.sankey.js": | ||
[ | ||
"src/wrapper/start.frag", | ||
"src/base.js", | ||
"src/sankey.js", | ||
"src/selection.js", | ||
"src/path.js", | ||
"src/wrapper/end.frag" | ||
] | ||
} | ||
} | ||
}, | ||
|
||
uglify: { | ||
options: { | ||
preserveComments: "false" | ||
}, | ||
release: { | ||
files: { | ||
"d3.chart.sankey.min.js": "d3.chart.sankey.js" | ||
} | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks("grunt-contrib-concat"); | ||
grunt.loadNpmTasks("grunt-contrib-jshint"); | ||
grunt.loadNpmTasks("grunt-contrib-uglify"); | ||
grunt.loadNpmTasks("grunt-contrib-watch"); | ||
|
||
grunt.registerTask("default", ["concat"]); | ||
grunt.registerTask("release", ["jshint", "concat", "uglify"]); | ||
grunt.registerTask("default", ["test"]); | ||
grunt.registerTask("release", ["default", "build"]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"extends": "../.jshintrc", | ||
"node": true, | ||
"scripturl": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = function(grunt) { | ||
"use strict"; | ||
|
||
grunt.config.set("browserify", { | ||
}); | ||
|
||
grunt.loadNpmTasks("grunt-browserify"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = function(grunt) { | ||
"use strict"; | ||
|
||
grunt.config.set("jscs", { | ||
src: { | ||
options: { | ||
config: ".jscsrc" | ||
}, | ||
src: [ | ||
"<%= jshint.src.src %>", | ||
"<%= jshint.build.src %>" | ||
] | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks("grunt-jscs"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module.exports = function(grunt) { | ||
"use strict"; | ||
|
||
grunt.config.set("jshint", { | ||
src: { | ||
options: { | ||
jshintrc: "src/.jshintrc" | ||
}, | ||
src: ["src/*.js"] | ||
}, | ||
build: { | ||
options: { | ||
jshintrc: "build/.jshintrc" | ||
}, | ||
src: ["Gruntfile.js", "build/**/*.js"] | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks("grunt-contrib-jshint"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = function(grunt) { | ||
"use strict"; | ||
|
||
grunt.config.set("watch", { | ||
scripts: { | ||
files: ["src/**/*.js"], | ||
tasks: ["jshint", "build"] | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks("grunt-contrib-watch"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var webpack = require("webpack"); | ||
|
||
module.exports = function(grunt) { | ||
"use strict"; | ||
|
||
grunt.config.set("webpack", { | ||
options: require("../webpack.config.js"), | ||
dist: { | ||
output: { | ||
filename: "d3.chart.sankey.js" | ||
} | ||
}, | ||
"dist-min": { | ||
output: { | ||
filename: "d3.chart.sankey.min.js", | ||
sourceMapFilename: "d3.chart.sankey.min.map", | ||
}, | ||
devtool: "source-map", | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin() | ||
] | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks("grunt-webpack"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"use strict"; | ||
var webpack = require("webpack"); | ||
|
||
var pkg = require("../package.json"); | ||
var now = new Date(); | ||
|
||
function pad(num) { | ||
return (num < 10 ? "0" : "") + num; | ||
} | ||
|
||
var banner = [ | ||
pkg.name + " - v" + pkg.version, | ||
"License: " + pkg.license, | ||
"Date: " + now.getFullYear() + "-" + pad(now.getMonth()) + "-" + | ||
pad(now.getDate()) | ||
].join("\n"); | ||
|
||
module.exports = { | ||
context: "src", | ||
entry: "./index", | ||
output: { | ||
libraryTarget: "umd" | ||
}, | ||
plugins: [ | ||
new webpack.BannerPlugin(banner) | ||
], | ||
externals: { | ||
'd3': true, | ||
'd3-plugins-sankey': true, | ||
'd3.chart': { | ||
'root': ['d3', 'chart'], | ||
'commonjs': 'd3.chart', | ||
'commonjs2': 'd3.chart', | ||
'amd': 'd3.chart' | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,48 @@ | ||
{ | ||
"name": "d3.chart.sankey", | ||
"description": "Reusable D3 Sankey diagram using d3.Chart", | ||
"version": "0.1.0", | ||
|
||
"main": "./d3.chart.sankey.js", | ||
"version": "0.1.1", | ||
"main": "d3.chart.sankey", | ||
"license": "MIT", | ||
|
||
"keywords": [ | ||
"d3.js", | ||
"d3.chart", | ||
"visualization", | ||
"sankey" | ||
], | ||
|
||
"homepage": "https://github.com/q-m/d3.chart.sankey/", | ||
"author": "wvengen <dev-js@willem.engen.nl>", | ||
|
||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/q-m/d3.chart.sankey.git" | ||
}, | ||
|
||
"bugs": { | ||
"url": "https://github.com/q-m/d3.chart.sankey/issues" | ||
}, | ||
|
||
"directories": { | ||
"example": "./example" | ||
}, | ||
|
||
"dependencies": { | ||
"d3": "3", | ||
"d3.chart": "0.2", | ||
"d3.chart": "jugglinmike/d3.chart#amd-3", | ||
"d3-plugins-sankey": "1.2.1" | ||
}, | ||
|
||
"devDependencies": { | ||
"exports-loader": "^0.6.2", | ||
"grunt": "^0.4.5", | ||
"grunt-browserify": "^4.0.1", | ||
"grunt-cli": "^0.1.11", | ||
"grunt-contrib-concat": "^0.5.1", | ||
"grunt-contrib-jshint": "^0.11.1", | ||
"grunt-contrib-uglify": "^0.8.0", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"vows": "^0.8.1" | ||
"grunt-jscs": "^1.8.0", | ||
"grunt-webpack": "^1.0.11", | ||
"imports-loader": "^0.6.5", | ||
"webpack": "^1.12.2", | ||
"webpack-dev-server": "^1.12.0" | ||
}, | ||
|
||
"peerDependencies": { | ||
"grunt": "~0.4.0" | ||
}, | ||
|
||
"scripts": { | ||
"test": "vows --spec" | ||
}, | ||
|
||
"d3.chart": { | ||
"version" : "0.2.1" | ||
"version": "0.2.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../.jshintrc", | ||
"browser": true, | ||
"globalstrict": true, | ||
"globals": { | ||
"require": false, | ||
"define": false | ||
} | ||
} |
Oops, something went wrong.