local dependencies

97 views
Skip to first unread message

David Moshal

unread,
Jan 9, 2014, 9:59:25 PM1/9/14
to compo...@googlegroups.com
apologies if this is a duplicate, but I can't find the answer in the docs.

assuming an app with multiple components.

assume that these components have shared dependencies.
as an example, assume each component depends on bootstrap 3.

Questions:

1. do I have to install bootstrap 3 in every component, ie will every component have a components directory with bootstrap 3? (and if so, what's the best way to update all these).

2. is it possible to create a common local /components directory which can be referenced, and updated once?

3. is it possible to create multiple components in a single directory?

Thanks

David

David Moshal

unread,
Jan 9, 2014, 10:20:06 PM1/9/14
to compo...@googlegroups.com
I guess I'm asking for clarity on the 'local' and 'path' settings of component.json
David

Ian Storm Taylor

unread,
Jan 9, 2014, 10:23:20 PM1/9/14
to compo...@googlegroups.com
Check out the component.io repo for an example of this in action. Basically throw all your components in /lib and then add that to your paths. And then you can component install from the root folder and all of the dependencies will end up  in /components.

Ian
--
You received this message because you are subscribed to the Google Groups "component" group.
To unsubscribe from this group and stop receiving emails from it, send an email to componentjs...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Amjad Masad

unread,
Jan 10, 2014, 6:10:39 PM1/10/14
to compo...@googlegroups.com
1. do I have to install bootstrap 3 in every component, ie will every component have a components directory with bootstrap 3? (and if so, what's the best way to update all these).

In addition to what Ian said, you can either add a package as a dependency for every component using it and just do require('packageName') or can add it in the root component.json but should then qualify the full name when requiring: require('../username-packageName'). The former is preferred.

3. is it possible to create multiple components in a single directory?

yep, as long as each in a sub directory.

Zachary Adam Kaplan

unread,
Jan 10, 2014, 8:54:52 PM1/10/14
to compo...@googlegroups.com
the only weird part for me is:

* why is index.js not referenced as the `main` or in the `scripts` property of it's own component.json? 

Ian Storm Taylor

unread,
Jan 10, 2014, 11:01:38 PM1/10/14
to compo...@googlegroups.com
index.js in that case is a node file instead of a component file. We’ve run into this confusion as well, and have considered calling our stuff browser and server very explicitly to make it more obvious. So you’d end up with a structure like:

/
  browser/
  server/
  browser.js
  component.json
  package.json
  server.js

Instead of a single shared /lib you just end up with two named /browser and /server for paths.  
--

Amjad Masad

unread,
Jan 11, 2014, 12:13:46 AM1/11/14
to compo...@googlegroups.com
We've taken a different approach here https://github.com/max99x/guesshub/
The server is called backend/ and component app is called app/. In our case the server is written in Python
Reply all
Reply to author
Forward
0 new messages