Skip to content

Commit

Permalink
Move the middleware to db repo
Browse files Browse the repository at this point in the history
  • Loading branch information
thani-sh committed Sep 1, 2016
1 parent a2e6a1c commit 635d885
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 226 deletions.
13 changes: 7 additions & 6 deletions dist/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ var _fs = require('fs');

var _fs2 = _interopRequireDefault(_fs);

var _storybook = require('./middleware/storybook');
var _middleware = require('./middleware');

var _storybook2 = _interopRequireDefault(_storybook);
var _middleware2 = _interopRequireDefault(_middleware);

var _datastore = require('./middleware/datastore');
var _middleware3 = require('@kadira/storybook-database-local/dist/middleware');

var _datastore2 = _interopRequireDefault(_datastore);
var _middleware4 = _interopRequireDefault(_middleware3);

var _package = require('../../package.json');

Expand Down Expand Up @@ -83,8 +83,9 @@ if (_commander2.default.staticDir) {
// Build the webpack configuration using the `baseConfig`
// custom `.babelrc` file and `webpack.config.js` files
var configDir = _commander2.default.configDir || './.storybook';
app.use((0, _storybook2.default)(configDir));
app.use('/db', (0, _datastore2.default)(configDir));
var dbPath = _path2.default.resolve(configDir, 'datastore.json');
app.use((0, _middleware2.default)(configDir));
app.use('/db', (0, _middleware4.default)(dbPath));

app.listen.apply(app, listenAddr.concat([function (error) {
if (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ var _webpackHotMiddleware = require('webpack-hot-middleware');

var _webpackHotMiddleware2 = _interopRequireDefault(_webpackHotMiddleware);

var _webpack3 = require('../config/webpack.config');
var _webpack3 = require('./config/webpack.config');

var _webpack4 = _interopRequireDefault(_webpack3);

var _config = require('../config');
var _config = require('./config');

var _config2 = _interopRequireDefault(_config);

var _index = require('../index.html');
var _index = require('./index.html');

var _index2 = _interopRequireDefault(_index);

var _iframe = require('../iframe.html');
var _iframe = require('./iframe.html');

var _iframe2 = _interopRequireDefault(_iframe);

var _utils = require('../utils');
var _utils = require('./utils');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
128 changes: 0 additions & 128 deletions dist/server/middleware/datastore.js

This file was deleted.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@kadira/storybook-addon-links": "^1.0.0",
"@kadira/storybook-addons": "^1.5.0",
"@kadira/storybook-channel-pagebus": "^2.0.2",
"@kadira/storybook-database-local": "^1.0.3",
"@kadira/storybook-database-local": "^1.1.0",
"@kadira/storybook-ui": "^3.3.2",
"autoprefixer": "^6.3.7",
"babel-core": "^6.11.4",
Expand All @@ -43,7 +43,6 @@
"babel-preset-es2016": "^6.11.3",
"babel-preset-react": "^6.11.1",
"babel-runtime": "^6.9.2",
"body-parser": "^1.15.2",
"case-sensitive-paths-webpack-plugin": "^1.1.2",
"commander": "^2.9.0",
"configstore": "^2.0.0",
Expand All @@ -55,7 +54,6 @@
"json-stringify-safe": "^5.0.1",
"json5": "^0.5.0",
"lodash.pick": "^4.2.0",
"lowdb": "^0.13.1",
"postcss-loader": "0.9.1",
"qs": "^6.1.0",
"react-modal": "^1.2.0",
Expand Down
7 changes: 4 additions & 3 deletions src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import express from 'express';
import program from 'commander';
import path from 'path';
import fs from 'fs';
import storybook from './middleware/storybook';
import datastore from './middleware/datastore';
import storybook from './middleware';
import datastore from '@kadira/storybook-database-local/dist/middleware';
import packageJson from '../../package.json';
import { parseList, getEnvConfig } from './utils';
import { track, dontTrack } from './track_usage';
Expand Down Expand Up @@ -65,8 +65,9 @@ if (program.staticDir) {
// Build the webpack configuration using the `baseConfig`
// custom `.babelrc` file and `webpack.config.js` files
const configDir = program.configDir || './.storybook';
const dbPath = path.resolve(configDir, 'datastore.json');
app.use(storybook(configDir));
app.use('/db', datastore(configDir));
app.use('/db', datastore(dbPath));

app.listen(...listenAddr, function (error) {
if (error) {
Expand Down
10 changes: 5 additions & 5 deletions src/server/middleware/storybook.js → src/server/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Router } from 'express';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
import baseConfig from '../config/webpack.config';
import loadConfig from '../config';
import getIndexHtml from '../index.html';
import getIframeHtml from '../iframe.html';
import { getHeadHtml } from '../utils';
import baseConfig from './config/webpack.config';
import loadConfig from './config';
import getIndexHtml from './index.html';
import getIframeHtml from './iframe.html';
import { getHeadHtml } from './utils';

export default function (configDir) {
// Build the webpack configuration using the `baseConfig`
Expand Down
76 changes: 0 additions & 76 deletions src/server/middleware/datastore.js

This file was deleted.

0 comments on commit 635d885

Please sign in to comment.