Giter VIP home page Giter VIP logo

meteor-bower's Introduction

Bower for Meteor

deprecated

This package is deprecated in favor of Meteor 1.3+ NPM support and we recommend that you migrate your existing applications using this bower package to Meteor 1.3 NPM. The new solution will be more robust and supported by MDG in the long run.


This package is broken in Meteor 1.3 but is should still work fine on Meteor 1.2 and below. Bower.io is a popular repository of client-side JavaScript libraries.

##Install to your meteor app first using

meteor add mquandalle:bower

Usage

To use it in your meteor application, create a bower.json file:

{
  "name": "my-app",
  "version": "0.0.1",
  "dependencies": {
    "select2": "3.4.5",
    "backbone": "1.1.0"
  },
  "private": true
}

If you want to use a bower library at script load time (outside of a Meteor.startup block, template handler, event, etc), you have to place the bower.json file so that it loads first (see [Meteor load order](http://stackoverflow.com/questions/10693113/how-do-i-change-the-order-in- which-meteor-loads-javascript-files)). Take the deepest directory you have inside [project root]/lib/, add a bower directory, and put bower.json there. So for example, if you currently have no directories in lib/, then you can do lib/bower/bower.json, but if your current structure is lib/foo/bar/, then you should do lib/foo/bar/bower/bower.json. Then put a .bowerrc file in the same directory with enough ../s to get back to your project root. For instance with a lib/bower/bower.json it would be:

{
  "directory": "../../.meteor/local/bower"
}

The next time you run meteor, the select2 and backbone libraries will be downloaded, and the appropriate HTML tags to include those libraries will automatically be added to your app. So you can just start using select2 widgets, and styles will be set correctly. (If you're curious just look at the HTML source of a rendered page!) We use the main section of the library's bower.json file to determine which files should be loaded.

If the package you're adding doesn't use the main section: you can choose which files you want by adding an override field to your bower.json as described in #54.

Compare this to just using the bower command, where you need to either manually reference the included files or use something like grunt-bower-install to reference them.

Using bower --save

If you want to use the bower install <package> --save command, you can add this .bowerrc file in the project root directory:

{
  "directory": ".meteor/local/bower"
}

Raw files

If you need to reference the raw files (eg Polymer components in html files), you can set a different directory, eg "public/bower_components", and include those files manually in your <head>.

Limit package scope

Make modernizr only available on the client by setting the arch in your bower.json:

"overrides": {
  "modernizr": {
      "arch": [ "client" ]
    }
}

Other values include [ "server" ] and [ "client", "server" ].

Excluding dependencies

You can ask meteor-bower to ignore a list of dependencies. For instance if you have the Meteor package reactjs:react and the bower package react-bootstrap, and you don't want meteor-bower to include a duplicate copy of react, add an ignoredDependencies array to your bower.json:

{
  "name": "my-app",
  "version": "0.0.1",
  "dependencies": {
    "select2": "3.4.5",
    "react-bootstrap": "~0.16.1"
  },
  "ignoredDependencies": [
    "react"
  ]
}

Multiple package directories

You can also have multiple bower.json files, each paired with a .bowerrc, for instance:

bower.json:
{
  "dependencies": {
    "select2": "3.4.5"
  }
  ...
}
.bowerrc
{
  "directory": ".meteor/local/bower"
}

lib/bower.json:
{
  "dependencies": {
    "polymer": "~0.5.1"
  }
  ...
}
lib/.bowerrc:
{
  "directory": "../public/bower_components"
}

Contributing

Contributions are very welcome, whether it is a bug report or a PR with a fix or enhancement.

License

This code is published under the MIT license.

meteor-bower's People

Contributors

andrefgneves avatar ccll avatar chirvo avatar daniel avatar epotvin avatar gbisheimer avatar illusionfield avatar lorensr avatar mplatts avatar mquandalle avatar rwilcox avatar speigg avatar steve8708 avatar tvararu avatar urigo avatar vimes1984 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteor-bower's Issues

bower packages loading too late

I'm attempting to use the bower package react-bootstrap with meteor. It appears that the package script it loaded too late however

<script type="text/javascript" src="/packages/spacebars.js?5d478ab1c940b6f5a88f78b8adc81a47f022da77"></script> <script type="text/javascript" src="/packages/global-imports.js?05ee5a5d2d17cdc330fc4ae68b31365273b5f9da"></script> <script type="text/javascript" src="/template.story.js?a09f4240f5ce5900bdf6c7072fb1c6a496ea670e"></script> <script type="text/javascript" src="/lib/require.jsx.js?c41704fc766bccb906388d136a8f3139abdf83a5"></script> <script type="text/javascript" src="/model/sections.js?bbf637f62d653ebe06f73bfa5accd6d2d706844b"></script> <script type="text/javascript" src="/model/stories.js?2b34bd3f2ef6d0bc60da30fe5578b0750153411f"></script> <script type="text/javascript" src="/package.js?2a3453bba5b8f7e5a39caf4f0fb6016f1b588104"></script> <script type="text/javascript" src="/router.jsx.js?48ac3c9dcb763e4dde2e567647b166f35784f3da"></script> <script type="text/javascript" src="/packages/bower/react-bootstrap-bower/react-bootstrap.min.js?2a40ce3229df07f5cd4b9187ff2fc092a887c689"></script> <script type="text/javascript" src="/packages/bower/react-bootstrap-bower/index.js?ba1380bd93fda06512a34e5426a54ace23f7cfa0"></script>

router.jsx need to reference the latter scripts. I've tried playing around with define / require using https://github.com/apendua/require

Is this unsupported? It would be reasonable for me to think that the bower packages should be loaded just after the /packages from atmospehere etc?

Error when specifying a commit hash as the version

  "bower": {
    "famous": {
      "git": "https://github.com/Famous/famous",
      "version": "98e05eb4326f099e"
    }
  }
While building the application:
/Users/gspeiginer/.meteor/tools/858c88b520/lib/node_modules/fibers/future.js:326:15: Unable to find suitable version for famous (compiling smart.json)
  at Object.Future.wait (/Users/gspeiginer/.meteor/tools/858c88b520/lib/node_modules/fibers/future.js:326:15)
  at Object.install (packages/meteor/helpers.js:111)
  at bowerHandler (packages/bower/plugin/handler.js:58)
  at packages/bower/plugin/handler.js:168

Conflict with meteor's bundled jquery package

@lorensr, I was having some trouble with jquery extensions after last PR that auto-includes files from referenced packages.

I was using select2, that depends on jquery, and both packages are loaded automatically. As jquery is already included in meteor, there was a conflict between the two.

In order to fix it, I disabled the jquery bower package using overrides:

{
  "name": "meteor-app",
  "version": "0.0.0",
  "authors": [
    "John Doe <[email protected]>"
  ],
  "license": "MIT",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "select2": "~3.5.2"
  },
  "overrides": {
    "jquery": {
      "main": []
    }
  }
}

So, has to be careful checking packages and their dependencies to avoid this kind of conflicts.

Packages level support?

First off great package, the implementation is very clean.

I am wondering there are any plans to add smart package level support. For my specific use case I want to use notify.js inside of a smart package and then add that package to atmosphere. Like other dependancies the package will need it but it should not be made available to the app level.

As far as I can tell this does not work yet. Is there a reasonable block on implementing this or is this possible?

config not sufficient for compiled css frameworks

I'm not sure how specific this problem is to what I'm attempting, but it may pertain to other packages as well. I have tried to use Bower with the official Bootstrap-sass. I think in principle I prefer to manage these frameworks with something like Bower, because it seems redundant and wasteful to have separate smart packages for each (Bootstrap has css, less, and scss variants, and there are many forks and themes out there) as well as lacking a way to control the version of the framework.

However, there are some problems.

  1. The main array from the bower.json file doesn't list all the files you need to run the framework. The bootstrap-sass one lists only two files, bootstrap.scss and bootstrap.js, which doesn't include the many partials you need, nor the js for the widgets, nor the fonts (curiously, the bower.json.main for the Less version does include the fonts). I wonder if other packages will likewise fail to list essential components needed for build. For bootstrap-sass, you need pretty much all the files in the fonts, javascripts, and stylesheets directories
  2. You may, in fact, want to exclude files in the main list. In this case, bootstrap.scss will compile the partials to a css file which Meteor will dutifully add to the build, but to use Sass, you would want to avoid that and @import this file from a master file so you can change Sass variables (or skip it and just @import the partials yourself). Also, this file is included in two places. Meteor's automatic behaviors are working against us here.

I don't think Bower gives us the config we need to figure this out, unfortunately. One possible solution would be to allow additional config in the smart.json file. Something like (paths simplified):

"bower": {
  "twbs-bootstrap-sass": {
    "version": "3.1.1", 
    "include": ["stylesheets/*", "javascripts/*", "fonts/*"],
    "exclude": ["bootstrap.js", "bootstrap.scss"]
  }
}

include, if used, would replace the main array, and exclude would override those. I'm not positive this is the right solution, but it would probably work for my use case. Of course, in this case, we are now adding non-Bower config, which is adding complexity. It might still be better than individual smart packages for all the combinations, though.

`handler.js` passes empty `installList` to `Bower.install`, everything explodes

Looks like installList is getting filtered by localCache to just an empty array in regular use, which if passed to Bower.install will then throw an error:

=> Started MongoDB.
[ [], '.meteor/local/bower' ] # this is me doing console.log([installList, bowerDirectory]); just before `Bower.install` in plugin/handler.js
=> Errors prevented startup:

While building the application:
/Users/tvararu/.meteor/tools/5bf1690853/lib/node_modules/fibers/future.js:326:15: No bower.json present (compiling smart.json)
  at Object.Future.wait (/Users/tvararu/.meteor/tools/5bf1690853/lib/node_modules/fibers/future.js:326:15)
  at Object.install (<runJavaScript-23>:184:20)
  at bowerHandler (<runJavaScript-24>:111:33)
  at <runJavaScript-24>:222:10

A Bower package that fails to install

Noticed that the bootstrapaccessibilityplugin Bower package's assets fail to integrate into some of my Meteor projects. It successfully downloads and installs in .meteor/local/bower, but its JS assets don't appear in my template. Oddly enough, it seems to install fine in one project, but I've duplicated this behavior on a blank, test project.

meteor create test
cd test
meteor add mquandalle:bower

Place this bower.json in the directory, then run "meteor":

{
"name": "app",
"version": "0.0.0",
"authors": [
"Nolan Darilek [email protected]"
],
"private": true,
"ignore": [
"*/.",
"node_modules",
"bower_components",
"www/vendor",
"test",
"tests"
],
"dependencies": {
"bootstrap": "~3.3.2",
"bootstrapaccessibilityplugin": "~1.0.4"
}
}

I see the bootstrap.js file, but not the bootstrapaccessibilityplugin.js file referenced in the document source. This is despite the fact that the package appears to download and install correctly. I think I also saw this behavior with momentjs but am not certain.

Thanks.

Meteor start not working with bower if Internet not available.

Bower with jquery package installed.
If no Internet available ( Wifi turned off ) meteor doesn't start.

Failed to execute "git ls-remote --tags --heads git://github.com/jquery/jquery.git", exit code of #128 (compiling smart.json)
at Object.Future.wait (/Users/user_blablabla/.meteor/tools/c2a0453c51/lib/node_modules/fibers/future.js:326:15)
at Object.install (:184:20)
at bowerHandler (:109:33)
at :203:10

Please fix it to work with existing packages, if internet not available.

smart.json support dropped

In your last update you dropped support for smart.json. How then do you configure the packages to be used?

Stale version published to atmosphere?

It looks like the latest source isn't getting fetched for some reason, see below:

Jasons-MacBook-Pro:plugin jasonparekh$ cd /tmp
Jasons-MacBook-Pro:tmp jasonparekh$ meteor create test
test: created.

To run your new app:
cd test
meteor
Jasons-MacBook-Pro:tmp jasonparekh$ cd test
Jasons-MacBook-Pro:test jasonparekh$ rm -rf ~/.meteorite/packages/bower/
Jasons-MacBook-Pro:test jasonparekh$ rm -rf ~/.meteorite/source/mquandalle/meteor-bower/
Jasons-MacBook-Pro:test jasonparekh$ mrt add bower
✓ bower
tag: https://github.com/mquandalle/meteor-bower.git#v0.1.8

Done installing smart packages

Stand back while Meteorite does its thing

Done installing smart packages

Ok, everything's ready. Here comes Meteor!

bower: updating npm dependencies -- bower...
Ok, everything's ready. Here comes Meteor!

bower: Use Bower packages in your Meteor app

Jasons-MacBook-Pro:test jasonparekh$ cat packages/bower/plugin/handler.js | grep main
// Loop over packages, look at each .bower.json attribute main and
if (! .has(infos, "main"))
if (
.isString(infos.main))
infos.main = [infos.main];
if (infos.main)
toInclude = toInclude.concat(infos.main);

I'm looking for the fix at https://github.com/mquandalle/meteor-bower/blob/master/plugin/handler.js#L73 , but my downloaded meteor-bower doesn't have it even though I'm at the right version supposedly:

Jasons-MacBook-Pro:test jasonparekh$ cat packages/bower/smart.json
{
"name": "bower",
"description": "Use Bower packages in your Meteor app",
"homepage": "https://github.com/mquandalle/meteor-bower",
"author": "Maxime Quandalle [email protected]",
"version": "0.1.8",
"git": "https://github.com/mquandalle/meteor-bower.git",
"packages": {}
}

Server-side install?

Is there a way to have bower include packages server side as well? For instance, I use the moment.js package on both client server, with some extended moment.fn functions, and I have to wrap it in a Meteor.isServer in order to not conflict with the fullcalendar dependency.

Add support for multiple install directories

There are a few people who are trying to use the package for polymer, for which it looks like (see first entry here #31) the bower packages need to be in /public and separately requested by the browser instead of bundled with everything else. However, all packages would then go to that directory, eg /public. It seems like the best solution would be to allow some packages to install to .meteor/local/bower and get bundled and some to go in /public – does that seem to you like the best thing to do? If yes, does anyone have a suggestion for the best way for that config info – which packages go where – to be communicated to meteor-bower? Perhaps added to bower.json in some way that wouldn't conflict with bower itself parsing it, or a separate meteor-bower.json with eg:

{
  ".meteor/local/bower": ["select2", "backbone"],
  "public/bower": ["polymer"]
}

Here is @gbisheimer's suggestion from #41:

I couldn't find a way to use polymer components under .meteor/local/bower folder because polymer components need to have access to each other's files, and you need to have them packaged in meteor during build (using compileStep.AddAsset). You can specify which assets are published by adding a main entry in bower.json (look at select2) and those will get published by meteor-bower automatically.

One possible option can be to use the aditionalFiles entry (deprecated when smart.json support was dropped) in main project bower.json referencing the files that should be included as meteor assets. The code is still alive in meteor-bower but not used anymore. Any other ideas?

Polymer

First of all, thanks you for this great package!

I'm having problems making this to work with Polymer components because Polymer's package name contains a slash in it ('Polymer/core-icons' for example), and your package is trying to import the files from the wrong path.

How can this package be used to install polymer and its related projects? Is there a workaround for this?

Thanks!

How does this work?

I using the latest version of meteorite. I copy pasted your smart.json example. I run mrt. The web server startups up but when I look at the loaded sources on the browser it doesn't pull in the bower packages.

Can you write a simple example app with this?

Git endpoint not working

I'm trying to install a bower package using a git endpoint. This is what my bower.json file looks like:

{
  "name": "myApp",
  "dependencies": {
    "skeletor": "git://github.com/rangle/skeletor.git"
  }
}

It seems to work fine with packages published on bower however, fails with this for some reason:

While building the application:
   /Users/winkerVSbecks/.meteor/packages/meteor-tool/.1.0.38.1ghil67++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:326:15:
   Package skeletor not found (compiling bower.json)
   at Object.Future.wait
   (/Users/winkerVSbecks/.meteor/packages/meteor-tool/.1.0.38.1ghil67++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:326:15)
   at Object.install (packages/meteor/helpers.js:116:1)
   at bowerHandler (packages/bower/plugin/handler.js:59:1)
   at Package (packages/bower/plugin/handler.js:181:1)

Adapter not installed correctly

Hi,

I was trying to run a kurento example with this bower.json. The adapter.js package gets downloaded but eventually does not appear in the running meteor application.
I have created a small repository for reference of the setup.

In case the requirement is of the library to have an exact release version, please make use of the releases at this fork.

Thanks,
Abhishek

Meteor 1.0.3.1 - gives up after bootstrap?

My bower.json in the project root:

{
  "name": "xx",
  "version": "0.1.0",
  "dependencies": {
    "modernizr": "2.8.3",
    "bootstrap": "3.3.2",
    "fancybox": "2.1.5"
  },
  "private": true,
  "homepage": "xx",
  "authors": [
    "Lee Benson <[email protected]>"
  ],
  "description": "Whatever",
  "moduleType": [
    "node"
  ],
  "license": "NA",
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    ".meteor/local/bower",
    "test",
    "tests"
  ]
}

Plus .bowerrc:

{
  "directory" : ".meteor/local/bower"
}

Yet a view-source of the page dump only shows (amongst the non-bower stuff):

<script type="text/javascript" src="/packages/mquandalle_bower.js?6f5e05d255022e01686a1080478129b4d5ce7df2"></script>
<script type="text/javascript" src="/packages/bower/bootstrap/dist/js/bootstrap.js?f8752e9ae24daec0a0baffd7819122f8c6fd9103"></script>

Any idea what happened to fancybox and modernizr?

Bower packages loading order

Not sure if this is answered somewhere, but I'm new to MeteorJS. How can I get bower packages to load before the JS in my client directory?

I am trying to use a jQuery plugin (velocity) but it's being loaded as a bower package after I call the plugin in a script in client directory.

I want my bower scripts to load before client directory scripts.

Manually specify package paths?

I'm trying to use a package that isn't listed on bower.io but for which I have a github URL. If I was just using bower in a typical project, I'd run

bower install https://github.com/sourcebits-robertbiggs/bower-chui.git

I noticed that when I put that URL into the bower section of smart.json along with the version I want, it actually installs the package. The package installs as bower/chui (and also installs jquery, which is fine). However, when Meteor is starting up, it tries to load the package with the URL, instead of the name.

Using:

{
  "packages": {
    "bower": {}
  },
  "bower": {
    "https://github.com/sourcebits-robertbiggs/bower-chui.git": "3.5.2"
  }
}

I get the following on Meteor startup:

fs.js:427:18: ENOENT, no such file or directory '.meteor/local/bower/https:/github.com/sourcebits-robertbiggs/bower-chui.git/.bower.json' (compiling smart.json)
  at Object.fs.openSync (fs.js:427:18)
  at Object.fs.readFileSync (fs.js:284:15)
  at packages/bower/plugin/handler.js:61
  at Function._.each._.forEach (packages/underscore/underscore.js:113)
  at bowerHandler (packages/bower/plugin/handler.js:59)
  at packages/bower/plugin/handler.js:142

Would it make sense to add some kind of special syntax for saying "install from this URL, but assume the package name is actually X"? Maybe something like:

"bower": {
  "chui@https://github.com/sourcebits-robertbiggs/bower-chui.git": "3.5.2"
}

or

"bower": {
  "chui": {
    "version": "3.5.2",
    "url": "https://github.com/sourcebits-robertbiggs/bower-chui.git"
  }
}

The first form is simple, but might cause parsing challenges in certain edge-case URLs. The second form seems sensible, if a little verbose.

Broken after update

Hey there,

I just updated react-bootstrap-bower to 0.10.0 (I think) and now I have the following error when running my app.

There is also a bower_components which contains the source in my app's root directory. Is this normal?

=> Started proxy.
=> Started MongoDB.
=> Starting your app...
/Users/mtozer/.meteorite/packages/bower/mquandalle/meteor-bower/5699c3f29a936dcb2aa1221a9febd4669764fc91/.build/plugin.bower.os/npm/bower/plugin/node_modules/bower/node_modules/q/q.js:126
throw e;
^
Error: Package main not found
at createError (/Users/mtozer/.meteorite/packages/bower/mquandalle/meteor-bower/5699c3f29a936dcb2aa1221a9febd4669764fc91/.build/plugin.bower.os/npm/bower/plugin/node_modules/bower/lib/util/createError.js:4:15)
at /Users/mtozer/.meteorite/packages/bower/mquandalle/meteor-bower/5699c3f29a936dcb2aa1221a9febd4669764fc91/.build/plugin.bower.os/npm/bower/plugin/node_modules/bower/lib/core/resolverFactory.js:143:27
at _fulfilled (/Users/mtozer/.meteorite/packages/bower/mquandalle/meteor-bower/5699c3f29a936dcb2aa1221a9febd4669764fc91/.build/plugin.bower.os/npm/bower/plugin/node_modules/bower/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/Users/mtozer/.meteorite/packages/bower/mquandalle/meteor-bower/5699c3f29a936dcb2aa1221a9febd4669764fc91/.build/plugin.bower.os/npm/bower/plugin/node_modules/bower/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/Users/mtozer/.meteorite/packages/bower/mquandalle/meteor-bower/5699c3f29a936dcb2aa1221a9febd4669764fc91/.build/plugin.bower.os/npm/bower/plugin/node_modules/bower/node_modules/q/q.js:749:13)
at /Users/mtozer/.meteorite/packages/bower/mquandalle/meteor-bower/5699c3f29a936dcb2aa1221a9febd4669764fc91/.build/plugin.bower.os/npm/bower/plugin/node_modules/bower/node_modules/q/q.js:557:44
at flush (/Users/mtozer/.meteorite/packages/bower/mquandalle/meteor-bower/5699c3f29a936dcb2aa1221a9febd4669764fc91/.build/plugin.bower.os/npm/bower/plugin/node_modules/bower/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)

Don't download multiple copies of packages

I have a bower package "yamm3" which depends on bootstrap-3. When I run my meteor app, it downloads bs3 into the .meteor/local/bower folder.

Now if I also have a smart package bootstrap-3, will meteor-bower end up loading both copies of the bs3 (consequently increasing client files)?

Minification of web-components

When using this package to install web-components (like polymer), it's useful to use the vulcanize tool to encapsulate all required files and their dependencies in one file, and package that file in the project.

I found this package from Differential that wraps the vulcanize npm package, and outputs only one file including all required dependencies.

What do you think about this?

stylesheets load order

It appears that stylesheets / scripts are loaded at the very end, after my custom stylesheets. That's very problematic when importing frameworks as it overrides any styling of basic elements. I would have expected that whatever is loaded by meteor-bower is included into the document at the beginning, am I missing something?

No main files...

What should I do when the library I depend on does not have main files? As it's actually the case with jquery-galleria

App crashes when Bower source is offline

(Thanks for this package – It's very promising.)

To replicate: Add a Bower package to smart.json (I used "twbs-bootstrap-sass": "3.1.1"). Start meteor to make sure it's working, then stop. Unplug your network cable/turn off wifi. Start your app with meteor. Fails, trace includes the following: Failed to execute "git ls-remote --tags --heads git://github.com/twbs/bootstrap-sass.git", exit code of #128 (compiling smart.json)

Apps fails to build if the bower-specified repo is not available at app start, even if the correct version is already present. Ideally, it shouldn't look at all, but I don't know if this is a Bower limitation.

Add explanation how to selectively add files from a package

I haven't found an explanation about how to include only parts of the included library's files.

In here it is done automatically, but in bower you manually include only what you need and not everything.

Thank you for this great library!

FontAwesome error

When I try to install fontawesome and start a meteor app, I receive:

[[[[[ ~/Development/test ]]]]]

=> Started proxy.
=> Started MongoDB.     
Bower:  fontawesome v4.1.0 successfully installed
=> Errors prevented startup:

While building the application:
fs.js:427:18: ENOENT, no such file or directory '.meteor/local/bower/fontawesome/fonts/*' (compiling smart.json)
  at Object.fs.openSync (fs.js:427:18)
  at Object.fs.readFileSync (fs.js:284:15)
  at packages/bower/plugin/handler.js:87
  at Array.forEach (native)
  at Function._.each._.forEach (packages/underscore/underscore.js:105)
  at packages/bower/plugin/handler.js:84
  at Function._.each._.forEach (packages/underscore/underscore.js:113)
  at bowerHandler (packages/bower/plugin/handler.js:68)
  at packages/bower/plugin/handler.js:157

smart.json:

{
  "packages": {
    "bower": {}
  },
  "bower": {
    "fontawesome": "4.1.0"
  }
}

resolving bower conflicts on install

Hey,
I got a problem trying to bower install a package which has conflicting deps.
for example I tried installing angular-ui-calendar and I got:
While building package angular-ui-calendar:
/home/netanel/.meteor/tools/858c88b520/lib/node_modules/fibers/future.js:326:15: Unable to find suitable version for angular-ui-calendar (compiling smart.json)
at Object.Future.wait (/home/netanel/.meteor/tools/858c88b520/lib/node_modules/fibers/future.js:326:15)
at Object.install (packages/meteor/helpers.js:111)
at bowerHandler (packages/bower/plugin/handler.js:59)
at packages/bower/plugin/handler.js:173

while this happens because when you try to install angular-ui-calendar with bower you get:
Unable to find a suitable version for jquery, please choose one:
1) jquery#~1.10.2 which resolved to 1.10.2 and is required by fullcalendar#1.6.4
2) jquery#~2.x which resolved to 2.1.1 and is required by angular-ui-calendar#0.8.1, angular-ui-calendar#0.8.1
3) jquery#>=1.6 which resolved to 2.1.1 and is required by jquery-ui#1.10.4

