Link Search Menu Expand Document

Development

This library is hosted on Github, contributions are more then welcome.

  1. Fork library
  2. Compile the library
  3. Run the tests
  4. Debugging
  5. Run documentation generator locally
  6. Contributors ✨

Fork library

You should start by creating a fork. Or if you already had a fork sync the fork:

# Add the remote, call it "upstream": (only once)
git remote add upstream https://github.com/svrooij/sonos2mqtt.git

# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream

# Make sure that you're on your master branch:
git checkout master

# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:
git rebase upstream/master

Compile the library

Before you can use this library is has to be compiled.

npm run install && npm run build

Run the tests

After changing somehting you should run the tests (as they are automatically run before your PR is accepted).

npm run test

It’s also important to start the app and test it in your local environment. If you don’t want to use your production mqtt server. Just start a temporary one with docker.

Debugging

This library has a VSCode launch file (.vscode/launch.json). You should be able to debug the library in VSCode with breakpoints and everything. The launch file is configured to load a .env file from the root of the library.

Create a .env file in the root with the following config:

# Setting the Sonos device to start with
SONOS2MQTT_DEVICE=192.168.x.x

# Change default mqtt server
# SONOS2MQTT_MQTT=mqtt://some.host:port

# Text-to-speech stuff https://svrooij.io/node-sonos-ts/sonos-device/notifications-and-tts.html#text-to-speech
# SONOS_TTS_ENDPOINT=https://sonos-tts:5601/api/generate
# SONOS_TTS_LANG=en-US

Run documentation generator locally

The documentation can be found in /docs and uses Jekyll to convert the markdown to html. To check the generated documenation locally you can use the following script. It uses docker, so it won’t install anything on your machine. It also has live reload to you can edit and save and should see the changes instantly.

npm run serve-docs or change dir to docs and run docker-compose up

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Tag the all-contributors bot in your PR and you will get added automically to the list of contributors.