diff --git a/.ci/danger/dangerfile.ts b/.ci/danger/dangerfile.ts deleted file mode 100644 index 8cfc4361d2..0000000000 --- a/.ci/danger/dangerfile.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { fail, danger } from 'danger'; -import { execSync } from 'child_process'; - -execSync('npm install lodash'); - -const { flatten, intersection, isEmpty } = require('lodash'); - -const pkg = require('../../package.json'); // eslint-disable-line import/newline-after-import -const prLogConfig = pkg['pr-log']; - -const Versions = { - PATCH: 'PATCH', - MINOR: 'MINOR', - MAJOR: 'MAJOR', -}; - -const branchVersion = Versions.MINOR; - -const checkRequiredLabels = (labels) => { - const forbiddenLabels = flatten([ - 'do not merge', - 'in progress', - branchVersion !== Versions.MAJOR ? 'BREAKING CHANGE' : [], - branchVersion === Versions.PATCH ? 'feature request' : [], - ]); - - const requiredLabels = flatten([ - prLogConfig.skipLabels || [], - (prLogConfig.validLabels || []).map((keyVal) => keyVal[0]), - ]); - - const blockingLabels = intersection(forbiddenLabels, labels); - if (!isEmpty(blockingLabels)) { - fail( - `PR is marked with ${blockingLabels.map((label) => `"${label}"`).join(', ')} label${ - blockingLabels.length > 1 ? 's' : '' - }.` - ); - } - - const foundLabels = intersection(requiredLabels, labels); - if (isEmpty(foundLabels)) { - fail(`PR is not labeled with one of: ${JSON.stringify(requiredLabels)}`); - } else if (foundLabels.length > 1) { - fail(`Please choose only one of these labels: ${JSON.stringify(foundLabels)}`); - } -}; - -if (prLogConfig) { - const { labels } = danger.github.issue; - checkRequiredLabels(labels.map((l) => l.name)); -} diff --git a/.circleci/config.yml b/.circleci/config.yml index 22f57c6de1..8ff80353da 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,25 +38,6 @@ jobs: - addons - app - native-smoke-tests: - <<: *defaults - steps: - - checkout - - attach_workspace: - at: . - - run: - name: Bootstrap - command: yarn bootstrap --core - - run: - name: Run React-Native-App example - command: | - cd examples/crna-kitchen-sink - yarn storybook --smoke-test - - run: - name: Publish React-Native-App example - command: | - ./scripts/crna-publish.js - lint: <<: *defaults steps: diff --git a/.eslintignore b/.eslintignore index 6615a08f85..6791c4fd40 100644 --- a/.eslintignore +++ b/.eslintignore @@ -18,11 +18,7 @@ built-storybooks !.eslintrc-markdown.js !.jest.config.js !.storybook -examples/native/e2e/init.ts -examples/native/ios -examples/native/android -examples/native/metro.config.js -examples/native/index.html +examples/expo-example/metro.config.js storybook.requires.js jest.config.js app/react-native/scripts/mocks diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8213f2367c..20d7f0704d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,7 +6,7 @@ Issue: Please explain how to test your changes and consider the following questions -- Does this need a new example in examples/native? +- Does this need a new example in examples/expo-example? - Does this need an update to the documentation? If your answer is yes to any of these, please make sure to include it in your PR. diff --git a/.github/autolabeler.yml b/.github/autolabeler.yml deleted file mode 100644 index d25102d84c..0000000000 --- a/.github/autolabeler.yml +++ /dev/null @@ -1,26 +0,0 @@ -'addon: a11y': ["addons/a11y/**"] -'addon: actions': ["addons/actions/**"] -'addon: backgrounds': ["addons/backgrounds/**"] -'addon: centered': ["addons/centered/**"] -'addon: events ': ["addons/events/**"] -'addon: graphql ': ["addons/graphql/**"] -'addon: info': ["addons/info/**"] -'addon: jest': ["addons/jest/**"] -'addon: knobs': ["addons/knobs/**"] -'addon: links': ["addons/links/**"] -'addon: notes': ["addons/notes/**"] -'addon: options': ["addons/options/**"] -'addon: storyshots': ["addons/storyshots/**"] -'addon: viewport': ["addons/viewport/**"] -'app: polymer ': ["app/polymer/**"] -'app: preact': ["app/preact/**"] -'app: rax': ["app/rax/**"] -'app: react-native': ["app/react-native/**"] -'app: react': ["app/react/**"] -'app: vue': ["app/vue/**"] -'app: mithril': ["app/mithril/**"] -'babel / webpack': ["webpack", "babel"] -'cli': ["lib/cli/**"] -'compatibility with other tools': [] -'documentation': ["docs", "*.md"] -'ui': ["lib/ui"] diff --git a/.github/workflows/detox.yml b/.github/workflows/detox.yml deleted file mode 100644 index eceb07a150..0000000000 --- a/.github/workflows/detox.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: E2E Detox tests - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - runs-on: macOS-latest - timeout-minutes: 60 - - env: - DEVELOPER_DIR: /Applications/Xcode_11.2.app - steps: - - uses: actions/checkout@master - - uses: actions/setup-node@master - - - name: Cache node modules - uses: actions/cache@v1 - id: cache - with: - path: node_modules - key: node-modules-${{ hashFiles('**/yarn.lock') }} - - - name: Install Dependencies - run: yarn install --network-timeout 600000 - - - name: Bootstrap - run: yarn bootstrap --core - - - name: Cache Pods - uses: actions/cache@v1 - id: podcache - with: - path: ./examples/native/ios/Pods - key: pods-${{ hashFiles('**/Podfile.lock') }} - - - name: Update Pods - working-directory: ./examples/native - run: | - gem update cocoapods xcodeproj - cd ios && pod install && cd .. - - - run: brew tap wix/brew - - run: brew install applesimutils - - - name: Detox build - working-directory: ./examples/native - run: yarn detox build --configuration ios.sim.release - - - name: Detox test - working-directory: ./examples/native - run: yarn detox test --configuration ios.sim.release --cleanup diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml deleted file mode 100644 index 1ad95fd643..0000000000 --- a/.github/workflows/label.yml +++ /dev/null @@ -1,14 +0,0 @@ -on: label -name: Dangerfile JS Label -jobs: - dangerJS: - name: Danger JS - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Danger JS - uses: danger/danger-js@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: --dangerfile .ci/danger/dangerfile.ts diff --git a/.gitignore b/.gitignore index 7cf11f60f4..07aa4008cf 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ junit.xml coverage/ *.lerna_backup build -packages/examples/automated-* /**/LICENSE docs/public packs/*.tgz @@ -23,7 +22,6 @@ package-lock.json storybook-static integration/__image_snapshots__/__diff_output__ .jest-test-results.json -/examples/cra-kitchen-sink/src/__image_snapshots__/__diff_output__/ lib/*.jar lib/**/dll .expo/packager-info.json diff --git a/.remarkignore b/.remarkignore index ca090b5695..83b694704b 100644 --- a/.remarkignore +++ b/.remarkignore @@ -1,2 +1 @@ -CHANGELOG.md -examples/native/ios \ No newline at end of file +CHANGELOG.md \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index fae4b9c9fb..0000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "launch", - "name": "official-storybook", - "runtimeExecutable": "npm", - "cwd": "${workspaceFolder}/examples/official-storybook", - "runtimeArgs": ["run-script", "debug"], - "port": 9229, - "skipFiles": ["/**"] - }, - { - "type": "node", - "request": "launch", - "name": "cli html", - "cwd": "${workspaceFolder}/lib/cli/stories", - "runtimeArgs": [ - "--inspect-brk", - "${workspaceFolder}/lib/cli/bin/index.js", - "init", - "--type", - "html" - ], - "port": 9229, - "skipFiles": ["/**"] - } - ] -} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c2d36ce3d1..470cd58507 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,7 +40,7 @@ cd react-native-storybook yarn bootstrap --core # make changes to try and reproduce the problem, such as adding components + stories -cd examples/native +cd examples/expo-example # for ios yarn ios # for android @@ -180,26 +180,19 @@ Once you have this running then you can run the example app to see your changes. ### Working with the example app -The `examples/native` folder of the repo has an example storybook implementation built with the react-native cli. It shows many of the options and add-ons available and is automatically linked to all the development packages. We highly encourage you to use it to develop/test contributions on. +The `examples/expo-example` folder of the repo has an example storybook implementation built with the react-native cli. It shows many of the options and add-ons available and is automatically linked to all the development packages. We highly encourage you to use it to develop/test contributions on. You still need to yarn dev or you won't see your changes reflected in the app. For example if I change an addon or app/react-native I need to rebuild the code for the changes take effect (yarn prepare) or `yarn dev` can do this automatically as I make changes. If this is your first time running react native from the cli follow the setup instructions in the [react native documentation](https://reactnative.dev/docs/environment-setup) to get everything setup correctly. ``` -cd examples/native +cd examples/expo-example -cd ios -pod install -cd .. - -# start Metro and leave it running on the background -yarn start - -# for ios, run in another terminal +# for ios yarn ios -# for android, run in another terminal +# for android yarn android ``` diff --git a/__mocks__/fileMock.js b/__mocks__/fileMock.js deleted file mode 100644 index 105ff49748..0000000000 --- a/__mocks__/fileMock.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'file-stub'; diff --git a/__mocks__/fs.js b/__mocks__/fs.js deleted file mode 100644 index aab768c3eb..0000000000 --- a/__mocks__/fs.js +++ /dev/null @@ -1,21 +0,0 @@ -const fs = jest.genMockFromModule('fs'); - -// This is a custom function that our tests can use during setup to specify -// what the files on the "mock" filesystem should look like when any of the -// `fs` APIs are used. -let mockFiles = Object.create(null); - -function __setMockFiles(newMockFiles) { - mockFiles = newMockFiles; -} - -// A custom version of `readdirSync` that reads from the special mocked out -// file list set via __setMockFiles -const readFileSync = (filePath = '') => mockFiles[filePath]; -const existsSync = (filePath) => !!mockFiles[filePath]; - -fs.__setMockFiles = __setMockFiles; -fs.readFileSync = readFileSync; -fs.existsSync = existsSync; - -module.exports = fs; diff --git a/__mocks__/htmlMock.js b/__mocks__/htmlMock.js deleted file mode 100644 index 0062fcfe19..0000000000 --- a/__mocks__/htmlMock.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = '

