diff --git a/.travis.yml b/.travis.yml index 6865e1508a98..cb7172e2183c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ after_success: "./scripts/travis/after_success.sh" script: - npm run bootstrap - npm run bootstrap:test-cra -- npm run bootstrap:react-native-vanilla - npm run bootstrap:docs - npm run lint - npm run test -- --coverage diff --git a/app/react-native/src/bin/storybook-build.js b/app/react-native/src/bin/storybook-build.js old mode 100644 new mode 100755 diff --git a/app/react-native/src/bin/storybook-start.js b/app/react-native/src/bin/storybook-start.js old mode 100644 new mode 100755 diff --git a/app/react-native/src/bin/storybook.js b/app/react-native/src/bin/storybook.js old mode 100644 new mode 100755 diff --git a/app/react-native/src/manager/components/PreviewHelp.js b/app/react-native/src/manager/components/PreviewHelp.js index b3ce3c3b10dd..ee120853cbc8 100644 --- a/app/react-native/src/manager/components/PreviewHelp.js +++ b/app/react-native/src/manager/components/PreviewHelp.js @@ -60,7 +60,7 @@ const PreviewHelp = () => For react-native init apps:

-
npm run <platform>
+
react-native run-<platform>
; diff --git a/examples/cra-storybook/.gitignore b/examples/cra-kitchen-sink/.gitignore similarity index 100% rename from examples/cra-storybook/.gitignore rename to examples/cra-kitchen-sink/.gitignore diff --git a/examples/cra-storybook/.storybook/addons.js b/examples/cra-kitchen-sink/.storybook/addons.js similarity index 50% rename from examples/cra-storybook/.storybook/addons.js rename to examples/cra-kitchen-sink/.storybook/addons.js index 09eddda4c251..5c57d83ea6f9 100644 --- a/examples/cra-storybook/.storybook/addons.js +++ b/examples/cra-kitchen-sink/.storybook/addons.js @@ -1,3 +1,6 @@ import '@storybook/addon-actions/register'; import '@storybook/addon-links/register'; import '@storybook/addon-events/register'; +import '@storybook/addon-notes/register'; +import '@storybook/addon-options/register'; +import '@storybook/addon-knobs/register'; diff --git a/examples/cra-kitchen-sink/.storybook/config.js b/examples/cra-kitchen-sink/.storybook/config.js new file mode 100644 index 000000000000..8be5676c0061 --- /dev/null +++ b/examples/cra-kitchen-sink/.storybook/config.js @@ -0,0 +1,22 @@ +import { configure, setAddon } from '@storybook/react'; +import { setOptions } from '@storybook/addon-options'; +import infoAddon from '@storybook/addon-info'; + +setOptions({ + name: 'Test-CRA', + url: 'https://github.com/storybooks/storybook/tree/master/examples/test-cra', + goFullScreen: false, + showLeftPanel: true, + showDownPanel: true, + showSearchBox: false, + downPanelInRight: true, + sortStoriesByKind: false, +}) + +setAddon(infoAddon); + +function loadStories() { + require('../src/stories'); +} + +configure(loadStories, module); diff --git a/examples/cra-storybook/README.md b/examples/cra-kitchen-sink/README.md similarity index 100% rename from examples/cra-storybook/README.md rename to examples/cra-kitchen-sink/README.md diff --git a/examples/cra-storybook/package.json b/examples/cra-kitchen-sink/package.json similarity index 77% rename from examples/cra-storybook/package.json rename to examples/cra-kitchen-sink/package.json index 29ba51e8cbf3..a709db2e39fa 100644 --- a/examples/cra-storybook/package.json +++ b/examples/cra-kitchen-sink/package.json @@ -1,5 +1,5 @@ { - "name": "cra-storybook", + "name": "cra-kitchen-sink", "version": "1.0.0", "scripts": { "build": "react-scripts build", @@ -20,8 +20,13 @@ }, "devDependencies": { "@storybook/addon-actions": "^3.0.0", - "@storybook/addon-links": "^3.0.0", + "@storybook/addon-centered": "^3.0.0", "@storybook/addon-events": "^3.0.0", + "@storybook/addon-knobs": "^3.0.0", + "@storybook/addon-info": "^3.0.0", + "@storybook/addon-links": "^3.0.0", + "@storybook/addon-notes": "^3.0.0", + "@storybook/addon-options": "^3.0.0", "@storybook/addons": "^3.0.0", "@storybook/react": "^3.0.0", "react-scripts": "1.0.1" diff --git a/examples/cra-storybook/public/favicon.ico b/examples/cra-kitchen-sink/public/favicon.ico similarity index 100% rename from examples/cra-storybook/public/favicon.ico rename to examples/cra-kitchen-sink/public/favicon.ico diff --git a/examples/cra-storybook/public/index.html b/examples/cra-kitchen-sink/public/index.html similarity index 100% rename from examples/cra-storybook/public/index.html rename to examples/cra-kitchen-sink/public/index.html diff --git a/examples/cra-storybook/src/App.css b/examples/cra-kitchen-sink/src/App.css similarity index 100% rename from examples/cra-storybook/src/App.css rename to examples/cra-kitchen-sink/src/App.css diff --git a/examples/cra-storybook/src/App.js b/examples/cra-kitchen-sink/src/App.js similarity index 100% rename from examples/cra-storybook/src/App.js rename to examples/cra-kitchen-sink/src/App.js diff --git a/examples/cra-storybook/src/App.test.js b/examples/cra-kitchen-sink/src/App.test.js similarity index 100% rename from examples/cra-storybook/src/App.test.js rename to examples/cra-kitchen-sink/src/App.test.js diff --git a/examples/cra-storybook/src/base.css b/examples/cra-kitchen-sink/src/base.css similarity index 100% rename from examples/cra-storybook/src/base.css rename to examples/cra-kitchen-sink/src/base.css diff --git a/examples/cra-storybook/src/index.css b/examples/cra-kitchen-sink/src/index.css similarity index 100% rename from examples/cra-storybook/src/index.css rename to examples/cra-kitchen-sink/src/index.css diff --git a/examples/cra-storybook/src/index.js b/examples/cra-kitchen-sink/src/index.js similarity index 100% rename from examples/cra-storybook/src/index.js rename to examples/cra-kitchen-sink/src/index.js diff --git a/examples/cra-storybook/src/logo.svg b/examples/cra-kitchen-sink/src/logo.svg similarity index 100% rename from examples/cra-storybook/src/logo.svg rename to examples/cra-kitchen-sink/src/logo.svg diff --git a/examples/cra-storybook/src/stories/Button.js b/examples/cra-kitchen-sink/src/stories/Button.js similarity index 100% rename from examples/cra-storybook/src/stories/Button.js rename to examples/cra-kitchen-sink/src/stories/Button.js diff --git a/examples/cra-storybook/src/stories/Logger.js b/examples/cra-kitchen-sink/src/stories/Logger.js similarity index 100% rename from examples/cra-storybook/src/stories/Logger.js rename to examples/cra-kitchen-sink/src/stories/Logger.js diff --git a/examples/cra-storybook/src/stories/Welcome.js b/examples/cra-kitchen-sink/src/stories/Welcome.js similarity index 100% rename from examples/cra-storybook/src/stories/Welcome.js rename to examples/cra-kitchen-sink/src/stories/Welcome.js diff --git a/examples/cra-storybook/src/stories/index.js b/examples/cra-kitchen-sink/src/stories/index.js similarity index 69% rename from examples/cra-storybook/src/stories/index.js rename to examples/cra-kitchen-sink/src/stories/index.js index e6344a41bb90..a85dea1474bc 100644 --- a/examples/cra-storybook/src/stories/index.js +++ b/examples/cra-kitchen-sink/src/stories/index.js @@ -1,11 +1,13 @@ import React from 'react'; - import EventEmiter from 'eventemitter3'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; import WithEvents from '@storybook/addon-events'; +import { WithNotes } from '@storybook/addon-notes'; +import { withKnobs, text, number } from '@storybook/addon-knobs'; +import centered from '@storybook/addon-centered'; import Button from './Button'; import Welcome from './Welcome'; @@ -25,12 +27,30 @@ const emit = emiter.emit.bind(emiter); storiesOf('Welcome', module).add('to Storybook', () => ); storiesOf('Button', module) + .addDecorator(withKnobs) .add('with text', () => ) - .add('with some emoji', () => ); + .add('with some emoji', () => ) + .add('with notes', () => + + + + ) + .add('with knobs', () => { + const label = text('Label', 'Edit me in knobs panel'); + const num = number('Number', 1); + const content = `I am ${label} and I'm ${num} years old.`; + + return ; + }) + .addWithInfo('with some info', 'Use the info addon with its painful API.', () => + + ); + +storiesOf('App', module).add('full app', () => ); -storiesOf('App', module) - .add('with text', () => ) - .add('with some emoji', () => ); +storiesOf('Centered Button', module) + .addDecorator(centered) + .add('with text', () => ); storiesOf('WithEvents', module) .addDecorator(getStory => diff --git a/examples/cra-storybook/.storybook/config.js b/examples/cra-storybook/.storybook/config.js deleted file mode 100644 index 35430210ce65..000000000000 --- a/examples/cra-storybook/.storybook/config.js +++ /dev/null @@ -1,7 +0,0 @@ -import { configure } from '@storybook/react'; - -function loadStories() { - require('../src/stories'); -} - -configure(loadStories, module); diff --git a/examples/package.json b/examples/package.json index f11f22222c4e..53327ed10c59 100644 --- a/examples/package.json +++ b/examples/package.json @@ -4,7 +4,7 @@ "description": "A set of examples of how to use storybook, also used for regression testing", "main": "index.js", "scripts": { - "test:automated-cra-storybook": "node scripts/automated-cra-storybook.js" + "test:automated-cra-getstorybook": "node scripts/automated-cra-getstorybook.js" }, "license": "ISC", "dependencies": { diff --git a/examples/react-native-vanilla/.babelrc b/examples/react-native-getstorybook/.babelrc similarity index 100% rename from examples/react-native-vanilla/.babelrc rename to examples/react-native-getstorybook/.babelrc diff --git a/examples/react-native-vanilla/.buckconfig b/examples/react-native-getstorybook/.buckconfig similarity index 100% rename from examples/react-native-vanilla/.buckconfig rename to examples/react-native-getstorybook/.buckconfig diff --git a/examples/react-native-vanilla/.flowconfig b/examples/react-native-getstorybook/.flowconfig similarity index 100% rename from examples/react-native-vanilla/.flowconfig rename to examples/react-native-getstorybook/.flowconfig diff --git a/examples/react-native-vanilla/.gitattributes b/examples/react-native-getstorybook/.gitattributes similarity index 100% rename from examples/react-native-vanilla/.gitattributes rename to examples/react-native-getstorybook/.gitattributes diff --git a/examples/react-native-vanilla/.gitignore b/examples/react-native-getstorybook/.gitignore similarity index 100% rename from examples/react-native-vanilla/.gitignore rename to examples/react-native-getstorybook/.gitignore diff --git a/examples/react-native-vanilla/.watchmanconfig b/examples/react-native-getstorybook/.watchmanconfig similarity index 100% rename from examples/react-native-vanilla/.watchmanconfig rename to examples/react-native-getstorybook/.watchmanconfig diff --git a/examples/react-native-vanilla/__tests__/__snapshots__/storyshots.js.snap b/examples/react-native-getstorybook/__tests__/__snapshots__/storyshots.js.snap similarity index 100% rename from examples/react-native-vanilla/__tests__/__snapshots__/storyshots.js.snap rename to examples/react-native-getstorybook/__tests__/__snapshots__/storyshots.js.snap diff --git a/examples/react-native-vanilla/__tests__/index.android.js b/examples/react-native-getstorybook/__tests__/index.android.js similarity index 100% rename from examples/react-native-vanilla/__tests__/index.android.js rename to examples/react-native-getstorybook/__tests__/index.android.js diff --git a/examples/react-native-vanilla/__tests__/index.ios.js b/examples/react-native-getstorybook/__tests__/index.ios.js similarity index 100% rename from examples/react-native-vanilla/__tests__/index.ios.js rename to examples/react-native-getstorybook/__tests__/index.ios.js diff --git a/examples/react-native-vanilla/__tests__/storyshots.js b/examples/react-native-getstorybook/__tests__/storyshots.js similarity index 100% rename from examples/react-native-vanilla/__tests__/storyshots.js rename to examples/react-native-getstorybook/__tests__/storyshots.js diff --git a/examples/react-native-vanilla/android/app/BUCK b/examples/react-native-getstorybook/android/app/BUCK similarity index 100% rename from examples/react-native-vanilla/android/app/BUCK rename to examples/react-native-getstorybook/android/app/BUCK diff --git a/examples/react-native-vanilla/android/app/build.gradle b/examples/react-native-getstorybook/android/app/build.gradle similarity index 100% rename from examples/react-native-vanilla/android/app/build.gradle rename to examples/react-native-getstorybook/android/app/build.gradle diff --git a/examples/react-native-vanilla/android/app/proguard-rules.pro b/examples/react-native-getstorybook/android/app/proguard-rules.pro similarity index 100% rename from examples/react-native-vanilla/android/app/proguard-rules.pro rename to examples/react-native-getstorybook/android/app/proguard-rules.pro diff --git a/examples/react-native-vanilla/android/app/src/main/AndroidManifest.xml b/examples/react-native-getstorybook/android/app/src/main/AndroidManifest.xml similarity index 100% rename from examples/react-native-vanilla/android/app/src/main/AndroidManifest.xml rename to examples/react-native-getstorybook/android/app/src/main/AndroidManifest.xml diff --git a/examples/react-native-vanilla/android/app/src/main/java/com/reactnativevanilla/MainActivity.java b/examples/react-native-getstorybook/android/app/src/main/java/com/reactnativevanilla/MainActivity.java similarity index 100% rename from examples/react-native-vanilla/android/app/src/main/java/com/reactnativevanilla/MainActivity.java rename to examples/react-native-getstorybook/android/app/src/main/java/com/reactnativevanilla/MainActivity.java diff --git a/examples/react-native-vanilla/android/app/src/main/java/com/reactnativevanilla/MainApplication.java b/examples/react-native-getstorybook/android/app/src/main/java/com/reactnativevanilla/MainApplication.java similarity index 100% rename from examples/react-native-vanilla/android/app/src/main/java/com/reactnativevanilla/MainApplication.java rename to examples/react-native-getstorybook/android/app/src/main/java/com/reactnativevanilla/MainApplication.java diff --git a/examples/react-native-vanilla/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/examples/react-native-getstorybook/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from examples/react-native-vanilla/android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to examples/react-native-getstorybook/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/examples/react-native-vanilla/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/examples/react-native-getstorybook/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from examples/react-native-vanilla/android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to examples/react-native-getstorybook/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/examples/react-native-vanilla/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/examples/react-native-getstorybook/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from examples/react-native-vanilla/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to examples/react-native-getstorybook/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/examples/react-native-vanilla/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/examples/react-native-getstorybook/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from examples/react-native-vanilla/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to examples/react-native-getstorybook/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/examples/react-native-vanilla/android/app/src/main/res/values/strings.xml b/examples/react-native-getstorybook/android/app/src/main/res/values/strings.xml similarity index 100% rename from examples/react-native-vanilla/android/app/src/main/res/values/strings.xml rename to examples/react-native-getstorybook/android/app/src/main/res/values/strings.xml diff --git a/examples/react-native-vanilla/android/app/src/main/res/values/styles.xml b/examples/react-native-getstorybook/android/app/src/main/res/values/styles.xml similarity index 100% rename from examples/react-native-vanilla/android/app/src/main/res/values/styles.xml rename to examples/react-native-getstorybook/android/app/src/main/res/values/styles.xml diff --git a/examples/react-native-vanilla/android/build.gradle b/examples/react-native-getstorybook/android/build.gradle similarity index 100% rename from examples/react-native-vanilla/android/build.gradle rename to examples/react-native-getstorybook/android/build.gradle diff --git a/examples/react-native-vanilla/android/gradle.properties b/examples/react-native-getstorybook/android/gradle.properties similarity index 100% rename from examples/react-native-vanilla/android/gradle.properties rename to examples/react-native-getstorybook/android/gradle.properties diff --git a/examples/react-native-vanilla/android/gradle/wrapper/gradle-wrapper.jar b/examples/react-native-getstorybook/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from examples/react-native-vanilla/android/gradle/wrapper/gradle-wrapper.jar rename to examples/react-native-getstorybook/android/gradle/wrapper/gradle-wrapper.jar diff --git a/examples/react-native-vanilla/android/gradle/wrapper/gradle-wrapper.properties b/examples/react-native-getstorybook/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from examples/react-native-vanilla/android/gradle/wrapper/gradle-wrapper.properties rename to examples/react-native-getstorybook/android/gradle/wrapper/gradle-wrapper.properties diff --git a/examples/react-native-vanilla/android/gradlew b/examples/react-native-getstorybook/android/gradlew similarity index 100% rename from examples/react-native-vanilla/android/gradlew rename to examples/react-native-getstorybook/android/gradlew diff --git a/examples/react-native-vanilla/android/gradlew.bat b/examples/react-native-getstorybook/android/gradlew.bat similarity index 100% rename from examples/react-native-vanilla/android/gradlew.bat rename to examples/react-native-getstorybook/android/gradlew.bat diff --git a/examples/react-native-vanilla/android/keystores/BUCK b/examples/react-native-getstorybook/android/keystores/BUCK similarity index 100% rename from examples/react-native-vanilla/android/keystores/BUCK rename to examples/react-native-getstorybook/android/keystores/BUCK diff --git a/examples/react-native-vanilla/android/keystores/debug.keystore.properties b/examples/react-native-getstorybook/android/keystores/debug.keystore.properties similarity index 100% rename from examples/react-native-vanilla/android/keystores/debug.keystore.properties rename to examples/react-native-getstorybook/android/keystores/debug.keystore.properties diff --git a/examples/react-native-vanilla/android/settings.gradle b/examples/react-native-getstorybook/android/settings.gradle similarity index 100% rename from examples/react-native-vanilla/android/settings.gradle rename to examples/react-native-getstorybook/android/settings.gradle diff --git a/examples/react-native-vanilla/app.json b/examples/react-native-getstorybook/app.json similarity index 100% rename from examples/react-native-vanilla/app.json rename to examples/react-native-getstorybook/app.json diff --git a/examples/react-native-vanilla/index.android.js b/examples/react-native-getstorybook/index.android.js similarity index 100% rename from examples/react-native-vanilla/index.android.js rename to examples/react-native-getstorybook/index.android.js diff --git a/examples/react-native-vanilla/index.ios.js b/examples/react-native-getstorybook/index.ios.js similarity index 100% rename from examples/react-native-vanilla/index.ios.js rename to examples/react-native-getstorybook/index.ios.js diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla-tvOS/Info.plist b/examples/react-native-getstorybook/ios/ReactNativeVanilla-tvOS/Info.plist similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla-tvOS/Info.plist rename to examples/react-native-getstorybook/ios/ReactNativeVanilla-tvOS/Info.plist diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla-tvOSTests/Info.plist b/examples/react-native-getstorybook/ios/ReactNativeVanilla-tvOSTests/Info.plist similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla-tvOSTests/Info.plist rename to examples/react-native-getstorybook/ios/ReactNativeVanilla-tvOSTests/Info.plist diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla.xcodeproj/project.pbxproj b/examples/react-native-getstorybook/ios/ReactNativeVanilla.xcodeproj/project.pbxproj similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla.xcodeproj/project.pbxproj rename to examples/react-native-getstorybook/ios/ReactNativeVanilla.xcodeproj/project.pbxproj diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla.xcodeproj/xcshareddata/xcschemes/ReactNativeVanilla-tvOS.xcscheme b/examples/react-native-getstorybook/ios/ReactNativeVanilla.xcodeproj/xcshareddata/xcschemes/ReactNativeVanilla-tvOS.xcscheme similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla.xcodeproj/xcshareddata/xcschemes/ReactNativeVanilla-tvOS.xcscheme rename to examples/react-native-getstorybook/ios/ReactNativeVanilla.xcodeproj/xcshareddata/xcschemes/ReactNativeVanilla-tvOS.xcscheme diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla.xcodeproj/xcshareddata/xcschemes/ReactNativeVanilla.xcscheme b/examples/react-native-getstorybook/ios/ReactNativeVanilla.xcodeproj/xcshareddata/xcschemes/ReactNativeVanilla.xcscheme similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla.xcodeproj/xcshareddata/xcschemes/ReactNativeVanilla.xcscheme rename to examples/react-native-getstorybook/ios/ReactNativeVanilla.xcodeproj/xcshareddata/xcschemes/ReactNativeVanilla.xcscheme diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla/AppDelegate.h b/examples/react-native-getstorybook/ios/ReactNativeVanilla/AppDelegate.h similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla/AppDelegate.h rename to examples/react-native-getstorybook/ios/ReactNativeVanilla/AppDelegate.h diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla/AppDelegate.m b/examples/react-native-getstorybook/ios/ReactNativeVanilla/AppDelegate.m similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla/AppDelegate.m rename to examples/react-native-getstorybook/ios/ReactNativeVanilla/AppDelegate.m diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla/Base.lproj/LaunchScreen.xib b/examples/react-native-getstorybook/ios/ReactNativeVanilla/Base.lproj/LaunchScreen.xib similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla/Base.lproj/LaunchScreen.xib rename to examples/react-native-getstorybook/ios/ReactNativeVanilla/Base.lproj/LaunchScreen.xib diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/react-native-getstorybook/ios/ReactNativeVanilla/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla/Images.xcassets/AppIcon.appiconset/Contents.json rename to examples/react-native-getstorybook/ios/ReactNativeVanilla/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla/Info.plist b/examples/react-native-getstorybook/ios/ReactNativeVanilla/Info.plist similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla/Info.plist rename to examples/react-native-getstorybook/ios/ReactNativeVanilla/Info.plist diff --git a/examples/react-native-vanilla/ios/ReactNativeVanilla/main.m b/examples/react-native-getstorybook/ios/ReactNativeVanilla/main.m similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanilla/main.m rename to examples/react-native-getstorybook/ios/ReactNativeVanilla/main.m diff --git a/examples/react-native-vanilla/ios/ReactNativeVanillaTests/Info.plist b/examples/react-native-getstorybook/ios/ReactNativeVanillaTests/Info.plist similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanillaTests/Info.plist rename to examples/react-native-getstorybook/ios/ReactNativeVanillaTests/Info.plist diff --git a/examples/react-native-vanilla/ios/ReactNativeVanillaTests/ReactNativeVanillaTests.m b/examples/react-native-getstorybook/ios/ReactNativeVanillaTests/ReactNativeVanillaTests.m similarity index 100% rename from examples/react-native-vanilla/ios/ReactNativeVanillaTests/ReactNativeVanillaTests.m rename to examples/react-native-getstorybook/ios/ReactNativeVanillaTests/ReactNativeVanillaTests.m diff --git a/examples/react-native-vanilla/jest.config.js b/examples/react-native-getstorybook/jest.config.js similarity index 100% rename from examples/react-native-vanilla/jest.config.js rename to examples/react-native-getstorybook/jest.config.js diff --git a/examples/react-native-getstorybook/package.json b/examples/react-native-getstorybook/package.json new file mode 100644 index 000000000000..4dfbc750db96 --- /dev/null +++ b/examples/react-native-getstorybook/package.json @@ -0,0 +1,27 @@ +{ + "name": "react-native-getstorybook", + "version": "0.0.1", + "private": true, + "scripts": { + "start": "node node_modules/react-native/local-cli/cli.js start", + "test": "jest", + "storybook": "storybook start -p 7007" + }, + "dependencies": { + "react": "16.0.0-alpha.6", + "react-native": "0.44.1" + }, + "devDependencies": { + "@storybook/addon-actions": "*", + "@storybook/addon-links": "*", + "@storybook/addon-options": "*", + "@storybook/addon-storyshots": "*", + "@storybook/addons": "*", + "@storybook/channels": "*", + "@storybook/react-native": "*", + "babel-jest": "20.0.3", + "babel-preset-react-native": "1.9.2", + "jest": "20.0.4", + "react-dom": "^15.5.4" + } +} diff --git a/examples/react-native-vanilla/storybook/addons.js b/examples/react-native-getstorybook/storybook/addons.js similarity index 100% rename from examples/react-native-vanilla/storybook/addons.js rename to examples/react-native-getstorybook/storybook/addons.js diff --git a/examples/react-native-vanilla/storybook/index.android.js b/examples/react-native-getstorybook/storybook/index.android.js similarity index 100% rename from examples/react-native-vanilla/storybook/index.android.js rename to examples/react-native-getstorybook/storybook/index.android.js diff --git a/examples/react-native-vanilla/storybook/index.ios.js b/examples/react-native-getstorybook/storybook/index.ios.js similarity index 100% rename from examples/react-native-vanilla/storybook/index.ios.js rename to examples/react-native-getstorybook/storybook/index.ios.js diff --git a/examples/react-native-vanilla/storybook/stories/Button/index.android.js b/examples/react-native-getstorybook/storybook/stories/Button/index.android.js similarity index 100% rename from examples/react-native-vanilla/storybook/stories/Button/index.android.js rename to examples/react-native-getstorybook/storybook/stories/Button/index.android.js diff --git a/examples/react-native-vanilla/storybook/stories/Button/index.ios.js b/examples/react-native-getstorybook/storybook/stories/Button/index.ios.js similarity index 100% rename from examples/react-native-vanilla/storybook/stories/Button/index.ios.js rename to examples/react-native-getstorybook/storybook/stories/Button/index.ios.js diff --git a/examples/react-native-vanilla/storybook/stories/CenterView/index.js b/examples/react-native-getstorybook/storybook/stories/CenterView/index.js similarity index 100% rename from examples/react-native-vanilla/storybook/stories/CenterView/index.js rename to examples/react-native-getstorybook/storybook/stories/CenterView/index.js diff --git a/examples/react-native-vanilla/storybook/stories/CenterView/style.js b/examples/react-native-getstorybook/storybook/stories/CenterView/style.js similarity index 100% rename from examples/react-native-vanilla/storybook/stories/CenterView/style.js rename to examples/react-native-getstorybook/storybook/stories/CenterView/style.js diff --git a/examples/react-native-vanilla/storybook/stories/Welcome/index.js b/examples/react-native-getstorybook/storybook/stories/Welcome/index.js similarity index 100% rename from examples/react-native-vanilla/storybook/stories/Welcome/index.js rename to examples/react-native-getstorybook/storybook/stories/Welcome/index.js diff --git a/examples/react-native-vanilla/storybook/stories/index.js b/examples/react-native-getstorybook/storybook/stories/index.js similarity index 100% rename from examples/react-native-vanilla/storybook/stories/index.js rename to examples/react-native-getstorybook/storybook/stories/index.js diff --git a/examples/react-native-vanilla/storybook/storybook.js b/examples/react-native-getstorybook/storybook/storybook.js similarity index 100% rename from examples/react-native-vanilla/storybook/storybook.js rename to examples/react-native-getstorybook/storybook/storybook.js diff --git a/examples/react-native-vanilla/package.json b/examples/react-native-vanilla/package.json deleted file mode 100644 index 643f02744594..000000000000 --- a/examples/react-native-vanilla/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "react-native-vanilla", - "version": "0.0.1", - "private": true, - "scripts": { - "start": "node node_modules/react-native/local-cli/cli.js start", - "test": "jest", - "storybook": "storybook start -p 7007" - }, - "dependencies": { - "react": "16.0.0-alpha.6", - "react-native": "0.44.1" - }, - "devDependencies": { - "babel-jest": "20.0.3", - "babel-preset-react-native": "1.9.2", - "jest": "20.0.4", - "react-test-renderer": "16.0.0-alpha.6", - "@storybook/addon-actions": "file:../../addons/actions", - "@storybook/addon-links": "file:../../addons/links", - "@storybook/addon-options": "file:../../addons/options", - "@storybook/addon-storyshots": "file:../../addons/storyshots", - "@storybook/addons": "file:../../lib/addons", - "@storybook/channels": "file:../../lib/channels", - "@storybook/channel-postmessage": "file:../../lib/channel-postmessage", - "@storybook/react-native": "file:../../app/react-native", - "@storybook/ui": "file:../../lib/ui", - "react-dom": "^15.5.4" - } -} diff --git a/examples/scripts/automated-cra-storybook.js b/examples/scripts/automated-cra-storybook.js index 9b0bfa06c0a7..5f850160239e 100755 --- a/examples/scripts/automated-cra-storybook.js +++ b/examples/scripts/automated-cra-storybook.js @@ -6,7 +6,7 @@ const { exec } = require('child-process-promise'); const rimraf = require('rimraf'); -const targetFolder = 'automated-cra-storybook'; +const targetFolder = 'automated-cra-getstorybook'; const cleanDir = () => new Promise(resolve => rimraf(`./${targetFolder}`, resolve)); diff --git a/examples/test-cra/.storybook/addons.js b/examples/test-cra/.storybook/addons.js index 6aed412d04af..d4b660893001 100644 --- a/examples/test-cra/.storybook/addons.js +++ b/examples/test-cra/.storybook/addons.js @@ -1,2 +1,5 @@ import '@storybook/addon-actions/register'; import '@storybook/addon-links/register'; +import '@storybook/addon-notes/register'; +import '@storybook/addon-options/register'; +import '@storybook/addon-knobs/register'; diff --git a/examples/test-cra/.storybook/config.js b/examples/test-cra/.storybook/config.js index 35430210ce65..8be5676c0061 100644 --- a/examples/test-cra/.storybook/config.js +++ b/examples/test-cra/.storybook/config.js @@ -1,4 +1,19 @@ -import { configure } from '@storybook/react'; +import { configure, setAddon } from '@storybook/react'; +import { setOptions } from '@storybook/addon-options'; +import infoAddon from '@storybook/addon-info'; + +setOptions({ + name: 'Test-CRA', + url: 'https://github.com/storybooks/storybook/tree/master/examples/test-cra', + goFullScreen: false, + showLeftPanel: true, + showDownPanel: true, + showSearchBox: false, + downPanelInRight: true, + sortStoriesByKind: false, +}) + +setAddon(infoAddon); function loadStories() { require('../src/stories'); diff --git a/examples/test-cra/package.json b/examples/test-cra/package.json index a26cae7fe97a..db7c38ab4410 100644 --- a/examples/test-cra/package.json +++ b/examples/test-cra/package.json @@ -18,7 +18,12 @@ }, "devDependencies": { "@storybook/addon-actions": "file:../../addons/actions", + "@storybook/addon-centered": "file:../../addons/centered", + "@storybook/addon-info": "file:../../addons/info", + "@storybook/addon-knobs": "file:../../addons/knobs", "@storybook/addon-links": "file:../../addons/links", + "@storybook/addon-notes": "file:../../addons/notes", + "@storybook/addon-options": "file:../../addons/options", "@storybook/addon-storyshots": "file:../../addons/storyshots", "@storybook/addons": "file:../../lib/addons", "@storybook/channel-postmessage": "file:../../lib/channel-postmessage", diff --git a/examples/test-cra/src/stories/index.js b/examples/test-cra/src/stories/index.js index e72f193c5e53..5d51d41f7eb6 100644 --- a/examples/test-cra/src/stories/index.js +++ b/examples/test-cra/src/stories/index.js @@ -5,6 +5,9 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; +import { WithNotes } from '@storybook/addon-notes'; +import { withKnobs, text, number } from '@storybook/addon-knobs'; +import centered from '@storybook/addon-centered'; import Button from './Button'; import Welcome from './Welcome'; @@ -13,7 +16,25 @@ import ComponentWithRef from './ComponentWithRef'; storiesOf('Welcome', module).add('to Storybook', () => ); storiesOf('Button', module) + .addDecorator(withKnobs) .add('with text', () => ) - .add('with some emoji', () => ); + .add('with some emoji', () => ) + .add('with notes', () => + + + + ) + .add('with knobs', () => { + const label = text('Label', 'Edit me in knobs panel'); + const num = number('Number', 1); + return ; + }) + .addWithInfo('with some info', 'Use the info addon with its painful API.', () => + + ); + +storiesOf('Centered Button', module) + .addDecorator(centered) + .add('with text', () => ); storiesOf('ComponentWithRef', module).add('basic', () => ); diff --git a/jest.config.js b/jest.config.js index 12054792ad60..e725e9f2c386 100644 --- a/jest.config.js +++ b/jest.config.js @@ -10,11 +10,11 @@ module.exports = { '/addons', '/app', '/lib', - '/examples/cra-storybook', + '/examples/cra-kitchen-sink', '/examples/test-cra', ], testPathIgnorePatterns: ['/node_modules/'], - projects: ['./', './examples/react-native-vanilla'], + projects: ['./', './examples/react-native-getstorybook'], collectCoverage: false, collectCoverageFrom: [ 'app/**/*.{js,jsx}', diff --git a/lerna.json b/lerna.json index b7844d88287d..5a2dd9a3af1a 100644 --- a/lerna.json +++ b/lerna.json @@ -3,15 +3,14 @@ "commands": { "bootstrap": { "ignore": [ - "test-cra", - "react-native-vanilla" + "test-cra" ] }, "publish": { "ignore": [ - "cra-storybook", + "cra-kitchen-sink", "test-cra", - "react-native-vanilla" + "react-native-getstorybook" ] } }, diff --git a/package.json b/package.json index 483abd531e04..e17a0af42717 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "bootstrap": "lerna bootstrap", "bootstrap:docs": "cd docs && npm i", "bootstrap:test-cra": "lerna exec --scope test-cra -- npm i", - "bootstrap:react-native-vanilla": "lerna exec --scope react-native-vanilla -- npm i", "changelog": "pr-log --sloppy", "precommit": "lint-staged", "coverage": "codecov", @@ -23,7 +22,7 @@ "lint:js": "eslint . --cache --cache-location=.cache/eslint --ext .js,.jsx,.json", "lint:md": "remark .", "publish": "lerna publish", - "test": "jest --projects ./ ./examples/react-native-vanilla" + "test": "jest --projects ./ ./examples/react-native-getstorybook" }, "devDependencies": { "babel-cli": "^6.24.1",