Update dist

This commit is contained in:
Muhammed Thanish 2016-10-06 11:31:11 +05:30
parent 8af4a14062
commit 39c75c0e69
3 changed files with 17 additions and 49 deletions

View File

@ -46,19 +46,12 @@ var _storybookChannelPostmsg = require('@kadira/storybook-channel-postmsg');
var _storybookChannelPostmsg2 = _interopRequireDefault(_storybookChannelPostmsg);
var _storybookDatabaseLocal = require('@kadira/storybook-database-local');
var _storybookDatabaseLocal2 = _interopRequireDefault(_storybookDatabaseLocal);
var _preview = require('./preview');
var _preview2 = _interopRequireDefault(_preview);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* global location */
/* eslint class-methods-use-this: 0 */
var ReactProvider = function (_Provider) {
(0, _inherits3.default)(ReactProvider, _Provider);
@ -70,16 +63,6 @@ var ReactProvider = function (_Provider) {
_this.dataId = _uuid2.default.v4();
_this.channel = (0, _storybookChannelPostmsg2.default)({ key: _this.dataId });
_storybookAddons2.default.setChannel(_this.channel);
_this.database = _storybookAddons2.default.getDatabase();
if (!_this.database && process.env.STORYBOOK_ENABLE_DB) {
var bundled = process.env.NODE_ENV === 'production';
if (bundled) {
_this.database = (0, _storybookDatabaseLocal2.default)({ url: 'addon-db.json', bundled: bundled });
} else {
_this.database = (0, _storybookDatabaseLocal2.default)({ url: location.origin + '/db' });
}
_storybookAddons2.default.setDatabase(_this.database);
}
return _this;
}
@ -122,6 +105,7 @@ var ReactProvider = function (_Provider) {
}
}]);
return ReactProvider;
}(_storybookUi.Provider);
}(_storybookUi.Provider); /* global location */
/* eslint class-methods-use-this: 0 */
exports.default = ReactProvider;

20
dist/server/build.js vendored
View File

@ -50,7 +50,12 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production';
// avoid ESLint errors
var logger = console;
_commander2.default.version(_package2.default.version).option('-s, --static-dir <dir-names>', 'Directory where to load static files from', _utils.parseList).option('-o, --output-dir [dir-name]', 'Directory where to store built files').option('-c, --config-dir [dir-name]', 'Directory where to load Storybook configurations from').option('-d, --db-path [db-file]', 'Path to the addon database JSON file').option('--enable-db', 'Enable the (experimental) addon database service on dev-server').parse(process.argv);
_commander2.default.version(_package2.default.version).option('-s, --static-dir <dir-names>', 'Directory where to load static files from', _utils.parseList).option('-o, --output-dir [dir-name]', 'Directory where to store built files').option('-c, --config-dir [dir-name]', 'Directory where to load Storybook configurations from').option('-d, --db-path [db-file]', 'DEPRECATED!').option('--enable-db', 'DEPRECATED!').parse(process.argv);
if (_commander2.default.enableDb || _commander2.default.dbPath) {
logger.error(['Error: the experimental local database addon is no longer bundled with', 'react-storybook. Please remove these flags (-d,--db-path,--enable-db)', 'from the command or npm script and try again.'].join(' '));
process.exit(1);
}
// The key is the field created in `program` variable for
// each command line argument. Value is the env variable.
@ -68,19 +73,6 @@ _shelljs2.default.rm('-rf', outputDir);
_shelljs2.default.mkdir('-p', _path2.default.resolve(outputDir));
_shelljs2.default.cp(_path2.default.resolve(__dirname, 'public/favicon.ico'), outputDir);
// The addon database service is disabled by default for now
// It should be enabled with the --enable-db for dev server
if (_commander2.default.enableDb) {
// NOTE enables database on client
process.env.STORYBOOK_ENABLE_DB = 1;
var dbPath = _commander2.default.dbPath || _path2.default.resolve(configDir, 'addon-db.json');
// create addon-db.json file if it's missing to avoid the 404 error
if (!_fs2.default.existsSync(dbPath)) {
_fs2.default.writeFileSync(dbPath, '{}');
}
_shelljs2.default.cp(dbPath, outputDir);
}
// Build the webpack configuration using the `baseConfig`
// custom `.babelrc` file and `webpack.config.js` files
// NOTE changes to env should be done before calling `getBaseConfig`

26
dist/server/index.js vendored
View File

@ -1,10 +1,6 @@
#!/usr/bin/env node
'use strict';
var _middleware = require('@kadira/storybook-database-local/dist/server/middleware');
var _middleware2 = _interopRequireDefault(_middleware);
var _express = require('express');
var _express2 = _interopRequireDefault(_express);
@ -29,9 +25,9 @@ var _chalk = require('chalk');
var _chalk2 = _interopRequireDefault(_chalk);
var _middleware3 = require('./middleware');
var _middleware = require('./middleware');
var _middleware4 = _interopRequireDefault(_middleware3);
var _middleware2 = _interopRequireDefault(_middleware);
var _package = require('../../package.json');
@ -47,7 +43,12 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var logger = console;
_commander2.default.version(_package2.default.version).option('-p, --port [number]', 'Port to run Storybook (Required)', parseInt).option('-h, --host [string]', 'Host to run Storybook').option('-s, --static-dir <dir-names>', 'Directory where to load static files from').option('-c, --config-dir [dir-name]', 'Directory where to load Storybook configurations from').option('-d, --db-path [db-file]', 'File where to store addon database JSON file').option('--enable-db', 'Enable the (experimental) addon database service on dev-server').option('--dont-track', 'Do not send anonymous usage stats.').parse(process.argv);
_commander2.default.version(_package2.default.version).option('-p, --port [number]', 'Port to run Storybook (Required)', parseInt).option('-h, --host [string]', 'Host to run Storybook').option('-s, --static-dir <dir-names>', 'Directory where to load static files from').option('-c, --config-dir [dir-name]', 'Directory where to load Storybook configurations from').option('--dont-track', 'Do not send anonymous usage stats.').option('-d, --db-path [db-file]', 'DEPRECATED!').option('--enable-db', 'DEPRECATED!').parse(process.argv);
if (_commander2.default.enableDb || _commander2.default.dbPath) {
logger.error(['Error: the experimental local database addon is no longer bundled with', 'react-storybook. Please remove these flags (-d,--db-path,--enable-db)', 'from the command or npm script and try again.'].join(' '));
process.exit(1);
}
// The key is the field created in `program` variable for
// each command line argument. Value is the env variable.
@ -96,18 +97,9 @@ if (_commander2.default.staticDir) {
// custom `.babelrc` file and `webpack.config.js` files
var configDir = _commander2.default.configDir || './.storybook';
// The addon database service is disabled by default for now
// It should be enabled with the --enable-db for dev server
if (_commander2.default.enableDb) {
// NOTE enables database on client
process.env.STORYBOOK_ENABLE_DB = 1;
var dbPath = _commander2.default.dbPath || _path2.default.resolve(configDir, 'addon-db.json');
app.use('/db', (0, _middleware2.default)(dbPath));
}
// NOTE changes to env should be done before calling `getBaseConfig`
// `getBaseConfig` function which is called inside the middleware
app.use((0, _middleware4.default)(configDir));
app.use((0, _middleware2.default)(configDir));
app.listen.apply(app, listenAddr.concat([function (error) {
if (error) {