HTML Mock

'; diff --git a/__mocks__/inject-decorator.flow-stories.txt b/__mocks__/inject-decorator.flow-stories.txt deleted file mode 100644 index 2f3ab992a5..0000000000 --- a/__mocks__/inject-decorator.flow-stories.txt +++ /dev/null @@ -1,35 +0,0 @@ -// @flow -import React from 'react'; -import { storiesOf } from '@storybook/react'; -import { withInfo } from '@storybook/addon-info'; - -import TableComponent from '../components/TableComponent'; - -import type { JssClasses } from '../types'; - -type State = { - value: any, -}; - -type Props = { - classes: JssClasses, - name: string, -}; - -class Table extends React.Component { - constructor(props) { - super(props); - this.state = { - value: undefined, - }; - } - - state: State; - - render() { - return ; - } -} - -const stories = storiesOf('Table', module); -stories.add('Flow Class', withInfo('Lorum Ipsum Nem')(() => )); diff --git a/__mocks__/inject-decorator.no-stories.txt b/__mocks__/inject-decorator.no-stories.txt deleted file mode 100644 index f0124e6169..0000000000 --- a/__mocks__/inject-decorator.no-stories.txt +++ /dev/null @@ -1,3 +0,0 @@ -while(true) { - console.log("it's a kind of magic"); -} \ No newline at end of file diff --git a/__mocks__/inject-decorator.stories.txt b/__mocks__/inject-decorator.stories.txt deleted file mode 100644 index a8eb61d2f2..0000000000 --- a/__mocks__/inject-decorator.stories.txt +++ /dev/null @@ -1,153 +0,0 @@ -import React from 'react'; -import { storiesOf } from '@storybook/react'; -import { withInfo } from '@storybook/addon-info'; -import { action } from '@storybook/addon-actions'; - -import { DocgenButton } from '../components/DocgenButton'; -import FlowTypeButton from '../components/FlowTypeButton'; -import BaseButton from '../components/BaseButton'; -import TableComponent from '../components/TableComponent'; - -storiesOf('Addons|Info.React Docgen', module) - .add( - 'Comments from PropType declarations', - withInfo( - 'Comments above the PropType declarations should be extracted from the React component file itself and rendered in the Info Addon prop table' - )(() => ) - ) - .add( - 'Comments from Flow declarations', - withInfo( - 'Comments above the Flow declarations should be extracted from the React component file itself and rendered in the Info Addon prop table' - )(() => ) - ) - .add( - 'Comments from component declaration', - withInfo( - 'Comments above the component declaration should be extracted from the React component file itself and rendered below the Info Addon heading' - )(() => ) - ); - -const markdownDescription = ` -#### You can use markdown in your withInfo() description. - -Sometimes you might want to manually include some code examples: -~~~js -const Button = () =>