This library is hosted on Github, contributions are more then welcome.
- Fork library
- Install Pull
- Compile the library
- Run the tests
- Repository content
- Contributors ✨
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/node-sonos-ts.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
We like to use the Github pull application, to keep our beta branch and the forks up-to-date. You have to install this application yourself, but it will work automatically.
Before you can use this library is has to be compiled.
npm run install && npm run build
After changing somehting you should run the tests (as they are automatically run before your PR is accepted). Important code should be covered by tests, and is uploaded to Coveralls.io
npm run test
or (to test against your actual device)
SONOS_HOST=192.168.x.x npm run test
This library has several VSCode tasks defined, be sure to change your sonos host in the
.vscode/launch.json file. If you open an example file and press F5 the example is run and you can set breakpoints in the sample code and in the TypeScript code.
You can also debug the service generator of the tests.
This library makes use of node debug, if you want to see debug logs you can set the
DEBUG environment variable to one of the following values. If you run the examples with the VSCode debug task, this variable is set to
sonos:* so you should see all the logs.
|Environment variable||What will log|
| ||See all debug logs.|
| ||See all debug logs from the SonosDevice class.|
| ||See all debug logs for all the various services (this is where most of the magic happens).|
| ||See all debug logs for a specific service.|
| ||See all debug logs for all the various services for a single device (this is where most of the magic happens).|
| ||See all debug logs for the metadata helper.|
- docs/ These documentations
- examples/ Several examples on how to use this library.
- img/ Some static images used in the library
- src/helpers/ Some usefull typesscript class, used everywhere in the library.
- src/helpers/metadata-helper.ts This class will generate (actually guess) the needed metadata. Easily extended.
- src/models/ Hand-crafted models used by the library.
- src/services/ All automatic generated services.
- src/services/base-service.ts Base service class, where all the generated services depend opon. This is where most of the magic happens.
- src/index.ts Just an index to expose all classes that need to be exposed.
- src/sonos-device-base.ts Generated SonosDeviceBase, to expose all the services in the derived class.
- src/sonos-device-discovery.ts Async device discovery (by using SSDP, multicast)
- src/sonos-device.ts SonosDevice class, this is the main entry point to control devices.
- src/sonos-event-listener.ts Event listener, used for logical devices and for all sonos events.
- src/sonos-manager.ts SonosManager class, logical devices.
- tests/.. - All the tests, using the Jest framework.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!