hoodiehq / hoodie-client

:dog: Client API for the Hoodie server
Apache License 2.0
34 stars 25 forks source link

Package hoodie-client for Bower #142

Open bradley-holt opened 7 years ago

bradley-holt commented 7 years ago

I would like to be able to install hoodie-client via Bower. See the instructions for creating bower packages for reference. In my understanding, this would include:

  1. Creating a bower.json file.
  2. Registering dependencies in bower.json.
  3. Registering the package with Bower.
  4. Repeating these steps for all dependencies that aren't already packaged up for Bower.

Step 4 could be a blocker, as there appears to be third party dependencies that are not already packaged up as Bower components.

gr2m commented 7 years ago

bower is deprecated as far as I know. And it’s problematic because we need to commit built files to the repository. What’s your use case? Install via npm should usually work

bradley-holt commented 7 years ago

I believe Bower is still supported, though I agree that npm is being used more widely these days for frontend dependencies. The use case is that I'm building a workshop based on the Polymer Shop app. This app uses Bower to install dependencies. For now, I'm simply loading the Hoodie client from the Hoodie server. However, it would be nice to be able to treat the frontend app as its own independent app with its own dependencies.

gr2m commented 7 years ago

I think bower can install directly via a URL, you can use this one: https://unpkg.com/@hoodie/client@10.0.2/dist/hoodie.js

It is the built version of @hoodie/client. Does that work?

bradley-holt commented 7 years ago

This does not seem to work:

$ bower install --save https://unpkg.com/@hoodie/client@10.0.2/dist/hoodie.js
bower                     ENORESTARGET URL sources can't resolve targets

Nor any variation such as:

$ bower install --save https://unpkg.com/@hoodie/client
bower                     ENORESTARGET URL sources can't resolve targets

However, installing directly from GitHub seems to work:

$ bower install --save https://github.com/hoodiehq/hoodie-client.git
bower hoodie-client#*       not-cached https://github.com/hoodiehq/hoodie-client.git#*
bower hoodie-client#*          resolve https://github.com/hoodiehq/hoodie-client.git#*
bower hoodie-client#*         download https://github.com/hoodiehq/hoodie-client/archive/v10.0.2.tar.gz
bower hoodie-client#*          extract archive.tar.gz
bower hoodie-client#*         resolved https://github.com/hoodiehq/hoodie-client.git#10.0.2
bower hoodie-client#^10.0.2    install hoodie-client#10.0.2

This should be good enough as a work around. Thanks!

gr2m commented 7 years ago

note that we don’t have the built version of @hoodie/client in the github repository which bower usually needs (and why we moved away from bower in the first place).

Telling from their own docs at https://bower.io/docs/api/#install, bower install https://unpkg.com/@hoodie/client@10.0.2/dist/hoodie.js should just work ¯\_(ツ)_/¯

bradley-holt commented 7 years ago

I saw some talk of a potential bug with Bower that could explain why the install from unpkg didn't work, but I didn't spend a ton of time exploring that. Oh well. This should work for now. Hopefully Polymer moves away from using Bower in their application templates and demos.

bradley-holt commented 7 years ago

For reference: https://github.com/Polymer/polymer/issues/326#issuecomment-303148878