Skip to content

Commit

Permalink
feat: remove storybook in favor of custom sandbox (#243)
Browse files Browse the repository at this point in the history
* feat: remove storybook module and create a new entrypoint

* feat: first draft of the custom sandbox

* feat: convert all remaining stories to the sandbox

* chore: update eslint package

* chore: remove story generator

* refactor: create a sandbox wrapper

* test: update input snapshots
  • Loading branch information
tsyirvo authored Dec 4, 2021
1 parent 8052eb8 commit 892be69
Show file tree
Hide file tree
Showing 46 changed files with 947 additions and 5,249 deletions.
30 changes: 0 additions & 30 deletions _templates/generators/class/story.ejs.t

This file was deleted.

30 changes: 0 additions & 30 deletions _templates/generators/fc/story.ejs.t

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import 'react-native-gesture-handler';
import { AppRegistry } from 'react-native';

import { name as appName } from './app.json';
import Root from './App.tsx';
import Root from './src/App.tsx';

AppRegistry.registerComponent(appName, () => Root);
24 changes: 2 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
"tsc": "tsc",
"lint": "eslint ./ --ext .js,.ts,.tsx --fix --ignore-path .gitignore",
"prettify": "yarn prettier --write './**/*.{js,ts,tsx}'",
"prestorybook": "rnstl",
"storybook": "(adb reverse tcp:7007 tcp:7007 || true) && start-storybook",
"//// UTILITIES ////": "",
"image:add": "node scripts/images.js",
"generate:page": "npx hygen generators page",
Expand All @@ -61,6 +59,7 @@
},
"dependencies": {
"@react-native-masked-view/masked-view": "0.2.6",
"@react-navigation/core": "6.1.0",
"@react-navigation/native": "6.0.6",
"@react-navigation/stack": "6.0.11",
"i18n-js": "3.8.0",
Expand All @@ -82,14 +81,6 @@
"@babel/runtime": "7.16.3",
"@commitlint/cli": "15.0.0",
"@commitlint/config-conventional": "15.0.0",
"@storybook/addon-actions": "5.3.21",
"@storybook/addon-backgrounds": "5.3.21",
"@storybook/addon-knobs": "5.3.21",
"@storybook/addon-ondevice-actions": "5.3.23",
"@storybook/addon-ondevice-backgrounds": "5.3.23",
"@storybook/addon-ondevice-knobs": "5.3.25",
"@storybook/react-native": "5.3.25",
"@storybook/react-native-server": "5.3.23",
"@testing-library/jest-native": "4.0.4",
"@testing-library/react-native": "8.0.0",
"@types/i18n-js": "3.8.2",
Expand All @@ -108,7 +99,7 @@
"chalk": "4.1.2",
"detox": "19.1.0",
"eslint": "8.3.0",
"eslint-config-tsyirvo-react-native": "1.0.1",
"eslint-config-tsyirvo-react-native": "1.0.2",
"husky": "7.0.4",
"hygen": "6.1.0",
"imageoptim": "0.5.0",
Expand All @@ -123,7 +114,6 @@
"prettier": "2.5.0",
"react-dom": "17.0.1",
"react-native-dev-menu": "4.0.2",
"react-native-storybook-loader": "2.0.2",
"react-test-renderer": "17.0.2",
"sharp": "0.29.3",
"standard-version": "9.3.2",
Expand All @@ -140,16 +130,6 @@
"bash -c yarn prettify"
]
},
"config": {
"react-native-storybook-loader": {
"searchDir": [
"./src",
"./storybook"
],
"pattern": "**/*.stories.tsx",
"outputFile": "./storybook/storyLoader.js"
}
},
"jest": {
"cacheDirectory": ".jest/cache",
"moduleFileExtensions": [
Expand Down
21 changes: 11 additions & 10 deletions App.tsx → src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import {
import { enableScreens } from 'react-native-screens';
import { ThemeProvider } from 'styled-components';

import ErrorBoundary from './src/components/errorBoundary';
import { config, getDimensionRatio } from './src/core/constants';
import { initI18n } from './src/i18n/config';
import AppContainer from './src/routes/routes';
import theme from './src/styles/theme';
import StorybookProvider from './storybook/Storybook';
import ErrorBoundary from './components/errorBoundary';
import { config, getDimensionRatio } from './core/constants';
import { initI18n } from './i18n/config';
import AppContainer from './routes/routes';
import theme from './styles/theme';

import Sandbox from '$sandbox';

enableScreens();

Expand All @@ -25,11 +26,11 @@ const Root = () => (
<StatusBar barStyle="light-content" />

<ErrorBoundary>
<StorybookProvider>
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
<Sandbox>
<AppContainer />
</SafeAreaProvider>
</StorybookProvider>
</Sandbox>
</SafeAreaProvider>
</ErrorBoundary>
</ThemeProvider>
);
Expand Down
25 changes: 0 additions & 25 deletions src/components/shared/__stories__/FallbackLoader.stories.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/shared/primitives/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const STextInput = styled(TextInput)<{ error?: string }>`

const Input = forwardRef<TextInput, Props>(
({ label, error, editable = true, ...props }, ref) => (
<Box width="80%" mt="medium">
<Box width="80%">
{label && (
<Text color="black" mb="small" testID="input-label">
{label}
Expand Down
30 changes: 0 additions & 30 deletions src/components/shared/primitives/__stories__/Box.stories.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/components/shared/primitives/__stories__/Button.stories.tsx

This file was deleted.

43 changes: 0 additions & 43 deletions src/components/shared/primitives/__stories__/Input.stories.tsx

This file was deleted.

44 changes: 0 additions & 44 deletions src/components/shared/primitives/__stories__/Text.stories.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

exports[`Shared primitives Input component should render correctly 1`] = `
<View
mt="medium"
style={
Array [
Object {
"marginTop": 16,
"width": "80%",
},
]
Expand Down
2 changes: 0 additions & 2 deletions src/routes/routes.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */

import { StackNavigationProp } from '@react-navigation/stack';

/* ***** ***** Stack router types ***** ***** */
Expand Down
Loading

0 comments on commit 892be69

Please sign in to comment.