I think the best way to handle it would be to add support for the resolutions part of bower.json file that solves this kinds of problems.

Loading static assets e.g. images/fonts

Currently I have to copy static assets such as spritesheets and font-face files to the /public folder in order to get them to serve properly. I'm wondering if this is intentional behavior? How do we get meteor to serve assets from the /.meteor folder?

Bower dep needs to be upgraded

I had this error trying to add any packages that use meteor-bower on my system:

While building package `angular-ui-router`:
/home/ubuntu/.meteor/tools/cef2bcd356/lib/node_modules/fibers/future.js:326:15: Arguments to path.join must be strings (compiling smart.json)
  at Object.Future.wait (/home/ubuntu/.meteor/tools/cef2bcd356/lib/node_modules/fibers/future.js:326:15)
  at Object.install (packages/meteor/helpers.js:111)
  at bowerHandler (packages/bower/plugin/handler.js:39)
  at packages/bower/plugin/handler.js:133

I fixed it just upgrading the bower dep to 1.3.9 (same version of my global bower install) in package.js npmDependencies.

Problem with loading package assets (example: in select2, icons not loaded from the correct path in media queries)

In your README example, I use bower to instead load select2 version 3.4.8

The library seems to load fine except one for issue - one part of the css appears to be referencing the wrong path to load the icons.

