Skip to content

Commit

Permalink
Separated test build from publish build
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmantz committed May 26, 2016
1 parent b86e61a commit f8cf1fb
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 88 deletions.
3 changes: 1 addition & 2 deletions .babelrc
@@ -1,4 +1,3 @@
{
"presets": ["react", "es2015", "stage-0"],
"plugins": ["rewire"]
"presets": ["react", "es2015", "stage-0"]
}
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
node_modules/
.tmp/
66 changes: 13 additions & 53 deletions dist/redux-oidc.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
@@ -1,14 +1,12 @@
{
"name": "redux-oidc",
"version": "2.0.0-alpha.1",
"version": "2.0.0-beta.1",
"description": "A package for managing OpenID Connect authentication in redux apps",
"main": "dist/redux-oidc.js",
"scripts": {
"test": "mocha --compilers js:babel-register --require tests/setup.js tests/**/*.test.js",
"test:debug": "mocha --compilers js:babel-register --require tests/setup.js --debug tests/*.test.js",
"test:webpack": "mocha-webpack --webpack-config webpack.config-test.js \"tests/**/*.test.js\"",
"build": "webpack -p",
"prepublish": "npm run build",
"build:pretty": "webpack"
"prepublish": "npm run build && npm run test"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -54,11 +52,13 @@
"jsdom": "^8.3.0",
"json-loader": "^0.5.4",
"mocha": "^2.4.5",
"mocha-webpack": "^0.3.1",
"node-storage-shim": "^1.0.1",
"react-addons-test-utils": "^0.14.8",
"react-shallow-testutils": "^1.0.0",
"sinon": "^1.17.3",
"webpack": "^1.12.14"
"webpack": "^1.12.14",
"webpack-node-externals": "^1.2.0"
},
"dependencies": {
"oidc-client": "1.0.0"
Expand Down
2 changes: 0 additions & 2 deletions src/helpers/index.js

This file was deleted.

32 changes: 20 additions & 12 deletions src/index.js
@@ -1,19 +1,27 @@
import createTokenMiddleware from './tokenMiddleware';
import Callback from './CallbackComponent';
import helpers from './helpers';
import reducerImmutable from './reducer/reducer-immutable';
import standardReducer from './reducer/reducer';
import { USER_EXPIRED, REDIRECT_SUCCESS, STORAGE_KEY } from './constants';
import createOidcMiddleware from './oidcMiddleware';

// redux-oidc components
export const createUserManager = require('./helpers/createUserManager').default;
export const processSilentRenew = require('./helpers/processSilentRenew').default;
export const CallbackComponent = require('./CallbackComponent').default;
export const immutableReducer = require('./reducer/reducer-immutable').default;
export const reducer = require('./reducer/reducer').default;
export const constants = {
USER_EXPIRED,
REDIRECT_SUCCESS,
STORAGE_KEY
};
export const OidcProvider = require('./OidcProvider').default;

export default createTokenMiddleware;
// constants
export const USER_EXPIRED = require('./constants').USER_EXPIRED;
export const REDIRECT_SUCCESS = require('./constants').REDIRECT_SUCCESS;
export const USER_FOUND = require('./constants').USER_FOUND;
export const SILENT_RENEW_ERROR = require('./constants').SILENT_RENEW_ERROR;
export const SESSION_TERMINATED = require('./constants').SESSION_TERMINATED;
export const USER_EXPIRING = require('./constants').USER_EXPIRING;

// actions
export const userExpired = require('./actions').userExpired;
export const redirectSuccess = require('./actions').redirectSuccess;
export const userFound = require('./actions').userFound;
export const silentRenewError = require('./actions').silentRenewError;
export const sessionTerminated = require('./actions').sessionTerminated;
export const userExpiring = require('./actions').userExpiring;

export default createOidcMiddleware;
1 change: 1 addition & 0 deletions tests/OidcProvider.test.js
@@ -1,3 +1,4 @@
import './setup';
import expect from 'expect';
import sinon from 'sinon';
import OidcProvider from '../src/OidcProvider';
Expand Down
1 change: 1 addition & 0 deletions tests/actions/index.test.js
@@ -1,3 +1,4 @@
import '../setup';
import expect from 'expect';
import sinon from 'sinon';
import { USER_EXPIRED, REDIRECT_SUCCESS, USER_FOUND, SILENT_RENEW_ERROR, USER_EXPIRING, SESSION_TERMINATED } from '../../src/constants';
Expand Down
1 change: 1 addition & 0 deletions tests/callbackComponent.test.js
@@ -1,3 +1,4 @@
import './setup';
import ReactTestUtils from 'react-addons-test-utils';
import expect from 'expect';
import React from 'react';
Expand Down
1 change: 1 addition & 0 deletions tests/helpers/createUserManager.test.js
@@ -1,4 +1,5 @@
import 'babel-polyfill';
import '../setup';
import createUserManager from '../../src/helpers/createUserManager';
import expect from 'expect';
import sinon from 'sinon';
Expand Down
1 change: 1 addition & 0 deletions tests/helpers/processSilentRenew.test.js
@@ -1,4 +1,5 @@
import 'babel-polyfill';
import '../setup';
import sinon from 'sinon';
import expect from 'expect';
import processSilentRenew from '../../src/helpers/processSilentRenew'
Expand Down
1 change: 1 addition & 0 deletions tests/oidcMiddleware.test.js
@@ -1,3 +1,4 @@
import './setup';
import sinon from 'sinon';
import expect from 'expect';
import { STORAGE_KEY } from '../src/constants';
Expand Down
1 change: 1 addition & 0 deletions tests/reducer/reducer-immutable.test.js
@@ -1,3 +1,4 @@
import '../setup';
import expect from 'expect';
import sinon from 'sinon';
import { fromJS } from 'immutable';
Expand Down
1 change: 1 addition & 0 deletions tests/reducer/reducer.test.js
@@ -1,3 +1,4 @@
import '../setup';
import expect from 'expect';
import sinon from 'sinon';
import { userExpired, userFound, silentRenewError, sessionTerminated, userExpiring, redirectSuccess } from '../../src/actions';
Expand Down
19 changes: 19 additions & 0 deletions webpack.config-test.js
@@ -0,0 +1,19 @@
var nodeExternals = require('webpack-node-externals');
var webpack = require('webpack');

module.exports = {
target: 'node', // in order to ignore built-in modules like path, fs, etc.
externals: nodeExternals(),
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel?plugins=rewire',
exclude: /node_modules/
}
]
},
plugins: [
],
devtool: 'inline-source-map'
};
15 changes: 2 additions & 13 deletions webpack.config.js
Expand Up @@ -18,22 +18,11 @@ module.exports = {
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['es2015', 'stage-0', 'react']
}
},
{
test: /\.html$/,
loader: 'file?name=[name].[ext]'
},
{
test: /\.css$/,
loader: 'style!css'
exclude: /node_modules/
}
]
},
plugins: [
// new webpack.optimize.UglifyJsPlugin({comments: false, compress: { warnings: false }})
new webpack.optimize.UglifyJsPlugin({comments: false, compress: { warnings: false }, screw_ie8: true})
]
};

0 comments on commit f8cf1fb

Please sign in to comment.