From f7b87617e104915569e4a42368fa27d520980d11 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Wed, 29 May 2019 22:03:22 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix=20missing=20renderer=20depen?= =?UTF-8?q?dencies.=20#10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 👕 add .jshintrc js/, demos/, tasks 📦 npm ignore dotfiles --- .jshintrc => demos/.jshintrc | 0 js/.jshintrc | 5 +++++ js/anchor.js | 13 ++++++++----- package.json | 6 ++++-- tasks/.jshintrc | 6 ++++++ tasks/bundle.js | 2 -- tasks/version.js | 2 -- 7 files changed, 23 insertions(+), 11 deletions(-) rename .jshintrc => demos/.jshintrc (100%) create mode 100644 js/.jshintrc create mode 100644 tasks/.jshintrc diff --git a/.jshintrc b/demos/.jshintrc similarity index 100% rename from .jshintrc rename to demos/.jshintrc diff --git a/js/.jshintrc b/js/.jshintrc new file mode 100644 index 0000000..fee5bd1 --- /dev/null +++ b/js/.jshintrc @@ -0,0 +1,5 @@ +{ + "browser": true, + "unused": true, + "undef": true +} diff --git a/js/anchor.js b/js/anchor.js index a629d0a..be1c5c1 100644 --- a/js/anchor.js +++ b/js/anchor.js @@ -6,13 +6,15 @@ // module definition if ( typeof module == 'object' && module.exports ) { /* globals module, require */ // CommonJS - module.exports = factory( require('./boilerplate'), require('./vector') ); + module.exports = factory( require('./boilerplate'), require('./vector'), + require('./canvas-renderer'), require('./svg-renderer') ); } else { // browser global var Zdog = root.Zdog; - Zdog.Anchor = factory( Zdog, Zdog.Vector ); + Zdog.Anchor = factory( Zdog, Zdog.Vector, Zdog.CanvasRenderer, + Zdog.SvgRenderer ); } -}( this, function factory( utils, Vector ) { +}( this, function factory( utils, Vector, CanvasRenderer, SvgRenderer ) { var TAU = utils.TAU; var onePoint = { x: 1, y: 1, z: 1 }; @@ -148,6 +150,7 @@ Anchor.prototype.updateSortValue = function() { Anchor.prototype.render = function() {}; +// TODO refactor out CanvasRenderer so its not a dependency within anchor.js Anchor.prototype.renderGraphCanvas = function( ctx ) { if ( !ctx ) { throw new Error( 'ctx is ' + ctx + '. ' + @@ -155,7 +158,7 @@ Anchor.prototype.renderGraphCanvas = function( ctx ) { } this.checkFlatGraph(); this.flatGraph.forEach( function( item ) { - item.render( ctx, Zdog.CanvasRenderer ); + item.render( ctx, CanvasRenderer ); }); }; @@ -166,7 +169,7 @@ Anchor.prototype.renderGraphSvg = function( svg ) { } this.checkFlatGraph(); this.flatGraph.forEach( function( item ) { - item.render( svg, Zdog.SvgRenderer ); + item.render( svg, SvgRenderer ); }); }; diff --git a/package.json b/package.json index fe36a4e..ec026b6 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,10 @@ "description": "Round, flat, designer-friendly pseudo-3D engine", "main": "js/index.js", "files": [ - "dist/", - "js/" + "dist/*.*", + "js/*.*", + "!js/.*", + "!dist/.*" ], "dependencies": {}, "devDependencies": { diff --git a/tasks/.jshintrc b/tasks/.jshintrc new file mode 100644 index 0000000..55b1ce2 --- /dev/null +++ b/tasks/.jshintrc @@ -0,0 +1,6 @@ +{ + "esversion": 6, + "node": true, + "unused": true, + "undef": true +} diff --git a/tasks/bundle.js b/tasks/bundle.js index b2ec29b..1dbfd99 100644 --- a/tasks/bundle.js +++ b/tasks/bundle.js @@ -1,5 +1,3 @@ -/* jshint node: true, esversion: 6, unused: true, undef: true */ - const fs = require('fs'); const execSync = require('child_process').execSync; diff --git a/tasks/version.js b/tasks/version.js index f7f39b1..a25c799 100644 --- a/tasks/version.js +++ b/tasks/version.js @@ -1,5 +1,3 @@ -/* jshint node: true, esversion: 6, unused: true, undef: true */ - const fs = require('fs'); const version = require('../package.json').version;