eligrey / Blob.js

An HTML5 Blob implementation
Other
1.15k stars 605 forks source link

File name should be all lowercase #34

Closed giladbeeri closed 10 years ago

giladbeeri commented 10 years ago

Blob.js is against the conventions in the JS community (should be blob.js). The default "grunt wiredep" task that comes with the angular generator for Yeoman injects the line to load the file with lowercase: "". Of course it's a bug in the injection script but it's better to maintain popular conventions.

eligrey commented 10 years ago

File a bug with the angular generator for Yeoman.

Blob.js is against the conventions in the JS community

Tons of libraries use capitalization, just search GitHub. If this was a real, significant convention, you'd think it might be mentioned on the Mozilla Developer Network wiki or Google's Web Fundamentals. Not a single mention.

giladbeeri commented 10 years ago

@eligrey, the problem is that wiredep.js needs to guess the main file of the libraries it scans. Its last heuristic (after all else fails) is to take the "name" property from the bower.json file and guess that the main file is name + ".js". If you only change the "name" inside you bower.json, to "Blob" instead of "blob", or else, change the name of the file to "blob.js" instead of "Blob", or else, set a "main" property in bower.json, it will all be fine. Here's the code - have a look under the comment I inserted - "THIS LINE". from wiredep/detect-dependencies.js:

function findMainFiles(config, component, componentConfigFile) {
  var filePaths = [];
  var file;

  if (_.isString(componentConfigFile.main)) {
    // start by looking for what every component should have: config.main
    filePaths = [componentConfigFile.main];
  } else if (_.isArray(componentConfigFile.main)) {
    filePaths = componentConfigFile.main;
  } else if (_.isArray(componentConfigFile.scripts)) {
    // still haven't found it. is it stored in config.scripts, then?
    filePaths = componentConfigFile.scripts;
  } else {
    file = $.path.join(config.get('bower-directory'), component, componentConfigFile.name + '.js');
    if ($.fs.existsSync(file)) {
// THIS LINE
      filePaths = [componentConfigFile.name + '.js'];
        console.log(componentConfigFile);
    }
  }

  return filePaths.map(function (file) {
    if (config.get('include-self') && component === config.get('bower.json').name) {
      return $.path.join(config.get('cwd'), file);
    } else {
      return $.path.join(config.get('bower-directory'), component, file);
    }
  });
}
eligrey commented 10 years ago

If you only change the "name" inside [your] bower.json

Hmm? It's not my bower entry. The primary Blob.js repo doesn't integrate with any CDNs or package managers. Please maintain your own fork (it would be very low maintenance; you only need to update the version number in the bower.json for every update) if you want to support Bower.

It sounds like a properly-configured bower.json would fix this issue for you.