ffe301570c
Add support for downloading npm binaries including dependencies and running them in buck genrules. In npm land, transitive dependencies are generally included in the package distribution, and there are a *lot* of them. Since we aren't redistributing these binaries and they're only part of the build process, we don't have to worry too much about licensing, only that they don't have anything totally crazy. We assume packages have a certain format and we can detect the binary to run from the genrule output filename. Actually running the binary is tricky as well, since we have to extract it first. But it might be large, so we don't want to extract it on every invocation; and naive extraction to a common location (in buck-out) is racy. So we need a custom extractor scheme using atomic rename to make this work. Download bower as an npm package and use it to download bower packages. Bower packages can come from a variety of sources, usually git repositories, so we can't simply use download_file. There is additional logic in bower to read bower.json and strip out unneeded files, so I didn't want to get into reimplementing that. The tricky thing about bower is convincing it to avoid transitive dependencies so we can let Buck handle parallelism and caching. To do this, we need to read the package information from the upstream bower repository, and explicitly ignore all listed dependencies when downloading. We combine the flattened list of bower packages in a single bower_components rule. It would be nice to have deps of each bower_component so we didn't need to flatten these, but Buck genrules don't have deps so this is a nonstarter. Considering we only expect to have a single bower_components for the whole project, hopefully this is not too onerous. This change just gets us the bower_components directory. We still have some work to do to use this from Gerrit. Plus even more work to replace the gulpfile and actually package this stuff together into a compiled JS app for the war distribution. Change-Id: Id277d2d812ffcc3bce87ff00b5894bacdffc038e
21 lines
1.1 KiB
JavaScript
21 lines
1.1 KiB
JavaScript
(The MIT License)
|
|
|
|
Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
|
|
|
|
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, including without limitation the rights to
|
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|