chore(package): various updates
This commit is contained in:
parent
f5fb066975
commit
51def6535f
2
packages/xo-server-transport-xmpp/.gitignore
vendored
2
packages/xo-server-transport-xmpp/.gitignore
vendored
@ -3,3 +3,5 @@
|
|||||||
|
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
npm-debug.log.*
|
npm-debug.log.*
|
||||||
|
pnpm-debug.log
|
||||||
|
pnpm-debug.log.*
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
Error.stackTraceLimit = 100
|
|
||||||
|
|
||||||
try { require('trace') } catch (_) {}
|
|
||||||
try { require('clarify') } catch (_) {}
|
|
||||||
try { require('source-map-support/register') } catch (_) {}
|
|
@ -1 +0,0 @@
|
|||||||
--require ./.mocha.js
|
|
@ -1,6 +1,7 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- 'stable'
|
- 'stable'
|
||||||
|
- '6'
|
||||||
- '4'
|
- '4'
|
||||||
|
|
||||||
# Use containers.
|
# Use containers.
|
||||||
|
@ -4,42 +4,34 @@ XO-Server plugin which sends XMPP messages.
|
|||||||
|
|
||||||
## Install
|
## 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
|
## Usage
|
||||||
|
|
||||||
Edit your `xo-server` configuration and add the plugin name in the `plugins` section.
|
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).
|
||||||
```yaml
|
|
||||||
plugins:
|
|
||||||
|
|
||||||
xo-server-transport-xmpp:
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
### Installing dependencies
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
# Install dependencies
|
||||||
> npm install
|
> npm install
|
||||||
```
|
|
||||||
|
|
||||||
### Compilation
|
# Run the tests
|
||||||
|
> npm test
|
||||||
|
|
||||||
The sources files are watched and automatically recompiled on changes.
|
# Continuously compile
|
||||||
|
|
||||||
```
|
|
||||||
> npm run dev
|
> npm run dev
|
||||||
```
|
|
||||||
|
|
||||||
### Tests
|
# Continuously run the tests
|
||||||
|
> npm run dev-test
|
||||||
|
|
||||||
```
|
# Build for production (automatically called by npm install)
|
||||||
> npm run test-dev
|
> npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
|
@ -4,10 +4,13 @@
|
|||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"description": "Transport Xmpp plugin for XO-Server",
|
"description": "Transport Xmpp plugin for XO-Server",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"xo-server",
|
"jabber",
|
||||||
|
"orchestra",
|
||||||
"transport",
|
"transport",
|
||||||
"message",
|
"xen",
|
||||||
"messages"
|
"xen-orchestra",
|
||||||
|
"xmpp",
|
||||||
|
"xo-server"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/vatesfr/xo-server-transport-xmpp",
|
"homepage": "https://github.com/vatesfr/xo-server-transport-xmpp",
|
||||||
"bugs": "https://github.com/vatesfr/xo-server-transport-xmpp/issues",
|
"bugs": "https://github.com/vatesfr/xo-server-transport-xmpp/issues",
|
||||||
@ -39,24 +42,22 @@
|
|||||||
"babel-plugin-transform-runtime": "^6.15.0",
|
"babel-plugin-transform-runtime": "^6.15.0",
|
||||||
"babel-preset-latest": "^6.16.0",
|
"babel-preset-latest": "^6.16.0",
|
||||||
"babel-preset-stage-0": "^6.16.0",
|
"babel-preset-stage-0": "^6.16.0",
|
||||||
"clarify": "^2.0.0",
|
"cross-env": "^3.1.3",
|
||||||
"dependency-check": "^2.5.1",
|
"dependency-check": "^2.5.1",
|
||||||
"ghooks": "^1.3.2",
|
"ghooks": "^1.3.2",
|
||||||
"mocha": "^3.1.0",
|
"rimraf": "^2.5.4",
|
||||||
"must": "^0.13.1",
|
"standard": "^8.2.0"
|
||||||
"source-map-support": "^0.4.3",
|
|
||||||
"standard": "^8.2.0",
|
|
||||||
"trace": "^2.0.1"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"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",
|
"depcheck": "dependency-check ./package.json",
|
||||||
"dev": "NODE_DEV=development babel --watch --source-maps --out-dir=dist/ src/",
|
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
|
||||||
"dev-test": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\"",
|
|
||||||
"lint": "standard",
|
"lint": "standard",
|
||||||
"posttest": "npm run lint && npm run depcheck",
|
"posttest": "npm run lint && npm run depcheck",
|
||||||
"prepublish": "npm run build",
|
"prebuild": "npm run clean",
|
||||||
"test": "mocha --opts .mocha.opts \"dist/**/*.spec.js\""
|
"predev": "npm run clean",
|
||||||
|
"prepublish": "npm run build"
|
||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
@ -34,7 +34,7 @@ export const configurationSchema = {
|
|||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
class TransportXmppPlugin {
|
class TransportXmppPlugin {
|
||||||
constructor (xo) {
|
constructor ({ xo }) {
|
||||||
this._sendToXmppClient = ::this._sendToXmppClient
|
this._sendToXmppClient = ::this._sendToXmppClient
|
||||||
this._set = ::xo.defineProperty
|
this._set = ::xo.defineProperty
|
||||||
this._unset = null
|
this._unset = null
|
||||||
@ -46,7 +46,7 @@ class TransportXmppPlugin {
|
|||||||
this._client = null
|
this._client = null
|
||||||
}
|
}
|
||||||
|
|
||||||
configure ({...conf}) {
|
configure (conf) {
|
||||||
this._conf = conf
|
this._conf = conf
|
||||||
this._conf.reconnect = true
|
this._conf.reconnect = true
|
||||||
}
|
}
|
||||||
@ -64,17 +64,22 @@ class TransportXmppPlugin {
|
|||||||
unload () {
|
unload () {
|
||||||
this._unset()
|
this._unset()
|
||||||
this._client.end()
|
this._client.end()
|
||||||
|
|
||||||
|
this._unset = this._client = null
|
||||||
}
|
}
|
||||||
|
|
||||||
_sendToXmppClient ({to, message}) {
|
_sendToXmppClient ({to, message}) {
|
||||||
for (const receiver of to) {
|
for (const receiver of to) {
|
||||||
const stanza = new XmppClient.Stanza('message', { to: receiver, type: 'chat' })
|
this._client.send(
|
||||||
.c('body').t(message)
|
new XmppClient.Stanza('message', {
|
||||||
this._client.send(stanza)
|
to: receiver,
|
||||||
|
type: 'chat'
|
||||||
|
}).c('body').t(message)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
export default ({ xo }) => new TransportXmppPlugin(xo)
|
export default opts => new TransportXmppPlugin(opts)
|
||||||
|
@ -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()
|
|
||||||
})
|
|
||||||
})
|
|
Loading…
Reference in New Issue
Block a user