Skip to content

Commit c1337fc

Browse files
committed
Update to new plugin infrastructure (#30)
1 parent 7bd2cdb commit c1337fc

18 files changed

Lines changed: 1066 additions & 3010 deletions

File tree

‎packages/authentication-oauth1/.babelrc‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎packages/authentication-oauth1/.gitignore‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,4 @@ node_modules
2929
# Users Environment Variables
3030
.lock-wscript
3131

32-
# The compiled/babelified modules
33-
lib/
34-
35-
# Yarn lockfile
36-
yarn.lock
37-
38-
# Exclude local vscode settings
39-
.vscode
32+
dist/
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
verbose: false
22
instrumentation:
3-
root: ./src/
4-
excludes:
5-
- lib/
3+
root: ./lib/
64
include-all-sources: true
75
reporting:
86
print: summary
@@ -14,4 +12,4 @@ reporting:
1412
statements: [50, 80]
1513
lines: [50, 80]
1614
functions: [50, 80]
17-
branches: [50, 80]
15+
branches: [50, 80]

‎packages/authentication-oauth1/.npmignore‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
.istanbul.yml
55
.babelrc
66
.idea/
7-
src/
7+
.vscode/
88
test/
9-
!lib/
9+
coverage/
1010
.github/
11-
coverage

‎packages/authentication-oauth1/.travis.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ language: node_js
22
node_js:
33
- node
44
- '6'
5-
- '4'
65
addons:
76
code_climate:
87
repo_token: e9df6da1efb4ae199a7f1dd2a683b8d13a9d03411e269840244b43b563a3e5fe

‎packages/authentication-oauth1/example/app.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ app.configure(rest())
3131
.use('/users', memory())
3232
.use(errorHandler());
3333

34-
function customizeTwitterProfile() {
35-
return function(hook) {
34+
function customizeTwitterProfile () {
35+
return function (hook) {
3636
console.log('Customizing Twitter Profile');
3737
// If there is a twitter field they signed up or
3838
// signed in with twitter so let's pull the email

packages/authentication-oauth1/src/express/error-handler.js renamed to packages/authentication-oauth1/lib/express/error-handler.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// The default Express error middleware that gets called by the OAuth callback route.
2-
3-
export default function OAuthErrorHandler (options = {}) {
1+
module.exports = function OAuthErrorHandler (options = {}) {
42
return function (err, req, res, next) {
53
// Set __redirect so that later middleware (e.g., auth.express.failureRedirect) can redirect accordingly
64
if (options.failureRedirect) {
@@ -10,4 +8,4 @@ export default function OAuthErrorHandler (options = {}) {
108

119
next(err);
1210
};
13-
}
11+
};

packages/authentication-oauth1/src/express/handler.js renamed to packages/authentication-oauth1/lib/express/handler.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
// The default Express middleware that gets called by the OAuth callback route.
2-
import Debug from 'debug';
1+
const Debug = require('debug');
32

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

6-
export default function OAuthHandler (options = {}) {
5+
module.exports = function OAuthHandler (options = {}) {
76
return function (req, res, next) {
87
const app = req.app;
98
const authSettings = app.get('auth') || app.get('authentication') || {};
@@ -32,4 +31,4 @@ export default function OAuthHandler (options = {}) {
3231
next();
3332
}).catch(next);
3433
};
35-
}
34+
};

packages/authentication-oauth1/src/index.js renamed to packages/authentication-oauth1/lib/index.js

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
import Debug from 'debug';
2-
import auth from 'feathers-authentication';
3-
import { formatter as defaultFormatter } from 'feathers-rest';
4-
import { omit, pick, makeUrl } from 'feathers-commons';
5-
import merge from 'lodash.merge';
6-
import defaultHandler from './express/handler';
7-
import DefaultVerifier from './verifier';
1+
const Debug = require('debug');
2+
const auth = require('feathers-authentication');
3+
const rest = require('feathers-rest');
4+
5+
const {
6+
omit,
7+
pick,
8+
makeUrl
9+
} = require('feathers-commons');
10+
11+
const merge = require('lodash.merge');
12+
const defaultHandler = require('./express/handler');
13+
const DefaultVerifier = require('./verifier');
814

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

@@ -16,7 +22,7 @@ const INCLUDE_KEYS = [
1622

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

19-
export default function init (options = {}) {
25+
module.exports = function init (options = {}) {
2026
return function oauth1Auth () {
2127
const app = this;
2228
const _super = app.setup;
@@ -60,7 +66,7 @@ export default function init (options = {}) {
6066
}
6167

6268
const Verifier = options.Verifier || DefaultVerifier;
63-
const formatter = options.formatter || defaultFormatter;
69+
const formatter = options.formatter || rest.formatter;
6470
const handler = options.handler || defaultHandler(oauth1Settings);
6571

6672
// register OAuth middleware
@@ -96,9 +102,9 @@ export default function init (options = {}) {
96102
return result;
97103
};
98104
};
99-
}
105+
};
100106

101107
// Exposed Modules
102-
Object.assign(init, {
108+
Object.assign(module.exports, {
103109
Verifier: DefaultVerifier
104110
});

packages/authentication-oauth1/src/verifier.js renamed to packages/authentication-oauth1/lib/verifier.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import Debug from 'debug';
2-
import merge from 'lodash.merge';
1+
const Debug = require('debug');
32

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

@@ -117,4 +116,4 @@ class OAuth1Vierifier {
117116
}
118117
}
119118

120-
export default OAuth1Vierifier;
119+
module.exports = OAuth1Vierifier;

0 commit comments

Comments
 (0)