chore(package): various updates

This commit is contained in:
Julien Fontanet 2016-10-28 12:04:41 +02:00
parent f5fb066975
commit 51def6535f
8 changed files with 41 additions and 63 deletions

View File

@ -3,3 +3,5 @@
npm-debug.log
npm-debug.log.*
pnpm-debug.log
pnpm-debug.log.*

View File

@ -1,5 +0,0 @@
Error.stackTraceLimit = 100
try { require('trace') } catch (_) {}
try { require('clarify') } catch (_) {}
try { require('source-map-support/register') } catch (_) {}

View File

@ -1 +0,0 @@
--require ./.mocha.js

View File

@ -1,6 +1,7 @@
language: node_js
node_js:
- 'stable'
- '6'
- '4'
# Use containers.

View File

@ -4,42 +4,34 @@ XO-Server plugin which sends XMPP messages.
## Install
Go inside your `xo-server` folder and install it:
Installation of the [npm package](https://npmjs.org/package/xo-server-transport-xmpp):
```
> npm install xo-server-transport-xmpp
> npm install --global xo-server-transport-xmpp
```
## Usage
Edit your `xo-server` configuration and add the plugin name in the `plugins` section.
```yaml
plugins:
xo-server-transport-xmpp:
```
Like all other xo-server plugins, it can be configured directly via
the web iterface, see [the plugin documentation](https://xen-orchestra.com/docs/plugins.html).
## Development
### Installing dependencies
```
# Install dependencies
> npm install
```
### Compilation
# Run the tests
> npm test
The sources files are watched and automatically recompiled on changes.
```
# Continuously compile
> npm run dev
```
### Tests
# Continuously run the tests
> npm run dev-test
```
> npm run test-dev
# Build for production (automatically called by npm install)
> npm run build
```
## Contributions

View File

@ -4,10 +4,13 @@
"license": "AGPL-3.0",
"description": "Transport Xmpp plugin for XO-Server",
"keywords": [
"xo-server",
"jabber",
"orchestra",
"transport",
"message",
"messages"
"xen",
"xen-orchestra",
"xmpp",
"xo-server"
],
"homepage": "https://github.com/vatesfr/xo-server-transport-xmpp",
"bugs": "https://github.com/vatesfr/xo-server-transport-xmpp/issues",
@ -39,24 +42,22 @@
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-latest": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"clarify": "^2.0.0",
"cross-env": "^3.1.3",
"dependency-check": "^2.5.1",
"ghooks": "^1.3.2",
"mocha": "^3.1.0",
"must": "^0.13.1",
"source-map-support": "^0.4.3",
"standard": "^8.2.0",
"trace": "^2.0.1"
"rimraf": "^2.5.4",
"standard": "^8.2.0"
},
"scripts": {
"build": "NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"clean": "rimraf dist/",
"depcheck": "dependency-check ./package.json",
"dev": "NODE_DEV=development babel --watch --source-maps --out-dir=dist/ src/",
"dev-test": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\"",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"lint": "standard",
"posttest": "npm run lint && npm run depcheck",
"prepublish": "npm run build",
"test": "mocha --opts .mocha.opts \"dist/**/*.spec.js\""
"prebuild": "npm run clean",
"predev": "npm run clean",
"prepublish": "npm run build"
},
"babel": {
"plugins": [

View File

@ -34,7 +34,7 @@ export const configurationSchema = {
// ===================================================================
class TransportXmppPlugin {
constructor (xo) {
constructor ({ xo }) {
this._sendToXmppClient = ::this._sendToXmppClient
this._set = ::xo.defineProperty
this._unset = null
@ -46,7 +46,7 @@ class TransportXmppPlugin {
this._client = null
}
configure ({...conf}) {
configure (conf) {
this._conf = conf
this._conf.reconnect = true
}
@ -64,17 +64,22 @@ class TransportXmppPlugin {
unload () {
this._unset()
this._client.end()
this._unset = this._client = null
}
_sendToXmppClient ({to, message}) {
for (const receiver of to) {
const stanza = new XmppClient.Stanza('message', { to: receiver, type: 'chat' })
.c('body').t(message)
this._client.send(stanza)
this._client.send(
new XmppClient.Stanza('message', {
to: receiver,
type: 'chat'
}).c('body').t(message)
)
}
}
}
// ===================================================================
export default ({ xo }) => new TransportXmppPlugin(xo)
export default opts => new TransportXmppPlugin(opts)

View File

@ -1,17 +0,0 @@
/* eslint-env mocha */
import expect from 'must'
// ===================================================================
import myLib from './'
// ===================================================================
describe.skip('myLib', () => {
it('does something', () => {
// TODO: some real tests.
expect(myLib).to.exists()
})
})