- Install node.js
- Install n
sudo npm install n -g
- Install yarn
sudo npm install yarn -g
$ n 12.18.4
$ git clone <your forked repository>
$ cd companion
$ yarn update
$ yarn dev
We use prettier to format the code in this project.
Many code editors support using prettier to format code you write. It is recommended to run yarn format
before committing your changes to ensure any changes are correctly formatted.
yarn update
When you're doing changes to modules in companion, you need to upgrade the git link in the core as well.
- Make sure you pull inside the module folder
git pull origin master
- Do your changes
- Commit the changes with a nice message
- Push your changes
git push origin HEAD:master
Now, in the core, we need to upgrade the reference to the module to the new version. For this we've made a tool. Go to the companion base directory (not inside the module):
cd companion
./tools/upgrade_module.sh <modulename>
cd ./lib/module/
mkdir mynewmodule
cd mynewmodule
yarn init -y
git init
git add package.json
git commit package.json -m "package.json"
echo node_modules/ > .gitignore
git add .gitignore
git commit .gitignore -m "gitignore to ignore the node_modules/ folder"
Now, you need to ask the core developers to create a repository for your module, and wait for them to create the module repository.
When the repository gets created by a core developer, you can continue.
git remote add origin https://github.com/bitfocus/companion-module-mynewmodule.git
git push origin HEAD:master
Now we're at a point that the core developers must decide if its time to include this module in the companion core. But ask us on slack, and if we decide to add it - and we say it's done, you my proceed.
It's important that you didn't get any erros in the last push, because you're going to delete the code from your computer (make a backup if you're unsure).
cd ..
rm -rf mynewmodule
cd ../../
yarn update
The module should now appear in lib/module/mynewmodule, and if you want to change something in the module after this, you need to do your changes, commit it to the repository and read the beginning of the modules section in this document.
Questions? SLACK! :)