Skip to content

Commit

Permalink
Merge pull request #31 from storybooks/update-reactstorybook-repo
Browse files Browse the repository at this point in the history
Update reactstorybook repo
  • Loading branch information
ndelangen authored Apr 11, 2017
2 parents 531d2e5 + a7ef8d5 commit d284697
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
30 changes: 30 additions & 0 deletions packages/react-storybook/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,35 @@ We welcome your contributions. There are many ways you can help us. This is few

Before you submit a new PR, make you to run `npm test`. Do not submit a PR if tests are failing. If you need any help, create an issue and ask.

## Issue Triage

If you are looking for a way to help the project, triaging issues is a great place to start. Here's how you can help:

### Responding to issues

Issues that are tagged `question / support` or `needs reproduction` are great places to help. If you can answer a question, it will help the asker as well as anyone searching. If an issue needs reproduction, you may be able to guide the reporter toward one, or even reproduce it yourself using [this technique](https://github.com/storybooks/react-storybook/blob/master/CONTRIBUTING.md#reproductions).

### Triaging issues

Once you've helped out on a few issues, if you'd like triage access, you can help label issues, and respond to reporters. New issues should be labelled as one of `bug`, `new feature`, `question / support` or `discussion`.

If an issue is a `bug`, and it doesn't have a clear reproduction that you have personally confirmed, label it `needs reproduction` and ask the author to try and create a reproduction, or have a go yourself.

### Closing issues

- Duplicate issues should be closed with a link to the original.

- Unreproducible issues should be closed if it's not possible to reproduce them (if the reporter drops offline, it is reasonable to wait 2 weeks before closing).

- `bug`s should be closed when the issue is fixed and merged to `master`

- `new feature`s should be closed when merged or if the feature is deemed to be not appropriate.

- `question / support`s should be closed when the question has been answered. If the questioner drops offline, a reasonable period to wait is two weeks.

- `discussion`s should be closed at a maintainer's discretion.


## Development Guide

> If you want to work on a UI feature, refer to the [Storybook UI](https://github.com/kadirahq/storybook-ui) project.
Expand Down Expand Up @@ -95,3 +124,4 @@ npm link @kadira/storybook
### Getting Changes

After you've done any change, you need to run the `npm run storybook` command everytime to see those changes.

36 changes: 34 additions & 2 deletions packages/react-storybook/src/server/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node

import express from 'express';
import https from 'https';
import favicon from 'serve-favicon';
import program from 'commander';
import path from 'path';
Expand All @@ -23,6 +24,17 @@ program
.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(
'--https',
'Serve Storybook over HTTPS. Note: You must provide your own certificate information.'
)
.option(
'--ssl-ca <ca>',
'Provide an SSL certificate authority. (Optional with --https, required if using a self-signed certificate)',
parseList
)
.option('--ssl-cert <cert>', 'Provide an SSL certificate. (Required with --https)')
.option('--ssl-key <key>', 'Provide an SSL key. (Required with --https)')
.option('-d, --db-path [db-file]', 'DEPRECATED!')
.option('--enable-db', 'DEPRECATED!')
.parse(process.argv);
Expand Down Expand Up @@ -68,6 +80,26 @@ if (program.host) {
}

const app = express();
let server = app;

if (program.https) {
if (!program.sslCert) {
logger.error('Error: --ssl-cert is required with --https');
process.exit(-1);
}
if (!program.sslKey) {
logger.error('Error: --ssl-key is required with --https');
process.exit(-1);
}

const sslOptions = {
ca: (program.sslCa || []).map(ca => fs.readFileSync(ca, 'utf-8')),
cert: fs.readFileSync(program.sslCert, 'utf-8'),
key: fs.readFileSync(program.sslKey, 'utf-8')
};

server = https.createServer(sslOptions, app);
}

let hasCustomFavicon = false;

Expand Down Expand Up @@ -110,11 +142,11 @@ process.env.STORYBOOK_GIT_BRANCH = process.env.STORYBOOK_GIT_BRANCH ||
// `getBaseConfig` function which is called inside the middleware
app.use(storybook(configDir));

app.listen(...listenAddr, error => {
server.listen(...listenAddr, error => {
if (error) {
throw error;
} else {
const address = `http://${program.host || 'localhost'}:${program.port}/`;
const address = `http${program.https ? 's' : ''}://${program.host || 'localhost'}:${program.port}/`;
logger.info(`\nReact Storybook started on => ${chalk.cyan(address)}\n`);
track();
}
Expand Down

0 comments on commit d284697

Please sign in to comment.