Question: I'm Trying to set up my front-end build system with brunch but have an annoying issue that whatever I do brunch ignores *bower\_components* folder and doesn't process anything in it.
this is my brunch-config.coffee file

```
module.exports = config:    
    files:
        javascripts:
            joinTo:             
                'js/app.js': /^app/
                'js/vendor.js': /^bower_components/
            order:
                before: [                    
                    'bower_components/angular/angular.js'
                ]
        stylesheets:
            joinTo:
                'css/app.css'
    paths:
        'public': 'build'       
    modules:
        definition: false
        wrapper: false
    plugins:
        assetsmanager:
            copyTo: '':['app/pages', 
                        'app/background.js', 
                        'app/manifest.json']

```

So js/app.js file always gets sucessfully compiled but vendor.js file is not there. Any Idea?

Answer: 
[tl;dr Jsfiddle](http://jsfiddle.net/Darker/c79fyymd/1/)
--------------------------------------------------------

The data type of `moveTo` and `lineTo` paramteters is [`unrestricted double`](http://www.w3.org/TR/WebIDL/#idl-unrestricted-double). You can see that it's 32bit floating point number, presumably signed. That means that by *specification*, there should be no overflow and the error depends on your browser's implementation.

My tests confirmed this, because neither Firefox, Google Chrome or Opera did render anything at all, indicating undefined suspicious behavior. If the coordinate is invalid, I'd expect an error. If I used smaller coordinates (300), they all provided this result (cropped, framed):

![image description](https://i.stack.imgur.com/SNI4o.png)

I then performed some tests and the last number that can be rendered is:

```
Math.pow(2,31)-Math.pow(2,6)-1 = 2147483583

```

So if you're actually trying to solve a problem and not asking out of curiosity, I propose one of these two solutions:

1. **Make a helper function to cap the coordinates.**

```
  var max = 2147483583;
  var min = -2147483583;
  function safeCoordinate(number) {
    if(number>max)
      return max;
    if(number<min)
      return min;
    return number;
  }

```

Then just call:

```
context.lineTo(safeCoordinate(x), safeCoordinate(y)); 

```
2. **Override actual canvas methods to fix the issue**

If you're feeling tough, you can actually go ahead and override canvas context methods. That's something many people would advise you against though, as changing built in stuff often causes mysterious errors that are hard to track down. With this warning out of the way:

```
(function(max, min, context_proto) {
          // Override move to
          var old_moveTo =context_proto.moveTo;
          context_proto.moveTo = function(x, y) {
              return old_moveTo.call(this, safeCoordinate(x), safeCoordinate(y));   
          }
          var old_lineTo =context_proto.lineTo;
          context_proto.lineTo = function(x, y) {
              return old_lineTo.call(this, safeCoordinate(x), safeCoordinate(y));   
          }
          // Override more methods if needed!
            ...
          // Our helper function
          function safeCoordinate(number) {
            if(number>max)
              return max;
            if(number<min)
              return min;
            return number;
          }  
})(2147483583,-2147483583, CanvasRenderingContext2D.prototype);

```
Let's say we have a `canvas.height = 500` and `canvas.width = 500` and we want to prevent the coords to be within the range `0 to 500`. We can use those properties to set a range when the context is called using a `function()`.

```
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
canvas.width = 500;
canvas.height = 500;
context.strokeStyle = "#000";
letsDraw(100, 200, 800, 300); //Returns Alert Error

function letsDraw(moveToX, moveToY, lineToX, lineToY){
     if((moveToX<canvas.width && moveToX>0) && (moveToY<canvas.height && moveToY>0)){
       context.beginPath();
       context.moveTo(moveToX, moveToY);
       if((lineToX<canvas.width && lineToX>0) && (lineToY<canvas.height && lineToY>0)){
         context.lineTo(lineToX, lineToY);
         context.stroke();
       } else {
         alert("Range outside Canvas");
         return false;
       }
     } else {
       alert("Range outside Canvas");
       return false;
     }
}

```