diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..9f4c781 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,16 @@ +{ + "eqeqeq": true, + "esnext": true, + "immed": true, + "latedef": true, + "newcap": true, + "nonew": true, + "quotmark": "single", + "strict": true, + "trailing": true, + "undef": true, + "unused": "vars", + "globals": { + "angular": false + } +} \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..8ded302 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,61 @@ +/* global module */ + +module.exports = function(grunt){ + + 'use strict'; + + grunt.initConfig({ + + pkg: grunt.file.readJSON('package.json'), + + concat: { + options: { + banner: + '/**************************************************************************\n' + + '* <%= pkg.title || pkg.name %>, ' + + 'v<%= pkg.version %>; ' + + '<%= pkg.license %>; ' + + '<%= grunt.template.today("mm/dd/yyyy HH:MM") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + + '**************************************************************************/\n', + stripBanners: true + }, + + dist: { + src: ['src/*.js'], + dest: 'dist/<%= pkg.name %>.js' + } + }, + + uglify: { + options: { + mangle: false + }, + min: { + files: { + 'dist/<%= pkg.name %>.min.js': ['dist/<%= pkg.name %>.js'] + } + } + }, + + jshint: { + options: { + jshintrc: true + }, + afterconcat: ['dist/<%= pkg.name %>.js'], + files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'] + }, + + watch: { + files: ['<%= jshint.files %>'], + tasks: ['jshint'] + } + }); + + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-watch'); + + grunt.registerTask('default', ['concat', 'jshint', 'uglify']); +}; \ No newline at end of file diff --git a/LICENSE b/LICENSE index 6b4056d..20826af 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ The MIT License (MIT) -Copyright (c) 2013 Konstantin Skipor +Copyright (c) 2014 Konstantin Skipor Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, diff --git a/dist/angular-nvd3.js b/dist/angular-nvd3.js new file mode 100644 index 0000000..69cc62c --- /dev/null +++ b/dist/angular-nvd3.js @@ -0,0 +1,23 @@ +/************************************************************************** +* AngularJS-nvD3, v0.0.1; MIT; 04/30/2014 18:53 +* http://krispo.github.io/angular-nvd3 +**************************************************************************/ +(function(){ + + 'use strict'; + + angular.module('nvd3', []) + + .directive('nvd3', [function(){ + return { + restrict: 'AE', + scope: { + data: '=', + options: '=' + }, + link: function(scope, element, attrs){ + /* Body */ + } + }; + }]); +})(); \ No newline at end of file diff --git a/dist/angular-nvd3.min.js b/dist/angular-nvd3.min.js new file mode 100644 index 0000000..b189744 --- /dev/null +++ b/dist/angular-nvd3.min.js @@ -0,0 +1 @@ +!function(){"use strict";angular.module("nvd3",[]).directive("nvd3",[function(){return{restrict:"AE",scope:{data:"=",options:"="},link:function(){}}}])}(); \ No newline at end of file diff --git a/package.json b/package.json index 70ca621..c1382be 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "title": "AngularJS-nvD3", "name": "angular-nvd3", "version": "0.0.1", "description": "An AngularJS directive for NVD3.js reusable charting library", @@ -26,11 +27,17 @@ "license": "MIT", "author": "Konstantin Skipor", "devDependencies": { + "grunt": "^0.4.4", + "grunt-cli": "^0.1.13", + "grunt-contrib-concat": "^0.4.0", + "grunt-contrib-jshint": "^0.10.0", + "grunt-contrib-uglify": "^0.4.0", + "grunt-contrib-watch": "^0.6.1", "karma": "~0.10", "karma-coverage": "^0.2.1" }, "scripts": { "test": "karma start test/karma.conf.js", - "test-single-run": "karma start test/karma.conf.js --single-run" + "test-single-run": "karma start test/karma.conf.js --single-run" } } diff --git a/src/angular-nvd3.js b/src/angular-nvd3.js index 41d6ff7..5c8606e 100644 --- a/src/angular-nvd3.js +++ b/src/angular-nvd3.js @@ -14,6 +14,6 @@ link: function(scope, element, attrs){ /* Body */ } - } - }]) -})() \ No newline at end of file + }; + }]); +})(); \ No newline at end of file diff --git a/test/angular-nvd3Spec.js b/test/angular-nvd3Spec.js index dfd55ee..20ab121 100644 --- a/test/angular-nvd3Spec.js +++ b/test/angular-nvd3Spec.js @@ -1,8 +1,9 @@ -'use strict'; +/*global jasmine, beforeEach, afterEach, describe, it, inject, expect, module */ describe('angular-nvd3 directive', function() { - var $compile; - var $scope; + 'use strict'; + + var $compile, $scope; // Load the nvd3 module, which contains the directive beforeEach(module('nvd3')); @@ -31,7 +32,7 @@ describe('angular-nvd3 directive', function() { $scope.$digest(); return $element; - }; + } it('should load test', function() { expect(1).toBe(1); @@ -47,7 +48,7 @@ describe('angular-nvd3 directive', function() { values: [{x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 3}], key: 'Line Chart', color: '#ff7f0e' - } + }; it('parent scope options SHOULD MATCH directive scope options', function() { var element = compileTpl(chartOptions, data); @@ -65,5 +66,5 @@ describe('angular-nvd3 directive', function() { key: 'Line Chart' })); }); - }) + }); }); \ No newline at end of file diff --git a/test/karma.conf.js b/test/karma.conf.js index 411e7c4..4fc6dae 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -1,4 +1,8 @@ +/* global module */ + module.exports = function(config) { + 'use strict'; + config.set({ // The root path location that will be used to resolve all relative paths defined in files and exclude.