diff --git a/gulpfile.js b/gulpfile.js index a45102e4..8de5d288 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -90,13 +90,15 @@ gulp.task("clean", function (done) { del([ config.dirs.tmp + "/**", config.dirs.build + "/**" - ], done); + ]).then(function(paths) { + done(); + }); }); gulp.task("clean-dist", function (done) { - del([ - config.dirs.dist + "/**" - ], done); + del([ config.dirs.dist + "/**" ]).then(function(paths) { + done() + }); }); gulp.task("copy-htdocs", function () { diff --git a/package.json b/package.json index d64a78cc..bddb7ad2 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,10 @@ "description": "Easily create beautiful charts", "main": "src/js/index.js", "scripts": { - "test-jsx-browser": "browserify -t rewireify test/jsx/index-jsx.js | testling -u", - "test-js-browser": "browserify test/index.js | testling -u", - "test-jsx": "browserify -t rewireify test/jsx/index-jsx.js | testling | faucet", - "test-js": "browserify test/index.js | testling | faucet", + "test-jsx": "browserify -t rewireify test/jsx/index-jsx.js | tap-closer | smokestack | tap-spec", + "test-js": "browserify test/index.js | tap-closer | smokestack | tap-spec", "test": "npm run test-js && npm run test-jsx", - "docs": "documentation --github --format html -o api-docs", + "docs": "documentation -t documentation-theme-default --github --format html -o api-docs", "test-page": "gulp test", "dev": "gulp", "build": "gulp build", @@ -53,43 +51,40 @@ "classnames": "^2.2.1", "d3": "^3.5.5", "d4": "git://github.com/yanofsky/d4.git", - "flux": "~2.0.1", - "lodash": "^3.9.3", + "flux": "~2.1.1", + "lodash": "^4.0.0", "markdown": "^0.5.0", "react": "^0.14.5", "react-addons-shallow-compare": "^0.14.5", "react-addons-update": "^0.14.5", "react-addons-pure-render-mixin": "^0.14.5", "react-dom": "^0.14.5", - "react-component-visibility": "0.0.5", "save-svg-as-png": "^1.0.2", "sugar-date": "^1.5.1" }, "devDependencies": { - "browser-sync": "1.x.x", - "browserify": "^3.44.2", + "browser-sync": "2.x.x", + "browserify": "^13.0.0", "browserify-shim": "^3.8.0", - "del": "^0.1.2", - "documentation": "^1.4.0", + "del": "2.2.0", + "documentation": "^3.0.4", "envify": "^3.2.0", "faker": "^2.1.2", - "faucet": "0.0.1", - "glob": "^4.3.5", "gulp": "^3.6.2", - "gulp-changed": "^0.4.0", + "gulp-changed": "^1.3.0", "gulp-css-base64": "^1.3.1", - "gulp-notify": "^1.2.5", "gulp-stylus": "^2.0.1", "gulp-uglify": "^1.1.0", - "minimatch": "^2.0.1", "nib": "^1.0.2", "nomnom": "^1.8.0", "react-addons-test-utils": "^0.14.5", - "reactify": "^0.15.0", + "reactify": "^1.1.1", "rewireify": "^0.2.5", + "smokestack": "^3.4.1", + "tap-closer": "^1.0.0", + "tap-spec": "^4.1.1", "tape": "^4.0.0", - "testling": "^1.7.1", "vinyl-buffer": "^1.0.0", - "vinyl-source-stream": "^0.1.1" + "vinyl-source-stream": "^1.1.0" } } diff --git a/src/js/charts/cb-chart-grid/parse-chart-grid.js b/src/js/charts/cb-chart-grid/parse-chart-grid.js index 8d357c4c..93b77652 100644 --- a/src/js/charts/cb-chart-grid/parse-chart-grid.js +++ b/src/js/charts/cb-chart-grid/parse-chart-grid.js @@ -1,6 +1,6 @@ -var clone = require("lodash/lang/clone"); -var map = require("lodash/collection/map"); -var assign = require("lodash/object/assign"); +var clone = require("lodash/clone"); +var map = require("lodash/map"); +var assign = require("lodash/assign"); var dataBySeries = require("../../util/parse-data-by-series"); var help = require("../../util/helper"); diff --git a/src/js/charts/cb-xy/draw-xy.js b/src/js/charts/cb-xy/draw-xy.js index a8b5e314..786c05d0 100644 --- a/src/js/charts/cb-xy/draw-xy.js +++ b/src/js/charts/cb-xy/draw-xy.js @@ -2,8 +2,8 @@ if (process.env.NODE_ENV !== "test") { var d4 = require("d4"); } -var filter = require("lodash/collection/filter"); -var each = require("lodash/collection/each"); +var filter = require("lodash/filter"); +var each = require("lodash/each"); var chartStyle = require("../../config/chart-style"); var cb_mixins = require("../cb-d4-mixins.js"); diff --git a/src/js/charts/cb-xy/parse-xy.js b/src/js/charts/cb-xy/parse-xy.js index 7019f01b..741cb7b8 100644 --- a/src/js/charts/cb-xy/parse-xy.js +++ b/src/js/charts/cb-xy/parse-xy.js @@ -1,8 +1,8 @@ -var clone = require("lodash/lang/clone"); -var map = require("lodash/collection/map"); -var assign = require("lodash/object/assign"); -var each = require("lodash/collection/each"); -var filter = require("lodash/collection/filter"); +var clone = require("lodash/clone"); +var map = require("lodash/map"); +var assign = require("lodash/assign"); +var each = require("lodash/each"); +var filter = require("lodash/filter"); var dataBySeries = require("../../util/parse-data-by-series"); var help = require("../../util/helper"); diff --git a/src/js/components/ChartMetadata.jsx b/src/js/components/ChartMetadata.jsx index 95860eee..55ff7052 100644 --- a/src/js/components/ChartMetadata.jsx +++ b/src/js/components/ChartMetadata.jsx @@ -4,7 +4,7 @@ var React = require("react"); var PropTypes = React.PropTypes; var PureRenderMixin = require("react-addons-pure-render-mixin"); -var clone = require("lodash/lang/clone"); +var clone = require("lodash/clone"); // Flux stores var ChartMetadataStore = require("../stores/ChartMetadataStore"); diff --git a/src/js/components/ChartTypeSelector.jsx b/src/js/components/ChartTypeSelector.jsx index 444cb3ab..2dadefdb 100644 --- a/src/js/components/ChartTypeSelector.jsx +++ b/src/js/components/ChartTypeSelector.jsx @@ -3,9 +3,9 @@ // and apply setting that carry over to the new type var React = require("react"); -var clone = require("lodash/lang/clone"); -var map = require("lodash/collection/map"); -var keys = require("lodash/object/keys"); +var clone = require("lodash/clone"); +var map = require("lodash/map"); +var keys = require("lodash/keys"); var helper = require("../util/helper"); // Flux actions diff --git a/src/js/components/RendererWrapper.jsx b/src/js/components/RendererWrapper.jsx index 0c4a5bc7..0a92b5e9 100644 --- a/src/js/components/RendererWrapper.jsx +++ b/src/js/components/RendererWrapper.jsx @@ -9,13 +9,13 @@ var React = require("react"); var ReactDOM = require("react-dom") var PropTypes = React.PropTypes; -var assign = require("lodash/object/assign"); -var clone = require("lodash/lang/clone"); -var isDate = require("lodash/lang/isDate"); -var isEqual = require("lodash/lang/isEqual"); -var throttle = require("lodash/function/throttle"); -var reduce = require("lodash/collection/reduce"); -var keys = require("lodash/object/keys"); +var assign = require("lodash/assign"); +var clone = require("lodash/clone"); +var isDate = require("lodash/isDate"); +var isEqual = require("lodash/isEqual"); +var throttle = require("lodash/throttle"); +var reduce = require("lodash/reduce"); +var keys = require("lodash/keys"); var update = require("react-addons-update"); var SvgText = require("./svg/SvgText.jsx"); diff --git a/src/js/components/chart-grid/ChartGridBars.jsx b/src/js/components/chart-grid/ChartGridBars.jsx index 4f6a4342..9e27f378 100644 --- a/src/js/components/chart-grid/ChartGridBars.jsx +++ b/src/js/components/chart-grid/ChartGridBars.jsx @@ -8,9 +8,10 @@ var PropTypes = React.PropTypes; var update = require("react-addons-update"); var d4 = require("d4"); -var clone = require("lodash/lang/clone"); -var map = require("lodash/collection/map"); -var reduce = require("lodash/collection/reduce"); +var bind = require("lodash/bind"); +var clone = require("lodash/clone"); +var map = require("lodash/map"); +var reduce = require("lodash/reduce"); var SessionStore = require("../../stores/SessionStore"); var separators = SessionStore.get("separators"); @@ -172,7 +173,7 @@ var ChartGridBars = React.createClass({ /> ); - var gridCharts = map(chartProps.data.slice(0, numCharts), function(d, i) { + var gridCharts = map(chartProps.data.slice(0, numCharts), bind(function(d, i) { // Get the props we need for each chart var gridChartProps = { chartSettings: chartProps.chartSettings[i], @@ -194,7 +195,7 @@ var ChartGridBars = React.createClass({ dimensions={dimensionsPerGrid} padding={displayConfig.padding} /> - }, this); + }, this)); /* * Pass the following JSX components to the `Svg` component, which will diff --git a/src/js/components/chart-grid/ChartGridEditor.jsx b/src/js/components/chart-grid/ChartGridEditor.jsx index 33ea1813..ada6d7bc 100644 --- a/src/js/components/chart-grid/ChartGridEditor.jsx +++ b/src/js/components/chart-grid/ChartGridEditor.jsx @@ -7,10 +7,11 @@ var PropTypes = React.PropTypes; var update = require("react-addons-update"); var cx = require("classnames"); -var clone = require("lodash/lang/clone"); -var map = require("lodash/collection/map"); -var each = require("lodash/collection/each"); -var range = require("lodash/utility/range"); +var bind = require("lodash/bind"); +var clone = require("lodash/clone"); +var each = require("lodash/each"); +var map = require("lodash/map"); +var range = require("lodash/range"); /* Shared Chartbuilder components */ var DataInput = require("../shared/DataInput.jsx"); @@ -74,7 +75,7 @@ var ChartGridEditor = React.createClass({ var chartSettings; /* Create a settings component for each data series (column) */ - chartSettings = map(chartProps.chartSettings, function(seriesSetting, i) { + chartSettings = map(chartProps.chartSettings, bind(function(seriesSetting, i) { return ( ); - }, this); + }, this)); /* * Settings to control the numerical scale. It will be different for bar diff --git a/src/js/components/chart-grid/ChartGridMobile.jsx b/src/js/components/chart-grid/ChartGridMobile.jsx index 3054dee4..fb83f684 100644 --- a/src/js/components/chart-grid/ChartGridMobile.jsx +++ b/src/js/components/chart-grid/ChartGridMobile.jsx @@ -1,6 +1,6 @@ var React = require("react"); var PropTypes = React.PropTypes; -var clone = require("lodash/lang/clone"); +var clone = require("lodash/clone"); var update = require("react-addons-update"); var ChartEditorMixin = require("../mixins/ChartEditorMixin"); diff --git a/src/js/components/chart-grid/ChartGridRenderer.jsx b/src/js/components/chart-grid/ChartGridRenderer.jsx index 426a6f1a..91f16467 100644 --- a/src/js/components/chart-grid/ChartGridRenderer.jsx +++ b/src/js/components/chart-grid/ChartGridRenderer.jsx @@ -9,9 +9,9 @@ var React = require("react"); var PropTypes = React.PropTypes; var update = require("react-addons-update"); var chartSizes = require("../../config/chart-sizes"); -var clone = require("lodash/lang/clone"); -var assign = require("lodash/object/assign"); -var each = require("lodash/collection/each"); +var clone = require("lodash/clone"); +var assign = require("lodash/assign"); +var each = require("lodash/each"); /* Chart grid types */ var ChartGridBars = require("./ChartGridBars.jsx"); diff --git a/src/js/components/chart-grid/ChartGridXY.jsx b/src/js/components/chart-grid/ChartGridXY.jsx index 66bd47e6..d3e52588 100644 --- a/src/js/components/chart-grid/ChartGridXY.jsx +++ b/src/js/components/chart-grid/ChartGridXY.jsx @@ -7,9 +7,11 @@ var React = require("react"); var PropTypes = React.PropTypes; var update = require("react-addons-update"); var d4 = require("d4"); -var clone = require("lodash/lang/clone"); -var map = require("lodash/collection/map"); -var filter = require("lodash/collection/filter"); + +var bind = require("lodash/bind"); +var clone = require("lodash/clone"); +var filter = require("lodash/filter"); +var map = require("lodash/map"); /* Helper functions */ var cb_xy = require("../../charts/cb-charts").cb_xy; @@ -160,7 +162,7 @@ var ChartGridXY = React.createClass({ /* Get the number of charts and only render that many */ var numCharts = chartProps._grid.rows * chartProps._grid.cols; - var gridCharts = map(chartProps.data.slice(0, numCharts), function(d, i) { + var gridCharts = map(chartProps.data.slice(0, numCharts), bind(function(d, i) { // Get the props we need for each chart var gridChartProps = { chartSettings: chartProps.chartSettings[i], @@ -182,7 +184,7 @@ var ChartGridXY = React.createClass({ dimensions={dimensionsPerGrid} padding={displayConfig.padding} /> - }, this); + }, this)); return ( diff --git a/src/js/components/chart-grid/ChartGrid_xScaleSettings.jsx b/src/js/components/chart-grid/ChartGrid_xScaleSettings.jsx index 0ce85928..0712721f 100644 --- a/src/js/components/chart-grid/ChartGrid_xScaleSettings.jsx +++ b/src/js/components/chart-grid/ChartGrid_xScaleSettings.jsx @@ -2,7 +2,7 @@ var React = require("react"); var PropTypes = React.PropTypes; var update = require("react-addons-update"); -var clone = require("lodash/lang/clone"); +var clone = require("lodash/clone"); var chartbuilderUI = require("chartbuilder-ui"); var LabelledTangle = chartbuilderUI.LabelledTangle; diff --git a/src/js/components/chart-xy/XYEditor.jsx b/src/js/components/chart-xy/XYEditor.jsx index fcc3de44..7a841fc0 100644 --- a/src/js/components/chart-xy/XYEditor.jsx +++ b/src/js/components/chart-xy/XYEditor.jsx @@ -7,10 +7,12 @@ var PropTypes = React.PropTypes; var PureRenderMixin = require("react-addons-pure-render-mixin"); var update = require("react-addons-update"); var cx = require("classnames"); -var clone = require("lodash/lang/clone"); -var map = require("lodash/collection/map"); -var keys = require("lodash/object/keys"); -var each = require("lodash/collection/each"); + +var bind = require("lodash/bind"); +var clone = require("lodash/clone"); +var each = require("lodash/each"); +var keys = require("lodash/keys"); +var map = require("lodash/map"); var dateParsers = require("../../util/process-dates").dateParsers; @@ -87,7 +89,7 @@ var XYEditor = React.createClass({ var allowSecondaryAxis = (chartProps._numSecondaryAxis < (chartProps.data.length - 1)); /* Create a settings component for each data series (column) */ - var chartSettings = map(chartProps.chartSettings, function(chartSetting, i) { + var chartSettings = map(chartProps.chartSettings, bind(function(chartSetting, i) { return - }, this); + }, this)); /* Y scale settings */ scaleSettings.push( diff --git a/src/js/components/chart-xy/XYMobile.jsx b/src/js/components/chart-xy/XYMobile.jsx index ecc58314..16ae5570 100644 --- a/src/js/components/chart-xy/XYMobile.jsx +++ b/src/js/components/chart-xy/XYMobile.jsx @@ -1,7 +1,7 @@ var React = require("react"); var PropTypes = React.PropTypes; var update = require("react-addons-update"); -var clone = require("lodash/lang/clone"); +var clone = require("lodash/clone"); var ChartEditorMixin = require("../mixins/ChartEditorMixin"); var XY_yScaleSettings = require("../shared/XY_yScaleSettings.jsx"); diff --git a/src/js/components/chart-xy/XYRenderer.jsx b/src/js/components/chart-xy/XYRenderer.jsx index 025c051b..2319b082 100644 --- a/src/js/components/chart-xy/XYRenderer.jsx +++ b/src/js/components/chart-xy/XYRenderer.jsx @@ -12,13 +12,14 @@ var update = require("react-addons-update"); var d3 = require("d3"); var d4 = require("d4"); -var clone = require("lodash/lang/clone"); -var map = require("lodash/collection/map"); -var assign = require("lodash/object/assign"); -var each = require("lodash/collection/each"); -var filter = require("lodash/collection/filter"); -var reduce = require("lodash/collection/reduce"); -var some = require("lodash/collection/some"); +var assign = require("lodash/assign"); +var bind = require("lodash/bind"); +var clone = require("lodash/clone"); +var each = require("lodash/each"); +var filter = require("lodash/filter"); +var map = require("lodash/map"); +var reduce = require("lodash/reduce"); +var some = require("lodash/some"); var ChartRendererMixin = require("../mixins/ChartRendererMixin.js"); var DateScaleMixin = require("../mixins/DateScaleMixin.js"); @@ -164,7 +165,7 @@ var XYRenderer = React.createClass({ // Render hidden y-axis ticks in order to compute the maxTickWidth // independent of rendering the chart itself, this is needed to set the // appropriate padding for the chart. We must do this for each y-axis. - var HiddenAxes = map(axisTicks, function(axis, i) { + var HiddenAxes = map(axisTicks, bind(function(axis, i) { return ( ); - }, this); + }, this)); if (this.state.maxTickWidth.primaryScale <= 0) { // We have not yet calculated maxTickWidth @@ -423,7 +424,7 @@ var XYLabels = React.createClass({ * reloaded later. */ /* Make sure only undragged labels exist in XYLabels state, removing others */ - var updateUndragged = reduce(nextProps.chartProps._annotations.labels.values, function(obj, v, i) { + var updateUndragged = reduce(nextProps.chartProps._annotations.labels.values, bind(function(obj, v, i) { if (!v.dragged) { if (this.state.undraggedLabels[i]) { obj[i] = this.state.undraggedLabels[i]; @@ -434,7 +435,8 @@ var XYLabels = React.createClass({ } else { return obj; } - }, {}, this); + }, this), {}); + this.setState({ yOffset: yOffset, undraggedLabels: updateUndragged, @@ -538,7 +540,7 @@ var XYLabels = React.createClass({ var labelComponents = []; if (this.props.chartProps.data.length > 1) { - each(this.props.chartProps.data, function(d, i) { + each(this.props.chartProps.data, bind(function(d, i) { var labelSettings = {}; var prevNode = null; var chartSetting = this.props.chartProps.chartSettings[i]; @@ -588,7 +590,7 @@ var XYLabels = React.createClass({ scale={scale} /> ); - }, this); + }, this)); } return (