6 Commits

Author SHA1 Message Date
Han-Wen Nienhuys
939e8df480 Fix bowerutil import in bower2buck.
Bug: Issue 4780
Change-Id: I8b35616030cd8ef4ffdb8fa4edb3649e457ea988
2016-10-19 12:19:45 +09:00
Han-Wen Nienhuys
28e7a6d3fe bazel: bower support
* npm_binary (download tarball packaged npm apps)

* bower_archive (download a zip file, to be put in WORKSPACE)

* bower_component (defining a bower library, with dependency )

* bower_component_bundle (zipping up libraries together)

* js_component (insert plain js file into bower component bundle)

* bower2bazel.py: run bower to find dependencies, generate a .bzl to
  define archives and define components

Tested:

 python tools/js/bower2bazel.py -w lib/js/bower_archives.bzl -b \
    lib/js/bower_components.bzl

 bazel build polygerrit-ui:components
 unzip -v bazel-bin/polygerrit-ui/components.zip > /tmp/baz

 buck build polygerrit-ui:polygerrit_components
 unzip -v buck-out/gen/polygerrit-ui/polygerrit_components/polygerrit_components.bower_components.zip > /tmp/buck

 diff /tmp/buck /tmp/baz

The diff corresponds to newer file versions pinned through bower2bazel.

Change-Id: I4f33914d4853bcf8afe78b4719d0e0e83b139031
2016-09-29 13:18:19 +02:00
Andrew Bonventre
724b4e1a90 Add fetch polyfill for use in all supported browsers
Additionally fix a bug in bower2buck.py where it would
bail when a license is not specified in a Bower package
info response.

[1] http://caniuse.com/#feat=fetch
[2] http://github.github.io/fetch/

Change-Id: Ibf754aab98bab6e34b7a9fb5d6c9801bb612f5d5
2016-03-03 23:49:18 -05:00
Dave Borowitz
dc7cff2b84 Fix lib/js/BUCK to work with bower2buck
web-animations is weird because it can be referred to either as
'web-animations' or 'web-animations/web-animations-js'. Manually
entering it as the former confuses bower2buck when it's referred to
elsewhere as the latter.

Run bower2buck to normalize the current contents.

Band-aid the situation for now, and jot down some of my ideas for
fixing when I find the time.

Change-Id: I64ae3c376df7b83008462c663de4a3998749c365
2015-12-03 13:49:40 -05:00
Dave Borowitz
770d62e87f Improve bower2buck instructions
Instead of requiring a target, default to //polygerrit-ui/...; this
package and subpackages have several bower_components rules, and
using all of them is most likely to produce all the existing rules in
lib/js/BUCK.

Rewrite instructions in lib/js/BUCK so they are more copy-and-
pasteable. Add instructions to the generated new BUCK file on how to
merge with an existing BUCK file.

Normalize the existing package names so there's less delta on each
diff.

Change-Id: I5f46d4d06d6aaacf40c9a7771eec6e85710093e1
2015-12-01 17:57:13 +00:00
Dave Borowitz
5da89cf34c Add bower2buck script to convert bower deps to Buck rules
This script merges dependencies of a bower_components rule into a
synthetic bower.json, then runs bower install to evaluate the version
rules and install packages locally. It walks through the downloaded
.bower.json files to produce new bower_component rules to put back in
lib/js/BUCK.

Change-Id: Iaea0b0a54ca4305ce40accf5924cd12fbf07b0d8
2015-11-25 10:12:29 -05:00