From 7e2f2f6102d676059ceee4f70860a2a42ebea7c2 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Fri, 28 Oct 2016 13:45:43 +0200 Subject: [PATCH] chore(package): various updates --- packages/xo-server-auth-saml/.gitignore | 2 ++ packages/xo-server-auth-saml/.travis.yml | 1 + packages/xo-server-auth-saml/README.md | 19 ++++++++---------- packages/xo-server-auth-saml/package.json | 24 +++++++++++++++-------- packages/xo-server-auth-saml/src/index.js | 8 +++++--- 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/packages/xo-server-auth-saml/.gitignore b/packages/xo-server-auth-saml/.gitignore index fa69f37f1..827e4e420 100644 --- a/packages/xo-server-auth-saml/.gitignore +++ b/packages/xo-server-auth-saml/.gitignore @@ -3,3 +3,5 @@ npm-debug.log npm-debug.log.* +pnpm-debug.log +pnpm-debug.log.* diff --git a/packages/xo-server-auth-saml/.travis.yml b/packages/xo-server-auth-saml/.travis.yml index fb5d91729..ae52e87e6 100644 --- a/packages/xo-server-auth-saml/.travis.yml +++ b/packages/xo-server-auth-saml/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: - 'stable' + - '6' - '4' # Use containers. diff --git a/packages/xo-server-auth-saml/README.md b/packages/xo-server-auth-saml/README.md index 420d35ae5..82ad17432 100644 --- a/packages/xo-server-auth-saml/README.md +++ b/packages/xo-server-auth-saml/README.md @@ -30,24 +30,21 @@ the web iterface, see [the plugin documentation](https://xen-orchestra.com/docs/ ## 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 diff --git a/packages/xo-server-auth-saml/package.json b/packages/xo-server-auth-saml/package.json index 64c371751..a9ca878c3 100644 --- a/packages/xo-server-auth-saml/package.json +++ b/packages/xo-server-auth-saml/package.json @@ -4,10 +4,13 @@ "license": "AGPL-3.0", "description": "SAML authentication plugin for XO-Server", "keywords": [ - "xo-server", - "xo-server", "authentication", - "saml" + "orchestra", + "plugin", + "saml", + "xen", + "xen-orchestra", + "xo-server" ], "homepage": "https://github.com/vatesfr/xo-server-auth-saml", "bugs": "https://github.com/vatesfr/xo-server-auth-saml/issues", @@ -34,20 +37,25 @@ }, "devDependencies": { "babel-cli": "^6.14.0", - "babel-eslint": "^6.1.2", + "babel-eslint": "^7.1.0", "babel-plugin-transform-runtime": "^6.15.0", - "babel-preset-es2015": "^6.14.0", + "babel-preset-latest": "^6.16.0", "babel-preset-stage-0": "^6.5.0", + "cross-env": "^3.1.3", "dependency-check": "^2.6.0", "ghooks": "^1.3.2", + "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": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/", "lint": "standard", "posttest": "npm run lint && npm run depcheck", + "prebuild": "npm run clean", + "predev": "npm run clean", "prepublish": "npm run build" }, "babel": { @@ -55,7 +63,7 @@ "transform-runtime" ], "presets": [ - "es2015", + "latest", "stage-0" ] }, diff --git a/packages/xo-server-auth-saml/src/index.js b/packages/xo-server-auth-saml/src/index.js index 271200518..e19a4a81b 100644 --- a/packages/xo-server-auth-saml/src/index.js +++ b/packages/xo-server-auth-saml/src/index.js @@ -24,7 +24,9 @@ export const configurationSchema = { // =================================================================== class AuthSamlXoPlugin { - constructor (xo) { + constructor ({ xo }) { + this._conf = null + this._usernameField = null this._xo = xo } @@ -34,7 +36,7 @@ class AuthSamlXoPlugin { } load () { - const {_xo: xo} = this + const xo = this._xo xo.registerPassportStrategy(new Strategy(this._conf, async (profile, done) => { const name = profile[this._usernameField] @@ -54,4 +56,4 @@ class AuthSamlXoPlugin { // =================================================================== -export default ({xo}) => new AuthSamlXoPlugin(xo) +export default opts => new AuthSamlXoPlugin(opts)