meteor-bower
meteor-bower copied to clipboard
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?
Hello,
I've not tested it myself but there are already packages on atmosphere that depends on meteor-bower. For instance https://github.com/ccll/meteor-angular-ui-router/blob/master/smart.json
I think the current package API provided by meteor doesn't allow to restrict bower exports to the package scope, so the side effect is that exports are visible from the main app. There is some work in the upcoming constraint-solver core package that may help for that purpose in the future.
The other solution that currently works is to rely on git submodules and manually add the desired files in package.js.
I think it would be possible to improve imports/exports management in the same way that the linker rewrite did it for meteor core packages. The idea is that each package is scoped inside a closure, if you want to access another package, you have to require it:
var backbone = Bower.require("backbone");
It will work only on the client side. The problem is that most of the code related to this is in the tools/ not packages/ so I need to see how feasible it is.
So I have not tested it yet but I wanted to update this with my thoughts. I think the issue I am having is that I have not published my package on Atmosphere yet. Since meteor does not actually use smart.json the dependance is not being called.
It will be a little while until I am ready to put my work on Atmo. For a quick fix I found that if I called the dependency from my app then my smart package could use it. This is working fine for now but I think your idea to use linker style may be more intuitive for meteor users. That said you may want to wait until the meteor/atmosphere merge? Its possible that this issue will be easy to resolved then. (assuming I am right about why things are not working)
I don't understand what you think the problem is. Does it work with a bower.json file instead of using smart.json?
So within my app smart.json I am able to use bower just fine. But if I have a package with a smart.json and I reference bower nothing happens. I just tested a bower.json file, within the package, and had the same results.
In my smart package smart.json:
"packages": {
"bower": "0.1.2"
},
"bower": {
"notify.js": "1.1.0"
}
Is your package located in the packages/ directory, or anywhere else?
Standard layout with all the packages in packages/
Meteor Release 0.7.1.2
Meteorite version 0.6.15
You have to include it in your package.js:
// Install bower components.
api.add_files('smart.json', 'client');
Any updates on this? Meteor is 1.1 now :-)
Just FYI for anyone who isn't clear (it wasn't to me, I just spent some time beating my head on this): mquandalle:bower does not currently support loading bower components specified by local packages (e.g. a package in your project's packages/ directory). So anyone needing bower components to be loaded for subpackages will currently need to duplicate those dependencies in a project-level bower.json, even with meteor 1.2.