js: Add more metadata to package.json for npm publishing
This commit is contained in:
parent
461265f121
commit
5e374350f5
82
js/README.md
Normal file
82
js/README.md
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
Mopidy.js
|
||||||
|
=========
|
||||||
|
|
||||||
|
Mopidy.js is a JavaScript library that is installed as a part of Mopidy's HTTP
|
||||||
|
frontend or from npm. The library makes Mopidy's core API available from the
|
||||||
|
browser or a Node.js environment, using JSON-RPC messages over a WebSocket to
|
||||||
|
communicate with Mopidy.
|
||||||
|
|
||||||
|
|
||||||
|
Getting it for browser use
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
Regular and minified versions of Mopidy.js, ready for use, is installed
|
||||||
|
together with Mopidy. When the HTTP frontend is running, the files are
|
||||||
|
available at:
|
||||||
|
|
||||||
|
- http://localhost:6680/mopidy/mopidy.js
|
||||||
|
- http://localhost:6680/mopidy/mopidy.min.js
|
||||||
|
|
||||||
|
You may need to adjust hostname and port for your local setup.
|
||||||
|
|
||||||
|
In the source repo, you can find the files at:
|
||||||
|
|
||||||
|
- `mopidy/frontends/http/data/mopidy.js`
|
||||||
|
- `mopidy/frontends/http/data/mopidy.min.js`
|
||||||
|
|
||||||
|
|
||||||
|
Getting it for Node.js use
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
If you want to use Mopidy.js from Node.js instead of a browser, you can install
|
||||||
|
Mopidy.js using npm:
|
||||||
|
|
||||||
|
npm install mopidy
|
||||||
|
|
||||||
|
After npm completes, you can import Mopidy.js using ``require()``:
|
||||||
|
|
||||||
|
var Mopidy = require("mopidy").Mopidy;
|
||||||
|
|
||||||
|
|
||||||
|
Using the library
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
See Mopidy's [HTTP frontend
|
||||||
|
documentation](http://docs.mopidy.com/en/latest/modules/frontends/http/).
|
||||||
|
|
||||||
|
|
||||||
|
Building from source
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
1. Install [Node.js](http://nodejs.org/) and npm. There is a PPA if you're
|
||||||
|
running Ubuntu:
|
||||||
|
|
||||||
|
sudo apt-get install python-software-properties
|
||||||
|
sudo add-apt-repository ppa:chris-lea/node.js
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install nodejs npm
|
||||||
|
|
||||||
|
2. Enter the `js/` in Mopidy's Git repo dir and install all dependencies:
|
||||||
|
|
||||||
|
cd js/
|
||||||
|
npm install
|
||||||
|
|
||||||
|
That's it.
|
||||||
|
|
||||||
|
You can now run the tests:
|
||||||
|
|
||||||
|
npm test
|
||||||
|
|
||||||
|
To run tests automatically when you save a file:
|
||||||
|
|
||||||
|
npm run-script watch
|
||||||
|
|
||||||
|
To run tests, concatenate, minify the source, and update the JavaScript files
|
||||||
|
in `mopidy/frontends/http/data/`:
|
||||||
|
|
||||||
|
npm run-script build
|
||||||
|
|
||||||
|
To run other [grunt](http://gruntjs.com/) targets which isn't predefined in
|
||||||
|
`package.json` and thus isn't available through `npm run-script`:
|
||||||
|
|
||||||
|
PATH=./node_modules/.bin:$PATH grunt foo
|
||||||
@ -1,62 +0,0 @@
|
|||||||
*********
|
|
||||||
Mopidy.js
|
|
||||||
*********
|
|
||||||
|
|
||||||
This is the source for the JavaScript library that is installed as a part of
|
|
||||||
Mopidy's HTTP frontend. The library makes Mopidy's core API available from the
|
|
||||||
browser, using JSON-RPC messages over a WebSocket to communicate with Mopidy.
|
|
||||||
|
|
||||||
|
|
||||||
Getting it
|
|
||||||
==========
|
|
||||||
|
|
||||||
Regular and minified versions of Mopidy.js, ready for use, is installed
|
|
||||||
together with Mopidy. When the HTTP frontend is running, the files are
|
|
||||||
available at:
|
|
||||||
|
|
||||||
- http://localhost:6680/mopidy/mopidy.js
|
|
||||||
- http://localhost:6680/mopidy/mopidy.min.js
|
|
||||||
|
|
||||||
You may need to adjust hostname and port for your local setup.
|
|
||||||
|
|
||||||
In the source repo, you can find the files at:
|
|
||||||
|
|
||||||
- ``mopidy/frontends/http/data/mopidy.js``
|
|
||||||
- ``mopidy/frontends/http/data/mopidy.min.js``
|
|
||||||
|
|
||||||
|
|
||||||
Building from source
|
|
||||||
====================
|
|
||||||
|
|
||||||
1. Install `Node.js <http://nodejs.org/>`_ and npm. There is a PPA if you're
|
|
||||||
running Ubuntu::
|
|
||||||
|
|
||||||
sudo apt-get install python-software-properties
|
|
||||||
sudo add-apt-repository ppa:chris-lea/node.js
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install nodejs npm
|
|
||||||
|
|
||||||
2. Enter the ``js/`` dir and install development dependencies::
|
|
||||||
|
|
||||||
cd js/
|
|
||||||
npm install
|
|
||||||
|
|
||||||
That's it.
|
|
||||||
|
|
||||||
You can now run the tests::
|
|
||||||
|
|
||||||
npm test
|
|
||||||
|
|
||||||
To run tests automatically when you save a file::
|
|
||||||
|
|
||||||
npm run-script watch
|
|
||||||
|
|
||||||
To run tests, concatenate, minify the source, and update the JavaScript files
|
|
||||||
in ``mopidy/frontends/http/data/``::
|
|
||||||
|
|
||||||
npm run-script build
|
|
||||||
|
|
||||||
To run other `grunt <http://gruntjs.com/>`_ targets which isn't predefined in
|
|
||||||
``package.json`` and thus isn't available through ``npm run-script``::
|
|
||||||
|
|
||||||
PATH=./node_modules/.bin:$PATH grunt foo
|
|
||||||
@ -1,6 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "mopidy",
|
"name": "mopidy",
|
||||||
"version": "0.0.0",
|
"version": "0.0.1",
|
||||||
|
"description": "Client lib for controlling a Mopidy music server over a WebSocket",
|
||||||
|
"homepage": "http://www.mopidy.com/",
|
||||||
|
"author": {
|
||||||
|
"name": "Stein Magnus Jodal",
|
||||||
|
"email": "stein.magnus@jodal.no",
|
||||||
|
"url": "http://www.jodal.no"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/mopidy/mopidy.git"
|
||||||
|
},
|
||||||
|
"main": "src/mopidy.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bane": "~0.4.0",
|
"bane": "~0.4.0",
|
||||||
"faye-websocket": "~0.4.4",
|
"faye-websocket": "~0.4.4",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user