This is the particular part of the css in select2 that is loading assets from the wrong path:

@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx)
.select2-search input, .select2-search-choice-close, .select2-container .select2-choice abbr, .select2-container .select2-choice .select2-arrow b {
background-image: url('select2x2.png') !important;
background-repeat: no-repeat !important;
background-size: 60px 40px !important;
}

The other parts of the css appears to be loading from the correct path so I don't know why the above with the media query was not corrected by bower:

correct path:

.select2-container .select2-choice .select2-arrow b {
display: block;
width: 100%;
height: 100%;
background: url('packages/bower/select2/select2.png') no-repeat 0 1px;
}

.bower.json without main

There are packages that doesn't include the main tag in .bower.json, for example polymer-core elements. In this case, meteor-bower doesn't include any file from the package in the bundle.

Before smart.json file was deprecated, we had the additionalFiles option to add any file that wasn't included in the .bower.json file, and we cannot use this option in .bower.json because it's not allowed by the bower parser.

Don't know exactly how to handle this situation yet. I think we can mimic the "additionalFiles" options in smart.json adding a "main" entry in the bowerfile for the meteor project. This way bower.json compatibility will be maintained.

Control load order

I'm trying to load in react and react-router on client and server. Here's a sample repo where the `lib/bower.json' file is

{
  "name": "scratch",
  "version": "0.0.1",
  "dependencies": {
    "react"             :  "0.12.2",
    "react-router"      :  "0.12.4"
  },
  "overrides": {
    "react" : {
      "main" : "react-with-addons.js",
      "arch" : [ "client", "server"]
    },
    "react-router" : {
      "arch" : [ "client", "server"]
    }
  },
  "private": true
}

Unfortunately I'm not getting either package included on the server. In addition, react-router runs before react on the client. Am I doing this wrong, or are those not controllable?

Publishing raw files

The way bower resources are published, they are subject to Meteor's magic unless listed in the main or additionalFiles configuration.

I tried to include Polymer, for instance, which causes dozens of packages to be installed. These all reference each other via HTML imports. However, when the browser resolves e.g. /packages/bower/polymer/polymer.html the returned document is a Meteorified document, not the raw files.

I don't think there's ever a situation where we want this. The /packages/bower virtual path should behave like the /public path. Is that possible?

Specific issue with iNoBounce not loading onto client

I'm trying to include the iNoBounce library with this package. It's a small, straightforward library — barely over 100 lines. It's not published on the public bower repository so I include it with

{
  "name": "scratch",
  "dependencies" : {
    "inobounce": "https://github.com/lazd/iNoBounce.git"
  }
}

The package downloads it into .meteor/local/bower just fine... but then it never gets loaded onto the client. It's nowhere to be found in the build.

Here is a vanilla Meteor application demonstrating this. I've gone through the iNoBounce code thoroughly and don't believe that it contains anything that would prevent it from being loaded. My hunch would be that something with its bower.json file is wrong and causing the behavior but I'm not sure how to debug that more. Any help is appreciated!

transistive deps

It is possible to specify bower deps in a package which an app will include later?

Cached packages are not scanned for broken dependencies

If you have a package A that depends on package B and you reference only package A in bower.json, meteor-bower downloads A and B and starts the application. If you intentionally delete package B, meteor-bower will only check for presence of package A, and starts the application anyway.

Mark as beta (unstable)

Hey it would make sense if you could flag this package as beta (unstable) because of the order issue with meteor. Bower packages can't included as they should.

Auto include files from bower packages

In reference to #61, bower packages that depends on other packages to work should be able to include the required files during application startup. By default, meteor-bower includes all files referenced in the main section of first line packages, but doesn't take nested dependencies into account.

Here is the bower tree of the application referenced at #61:

my-app#0.0.1
└─┬ draggabilly#1.1.2
  ├── classie#1.0.1
  ├── eventEmitter#4.2.11
  ├── eventie#1.0.6
  ├─┬ get-size#1.2.2
  │ └── get-style-property#1.0.4
  └── get-style-property#1.0.4

In order to run correctly, meteor-bower should load deeper dependencies first, and go up the tree loading everything else. In this case, the load order should be get-style-property, get-size, eventie, eventEmitter, classie and draggabilly.

Including these files automatically makes all the code available at once, and that may not be a wanted feature on large applications with many pages. So, this feature should be optional.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.