using private components in compy

Published:

There are core limitations in component that makes hard to use private git repositories directly, unless you use github. Component FAQ proposes to use remotes property and any web server that uses the same urls as Github.

package.json

1
2
3
4
5
6
7
{
...
"compy":{
...
"remotes":["https://user:pass@raw.github.com"]
}
}

But there is a better way to manage private components with any git server you like.

using git submodules to manage private components

Component supports local dependencies. That means it can serve components from any local folder you put in as local param in config.

package.json

1
2
3
4
5
6
7
8
{
...
"compy":{
...
"paths":["local"],
"local":["component1","component2"]
}
}

So if you want to use local dependencies, you should put git submodules with those private components in the folder.

Compy will serve them as usual components and you will manage them with git-cli.

adding component to folder

You can add component to local folder like this:

1
2
cd local;
submodule add git://github.com/chneukirchen/rack.git