3 minutes
Collider.JAM Development Setup
You can use Collider.JAM by simply installing collider.jam
npm package globally with npm install -g collider.jam
.
This command installs the latest stable Collider.JAM release and gives you
the jam
tool to initialize and launch Collider.JAM mixes.
This is the simplest way to use Collider.JAM and it often covers
all your development needs.
But in my case, I need something more intricate. Since I’m not only using Collider.JAM, but also developing it, I need an installation working right from git repositories deployed locally instead of using pre-packaged remote snapshots. That way I can introduce changes and test them right away.
One also could benefit from that type of installation in complex project requiring some framework customizations. Just fork a package you want to customize and link it with other parts of the framework.
Here are the necessary steps to do that.
1. Create Framework Folder
Select an appropriate location and create a folder for Collider.JAM packages. I find it convenient to keep all framework components in a separate folder:
mkdir jam
2. Clone Collider.JAM Repos
Collider.JAM consists of 4 major packages you need to install: collider.jam, collider.mix, collider-dev.mix, collider-boot.mix.
cd jam
git clone git@github.com:invider/collider.jam.git
git clone git@github.com:invider/collider.mix.git
git clone git@github.com:invider/collider-dev.mix.git
git clone git@github.com:invider/collider-boot.mix.git
3. Link Packages Globally
We definitely can install collider.jam package from local
git repository globally by running npm install -g
from
the collider.jam
folder. But when you introduce any changes
to collider.jam
it must be reinstalled for changes
to take place. Even worse, any changes to submodules
(like collider.mix
or collider-dev.mix
) are going
to be ignored, since collider.jam
package uses their
snapshots from remote repos.
To fix this we need to link those packages with local repo deployments. Linking is a two-step process.
First, we create global links for each locally deployed component:
cd collider.jam
sudo npm link
cd ../collider.mix
sudo npm link
cd ../collider-dev.mix
sudo npm link
cd ../collider-boot.mix
sudo npm link
cd ..
This links the global npm packages to the local repos.
Local Link
The last step is to link those package dependencies locally.
When you run npm install
or npm update
npm installs
or updates package snapshots in ./node_modules
folder.
We need to patch ./node_modules
so it would contain the links
to actual local repos instead of remote snapshots.
Only the packages with other framework dependencies need to be linked - collider-dev.mix
and collider.jam
.
cd jam/collider-dev.mix
npm install
npm link collider.mix
cd ..
cd collider.jam
npm install
npm link collider.mix collider-dev.mix collider-boot.mix
The link <module-name>
command creates a link to package deployment in ./node_modules
.
Note, that these links are going to be wiped next time you run
npm install
or npm update
.
So this linking process must be repeated after each install or update.
Since this deployment is very peculiar and necessary only when
developing or modifying
Collider.JAM, there is currently
no command in jam
to help you with that.
All steps need to be performed manually.
You might want to create a script to automate this.