Skip to content

Commit

Permalink
Update to new plugin infrastructure (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed Aug 29, 2018
1 parent 8f35797 commit 9c01061
Show file tree
Hide file tree
Showing 18 changed files with 1,066 additions and 3,010 deletions.
4 changes: 0 additions & 4 deletions packages/authentication-oauth1/.babelrc

This file was deleted.

9 changes: 1 addition & 8 deletions packages/authentication-oauth1/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,4 @@ node_modules
# Users Environment Variables
.lock-wscript

# The compiled/babelified modules
lib/

# Yarn lockfile
yarn.lock

# Exclude local vscode settings
.vscode
dist/
6 changes: 2 additions & 4 deletions packages/authentication-oauth1/.istanbul.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
verbose: false
instrumentation:
root: ./src/
excludes:
- lib/
root: ./lib/
include-all-sources: true
reporting:
print: summary
Expand All @@ -14,4 +12,4 @@ reporting:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
branches: [50, 80]
5 changes: 2 additions & 3 deletions packages/authentication-oauth1/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
.istanbul.yml
.babelrc
.idea/
src/
.vscode/
test/
!lib/
coverage/
.github/
coverage
1 change: 0 additions & 1 deletion packages/authentication-oauth1/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: node_js
node_js:
- node
- '6'
- '4'
addons:
code_climate:
repo_token: e9df6da1efb4ae199a7f1dd2a683b8d13a9d03411e269840244b43b563a3e5fe
Expand Down
4 changes: 2 additions & 2 deletions packages/authentication-oauth1/example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ app.configure(rest())
.use('/users', memory())
.use(errorHandler());

function customizeTwitterProfile() {
return function(hook) {
function customizeTwitterProfile () {
return function (hook) {
console.log('Customizing Twitter Profile');
// If there is a twitter field they signed up or
// signed in with twitter so let's pull the email
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// The default Express error middleware that gets called by the OAuth callback route.

export default function OAuthErrorHandler (options = {}) {
module.exports = function OAuthErrorHandler (options = {}) {
return function (err, req, res, next) {
// Set __redirect so that later middleware (e.g., auth.express.failureRedirect) can redirect accordingly
if (options.failureRedirect) {
Expand All @@ -10,4 +8,4 @@ export default function OAuthErrorHandler (options = {}) {

next(err);
};
}
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// The default Express middleware that gets called by the OAuth callback route.
import Debug from 'debug';
const Debug = require('debug');

const debug = Debug('feathers-authentication-oauth1:handler');

export default function OAuthHandler (options = {}) {
module.exports = function OAuthHandler (options = {}) {
return function (req, res, next) {
const app = req.app;
const authSettings = app.get('auth') || app.get('authentication') || {};
Expand Down Expand Up @@ -32,4 +31,4 @@ export default function OAuthHandler (options = {}) {
next();
}).catch(next);
};
}
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import Debug from 'debug';
import auth from 'feathers-authentication';
import { formatter as defaultFormatter } from 'feathers-rest';
import { omit, pick, makeUrl } from 'feathers-commons';
import merge from 'lodash.merge';
import defaultHandler from './express/handler';
import DefaultVerifier from './verifier';
const Debug = require('debug');
const auth = require('feathers-authentication');
const rest = require('feathers-rest');

const {
omit,
pick,
makeUrl
} = require('feathers-commons');

const merge = require('lodash.merge');
const defaultHandler = require('./express/handler');
const DefaultVerifier = require('./verifier');

const debug = Debug('feathers-authentication-oauth1');

Expand All @@ -16,7 +22,7 @@ const INCLUDE_KEYS = [

const EXCLUDE_KEYS = ['Verifier', 'Strategy', 'formatter'];

export default function init (options = {}) {
module.exports = function init (options = {}) {
return function oauth1Auth () {
const app = this;
const _super = app.setup;
Expand Down Expand Up @@ -60,7 +66,7 @@ export default function init (options = {}) {
}

const Verifier = options.Verifier || DefaultVerifier;
const formatter = options.formatter || defaultFormatter;
const formatter = options.formatter || rest.formatter;
const handler = options.handler || defaultHandler(oauth1Settings);

// register OAuth middleware
Expand Down Expand Up @@ -96,9 +102,9 @@ export default function init (options = {}) {
return result;
};
};
}
};

// Exposed Modules
Object.assign(init, {
Object.assign(module.exports, {
Verifier: DefaultVerifier
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Debug from 'debug';
import merge from 'lodash.merge';
const Debug = require('debug');

const debug = Debug('feathers-authentication-oauth1:verify');

Expand Down Expand Up @@ -117,4 +116,4 @@ class OAuth1Vierifier {
}
}

export default OAuth1Vierifier;
module.exports = OAuth1Vierifier;
1 change: 0 additions & 1 deletion packages/authentication-oauth1/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
--recursive test/
--compilers js:babel-core/register
Loading

0 comments on commit 9c01061

Please sign in to comment.