Skip to content

Commit

Permalink
fix underscore deps
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantin committed Jan 4, 2016
1 parent d126e53 commit a85a106
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 40 deletions.
19 changes: 14 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,19 @@ module.exports = function (grunt) {
}
},
less: cssConfig.less,
clean: [
'build/production/',
'build/development/'
],
clean: {
build: {
src: [
'build/production/',
'build/development/'
]
},
npmpublish: {
src: [
'build/'
]
}
},
watch: {
js: {
files: ['<%= jshint.all.src %>'],
Expand Down Expand Up @@ -274,7 +283,7 @@ module.exports = function (grunt) {
grunt.registerTask('build', buildWithoutPublish);
grunt.registerTask('publish', buildWithoutPublish.concat([
'copy:copybuild',
'clean'
'clean:build'
]));
grunt.registerTask('travis', [
'jshint',
Expand Down
6 changes: 3 additions & 3 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var webpack = require('webpack');
var path = require('path');
var cachePath = path.join(require('os').tmpdir(), './webpackCache');

var transformUMDExternal = require('webpack-umd-external');
var ensureDir = function (absolutePath) {
var fs = require('fs-extra');
fs.mkdirsSync(absolutePath);
Expand Down Expand Up @@ -124,10 +124,10 @@ var webpackConf = {
path: 'build/development',
filename: 'tauCharts.js'
},
externals: {
externals: transformUMDExternal({
d3: 'd3',
underscore: '_'
},
}),
module: {
loaders: [babelConfig]
},
Expand Down
13 changes: 3 additions & 10 deletions examples/amd.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,11 @@
baseUrl: location.pathname.replace(/(.+)(examples\/\w+\.html)/, '$1'),
paths: {
'd3': '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3',
'underscore': '//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min',
'canvgModule': 'bower_components/canvg/canvg'
'underscore': '//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min'
},
map: {
'*': {
'tauCharts': 'http://localhost:9000/tauCharts.js',
'print.style.css': 'node_modules/requirejs-text/text!plugins/print.style.css',
'rgbcolor': '../bower_components/canvg/rgbcolor.js',
'stackblur': '../bower_components/canvg/StackBlur.js',
'FileSaver': 'bower_components/FileSaver.js/FileSaver',
'fetch': 'bower_components/fetch/fetch',
'promise': 'bower_components/es6-promise/promise'
'tauCharts': 'http://localhost:9000/tauCharts.js'
}
}
});
Expand All @@ -122,7 +115,7 @@
'src/addons/color-brewer',
'plugins/legend',
'plugins/trendline',
'plugins/export',
'build/development/plugins/tauCharts.export',
'plugins/tooltip',
'underscore'], function (tauCharts, brewer, legend, trendline, exportTo, tooltip) {
/** @class Tooltip
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taucharts",
"version": "0.7.3-alpha.1",
"version": "0.7.3-alpha.7",
"homepage": "https://github.com/TargetProcess/tauCharts",
"description": "D3 based data-focused charting library",
"author": {
Expand All @@ -10,7 +10,7 @@
"d3",
"charts"
],
"main": "build/devlopment/tauCharts.js",
"main": "build/development/tauCharts.js",
"license": "Apache-2.0",
"licenses": [
{
Expand Down Expand Up @@ -81,19 +81,20 @@
"requirejs-text": "^2.0.12",
"tau-tooltip": "1.1.2",
"webpack": "1.12.9",
"webpack-dev-server": "1.14.0"
"webpack-dev-server": "1.14.0",
"webpack-umd-external": "^1.0.2"
},
"scripts": {
"postinstall": "bower install",
"devserver": "grunt webpack-dev-server:start",
"devserver": "bower install && grunt webpack-dev-server:start",
"less2css": "grunt less",
"watch-less": "grunt watch:less",
"build": "grunt build",
"build": "bower install && grunt build",
"webpackbuild": "grunt webpack:build",
"test": "npm run travis && karma start config/karma.conf.js",
"travis": "grunt travis",
"travis": "bower install && grunt travis",
"release": "npm run bower && grunt publish && grunt gh-pages",
"devtest": "grunt karma:dev",
"buildExporTo": "grunt webpack:buildExportTo"
"devtest": "bower install && grunt karma:dev",
"buildExporTo": "grunt webpack:buildExportTo",
"prepublish": "grunt clean:npmpublish && npm run build"
}
}
1 change: 1 addition & 0 deletions src/api/chart-map.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {default as _} from 'underscore';
var ChartMap = (config) => {

var guide = _.extend(
Expand Down
1 change: 1 addition & 0 deletions src/api/chart-parallel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {default as _} from 'underscore';
var ChartParallel = (config) => {

var guide = _.extend(
Expand Down
2 changes: 1 addition & 1 deletion src/api/converter-helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {default as d3} from 'd3';
import {utils} from '../utils/utils';

import {default as _} from 'underscore';
var convertAxis = (data) => (!data) ? null : data;

var normalizeSettings = (axis, defaultValue = null) => {
Expand Down
1 change: 1 addition & 0 deletions src/chart-alias-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {default as d3} from 'd3';
import {utils} from './utils/utils';
import {DataProcessor} from './data-processor';
import {TauChartError as Error, errorCodes} from './error';
import {default as _} from 'underscore';
var chartTypes = {};
var chartRules = {};

Expand Down
2 changes: 1 addition & 1 deletion src/charts/tau.chart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Plot} from './tau.plot';
import {chartTypesRegistry} from '../chart-alias-registry';

import {default as _} from 'underscore';
class Chart extends Plot {

constructor(config) {
Expand Down
2 changes: 1 addition & 1 deletion src/charts/tau.gpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {utilsDom} from '../utils/utils-dom';
import {CSS_PREFIX} from '../const';
import {FramesAlgebra} from '../algebra';
import {DataFrame} from '../data-frame';

import {default as _} from 'underscore';
var cast = (v) => (_.isDate(v) ? v.getTime() : v);

export class GPL extends Emitter {
Expand Down
2 changes: 1 addition & 1 deletion src/charts/tau.plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {SpecTransformApplyRatio} from '../spec-transform-apply-ratio';
import {SpecTransformExtractAxes} from '../spec-transform-extract-axes';

import {GPL} from './tau.gpl';

import {default as _} from 'underscore';
export class Plot extends Emitter {
constructor(config) {
super();
Expand Down
2 changes: 1 addition & 1 deletion src/data-processor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {utils} from './utils/utils';

import {default as _} from 'underscore';
var isObject = (obj) => obj === Object(obj);

var DataProcessor = {
Expand Down
2 changes: 1 addition & 1 deletion src/elements/element.interval.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {CSS_PREFIX} from '../const';
import {Element} from './element';

import {default as _} from 'underscore';
export class Interval extends Element {

constructor(config) {
Expand Down
2 changes: 1 addition & 1 deletion src/elements/element.line.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Element} from './element';
import {elementDecoratorShowText} from './decorators/show-text';
import {elementDecoratorShowAnchors} from './decorators/show-anchors';
import {getLineClassesByWidth, getLineClassesByCount} from '../utils/css-class-map';

import {default as _} from 'underscore';
export class Line extends Element {

constructor(config) {
Expand Down
2 changes: 1 addition & 1 deletion src/elements/element.parallel.line.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {CSS_PREFIX} from '../const';
import {Element} from './element';

import {default as _} from 'underscore';
export class ParallelLine extends Element {

constructor(config) {
Expand Down
1 change: 1 addition & 0 deletions src/elements/element.path.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {CSS_PREFIX} from '../const';
import {default as _} from 'underscore';
import {Element} from './element';
import {elementDecoratorShowText} from './decorators/show-text';
import {elementDecoratorShowAnchors} from './decorators/show-anchors';
Expand Down
2 changes: 1 addition & 1 deletion src/elements/element.point.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {CSS_PREFIX} from '../const';
import {Element} from './element';

import {default as _} from 'underscore';
export class Point extends Element {

constructor(config) {
Expand Down
1 change: 1 addition & 0 deletions src/formatter-registry.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* jshint ignore:start */
import {default as d3} from 'd3';
import {default as _} from 'underscore';
/* jshint ignore:end */
var FORMATS_MAP = {

Expand Down
7 changes: 5 additions & 2 deletions src/tau.charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ import {ChartParallel} from './api/chart-parallel';
import {errorCodes} from './error';
import {PluginsSDK} from './plugins-sdk';

import {default as _} from 'underscore';
import {default as d3} from 'd3';
var colorBrewers = {};
var plugins = {};

var __api__ = {
UnitDomainPeriodGenerator: UnitDomainPeriodGenerator
};

var api = {
errorCodes,
unitsRegistry: unitsRegistry,
Expand Down Expand Up @@ -77,8 +80,8 @@ var api = {
},
get: function (name) {
return plugins[name] || ((x) => {
throw new Error(`${x} plugin is not defined`);
});
throw new Error(`${x} plugin is not defined`);
});
}
},
globalSettings: {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Internal method to return CSS value for given element and property
*/
var tempDiv = document.createElement('div');

import {default as _} from 'underscore';
var utilsDom = {
appendTo: function (el, container) {
var node;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Point} from '../elements/element.point';
import {Line} from '../elements/element.line';
import {Interval} from '../elements/element.interval';
import {StackedInterval} from '../elements/element.interval.stacked';

import {default as _} from 'underscore';
var traverseJSON = (srcObject, byProperty, fnSelectorPredicates, funcTransformRules) => {

var rootRef = funcTransformRules(fnSelectorPredicates(srcObject), srcObject);
Expand Down

0 comments on commit a85a106

Please sign in to comment.