bestiejs / json3

A JSON polyfill. No longer maintained.
https://bestiejs.github.io/json3
Other
1.02k stars 150 forks source link

`bower install json3` downloads 6 megabytes of stuff #54

Closed vladikoff closed 10 years ago

vladikoff commented 10 years ago

Using Bower 1.2.8 and running bower install json3.

Looking at the project and the cache: image

Is downloading all that necessary?

ghost commented 10 years ago

The bulk of that download is the Closure Compiler. Since we don't have a command-line binary, we can probably just have the build script download the JAR directly from Google.

vladikoff commented 10 years ago

Thanks for the quick response. Is it possible to just get:

json3.js
json3.min.js

And maybe LICENSE, README via Bower? Is there a reason to download the rest of the files? In fact I'm not sure where they are stored, they are not even in the bower cache.

ghost commented 10 years ago

It looks like Bower is requesting the repo tarball from GitHub (https://github.com/bestiejs/json3/archive/v3.3.0.tar.gz), which includes a copy of the Closure Compiler—it's checked in at vendor/closure-compiler.jar. The vendor directory is ignored in bower.json, so I suspect that's why it's not showing up in the cache. But, unless Bower requested the manifest (e.g., https://raw.github.com/bestiejs/json3/v3.3.0/bower.json) before downloading the repo, it wouldn't know which paths it needs to ignore. Unfortunately, I'm not familiar with Bower's internals, so this is just a theory based on the console output in your screenshot and a cursory glance at the source.

The Closure Compiler is only used to build JSON 3, so it can probably be downloaded whenever the build script is executed. Also, if the build script stored the ETag of the Closure Compiler tarball locally, it could automatically fetch new versions as they become available.

TL;DR: I think on-demand downloading will solve the package size problem.

ghost commented 10 years ago

Okay, I think that should do it…

$ curl -sL https://github.com/bestiejs/json3/archive/dev.tar.gz | wc -c
373581

This fix will go out with the next release. Thanks for reporting the issue!