Skip to content

Commit

Permalink
build(deps): remove storybook (#9792)
Browse files Browse the repository at this point in the history
* build(deps): remove storybook

* chore: remove storybook leftovers
  • Loading branch information
gkartalis authored Feb 9, 2024
1 parent fdf3b12 commit 4dfadba
Show file tree
Hide file tree
Showing 37 changed files with 49 additions and 2,440 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
src/__generated__/*
src/storybook/storybook.requires.js
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ data/complete.queryMap.json
data/PreHeatedGraphQLCache/*.json
node_modules
package.json
src/storybook/storybook.requires.js
2 changes: 1 addition & 1 deletion alias.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const list = ["app", "palette", "shared", "storybook", "__generated__"]
const list = ["app", "palette", "shared", "__generated__"]

// babel module resolver just needs `*`
const babelModuleResolverAlias = list.reduce((acc, name) => {
Expand Down
1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
- [Developing features using local @artsy/palette-mobile](developing_local_palette.md)

- [Images handling](images.md)
- [Storybook](storybook.md)
- [Converting an image to webp](convert_image.md)

- [Metaflags](metaflags.md)
Expand Down
5 changes: 0 additions & 5 deletions docs/best_practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ _Please note: Links should point to specific commits, and not a branch (in case
- [index.ts files](#indexts-files)
- [When committing code](#when-committing-code)
- [Frontend](#frontend)
- [Storybook](#storybook)
- [Styling](#styling)
- [TypeScript](#typescript)
- [Fetching data](#fetching-data)
Expand Down Expand Up @@ -111,10 +110,6 @@ We try to avoid the use of `index.ts` files to prevent noise in the file structu

### Frontend

#### Storybook

When developing new components you are strongly encouraged to add them to [Storybook](./storybook.md).

#### Styling

[@artsy/palette-mobile](https://github.com/artsy/palette-mobile) is our reusable component toolkit, which uses [styled-system](https://styled-system.com/getting-started/) under the hood.
Expand Down
6 changes: 0 additions & 6 deletions docs/metaflags.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ In `metaflags.example.json` we should always have the values of the flags that t

## Available metaflags

### Storybook

One example, and the first usage of the metaflags, is the `startStorybook` metaflag.
When running the app using `yarn start`, the app starts normally. When running the app using `STORYBOOK=1 yarn start`, the app starts with the storybook ui directly.
By adding the `STORYBOOK=1` part in the command, the value in `metaflags.json` will turn to `true` (this happens with some scripts, look at `prestart` in `package.json`, but this is an implementation detail. Others flags might not need this.) Once the flag is turned to `true`, reading it in the app is easy, just a `require("metaflags")` call and here we go. For the storybook flag, this is happening on `index.ios.js` and `index.android.js` files.

### Hide loggers

You can turn off various loggers by setting the according values to false on `metaflags.json`
Expand Down
55 changes: 0 additions & 55 deletions docs/storybook.md

This file was deleted.

20 changes: 6 additions & 14 deletions index-common.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
global.__TEST__ = false
global.__STORYBOOK__ = false

// for more info about metaflags, look [here](/docs/metaflags.md)
let metaflags = {
startStorybook: false,
}
let metaflags = {}

if (__DEV__) {
const {
Expand All @@ -22,14 +19,9 @@ if (__DEV__) {

require("./src/app/system/errorReporting/sentrySetup").setupSentry({ environment: "bootstrap" })
import "react-native-url-polyfill/auto"
const { AppRegistry } = require("react-native")

if (metaflags.startStorybook) {
global.__STORYBOOK__ = true
require("./src/app/storybook")
} else {
const appName = require("./app.json").appName
require("react-native-gesture-handler")
const { AppRegistry } = require("react-native")
const { App } = require("./src/app/App")
AppRegistry.registerComponent(appName, () => App)
}
const appName = require("./app.json").appName
require("react-native-gesture-handler")
const { App } = require("./src/app/App")
AppRegistry.registerComponent(appName, () => App)
6 changes: 0 additions & 6 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,6 @@ PODS:
- react-native-shake (5.5.2):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- react-native-slider (4.2.4):
- React-Core
- react-native-view-shot (3.4.0):
- React-Core
- react-native-webview (13.6.2):
Expand Down Expand Up @@ -961,7 +959,6 @@ DEPENDENCIES:
- react-native-render-html (from `../node_modules/react-native-render-html`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-shake (from `../node_modules/react-native-shake`)
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
- react-native-view-shot (from `../node_modules/react-native-view-shot`)
- react-native-webview (from `../node_modules/react-native-webview`)
- React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
Expand Down Expand Up @@ -1192,8 +1189,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-safe-area-context"
react-native-shake:
:path: "../node_modules/react-native-shake"
react-native-slider:
:path: "../node_modules/@react-native-community/slider"
react-native-view-shot:
:path: "../node_modules/react-native-view-shot"
react-native-webview:
Expand Down Expand Up @@ -1404,7 +1399,6 @@ SPEC CHECKSUMS:
react-native-render-html: 984dfe2294163d04bf5fe25d7c9f122e60e05ebe
react-native-safe-area-context: f4f7cc09d81ae2d39dfd13e764d718969af07080
react-native-shake: 8036ba95a1953c9b10821bdc33f5814c5d0bcef6
react-native-slider: cecabb58ecffad671d2ad3ccc58c7f4d2d029e95
react-native-view-shot: a60a98a18c72bcaaaf2138f9aab960ae9b0d96c7
react-native-webview: 8fc09f66a1a5b16bbe37c3878fda27d5982bb776
React-NativeModulesApple: c3e696ff867e4bc212266cbdf7e862e48a0166fd
Expand Down
1 change: 0 additions & 1 deletion metaflags.example.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"startStorybook": false,
"logAction": true,
"logDatadog": true,
"logEventTracked": true,
Expand Down
15 changes: 1 addition & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"generate-changelog": "ts-node scripts/changelog/generateChangelog.ts",
"navigate-to-route": "./scripts/utils/navigate-to-route",
"navigate-to-route-android": "./scripts/utils/navigate-to-route-android",
"init-metaflags": "jq -Rn '{ startStorybook: false }' | sponge metaflags.json",
"init-metaflags": "jq -Rn '{ }' | sponge metaflags.json",
"install:all": "./scripts/setup/install",
"ios": "react-native run-ios --udid=\"$(xcrun simctl list | awk -F'[()]' '/(Booted)/ { print $2 }')\"",
"local-palette-dev": "./scripts/palette/yalc-link-local-palette",
Expand All @@ -59,11 +59,8 @@
"open-xcode": "open ios/Artsy.xcworkspace",
"pod-install": "cd ios; bundle exec pod install; cd ..; ./scripts/setup/post-pod-install.rb",
"pod-install-repo-update": "cd ios; bundle exec pod install --repo-update; cd ..; ./scripts/setup/post-pod-install.rb",
"postinit-metaflags": "rimraf storybook.json",
"postinstall": "react-native setup-ios-permissions; yarn init-metaflags; prettier --write package.json; ./scripts/setup/update-echo",
"prepare": "patch-package && husky install",
"prestart": "./scripts/setup/set-storybook-environment.js",
"prestart-storybook": "yarn sb-rn-get-stories --config-path ./src/app/storybook",
"prettier-project": "yarn run prettier-write 'src/**/*.{ts,tsx}'",
"prettier-write": "prettier --write",
"relay": "[ -f data/complete.queryMap.json ] || echo '{}' > data/complete.queryMap.json && relay-compiler --repersist",
Expand All @@ -74,10 +71,7 @@
"setup:releases": "./scripts/setup/setup-env-for-artsy && ./scripts/setup/setup-env-for-releases",
"setup:releases:update!": "scripts/setup/update-env-for-releases",
"start": "concurrently 'yarn relay:watch' 'react-native start'",
"start-storybook": "STORYBOOK=1 yarn start",
"start:reset-cache": "yarn start --reset-cache",
"storybook-android": "npx artsy open -a storybook",
"storybook-ios": "npx artsy open -i storybook",
"sync-cities": "curl https://raw.githubusercontent.com/artsy/metaphysics/main/src/schema/city/cityDataSortedByDisplayPreference.json -o data/cityDataSortedByDisplayPreference.json",
"sync-schema": "curl https://raw.githubusercontent.com/artsy/metaphysics/main/_schemaV2.graphql -o data/schema.graphql; yarn prettier --write --parser graphql data/schema.graphql",
"sync-schema:localhost": "cd ../metaphysics && yarn dump-schema ../eigen/data/schema.graphql && cd -; yarn prettier --write --parser graphql data/schema.graphql",
Expand Down Expand Up @@ -108,7 +102,6 @@
"app"
],
"dependenciesComments": {
"@react-native-community/slider": "Needed by storybook, see install script here: https://gist.github.com/dannyhw/9b84973dcc6ff4fa2e86e32d571d294e",
"react-native": "Try running `npx @rnx-kit/align-deps --requirements [email protected]` when upgrading to a version, here 0.66.5",
"react-spring": "Try removing this! We have reanimated now.",
"deprecated-react-native-prop-types": "Needed for patching react-native and react-native-credit-card-input due to rn removing the proptypes from their repo",
Expand All @@ -128,7 +121,6 @@
"@react-native-community/datetimepicker": "6.1.4",
"@react-native-community/geolocation": "3.0.6",
"@react-native-community/netinfo": "9.3.11",
"@react-native-community/slider": "4.2.4",
"@react-native-cookies/cookies": "6.0.11",
"@react-native-google-signin/google-signin": "6.0.0",
"@react-native-mapbox-gl/maps": "8.5.0",
Expand All @@ -140,11 +132,6 @@
"@segment/analytics-react-native-appboy": "1.5.0",
"@sentry/react-native": "5.14.1",
"@shopify/flash-list": "^1.5.0",
"@storybook/addon-actions": "6.3.13",
"@storybook/addon-controls": "6.3.13",
"@storybook/addon-ondevice-actions": "6.0.1-beta.5",
"@storybook/addon-ondevice-controls": "6.0.1-beta.5",
"@storybook/react-native": "6.0.1-beta.5",
"@styled-system/theme-get": "5.1.2",
"autosuggest-highlight": "3.1.1",
"deprecated-react-native-prop-types": "4.1.0",
Expand Down
17 changes: 0 additions & 17 deletions scripts/setup/set-storybook-environment.js

This file was deleted.

1 change: 0 additions & 1 deletion scripts/utils/check-dead-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
npx ts-prune --project tsconfig.json \
| grep -v '(used in module)' \
| grep -v '__generated__' \
| grep -v 'storybook' \
| grep -v 'palette' \
| grep -v '__mocks__'
1 change: 0 additions & 1 deletion src/ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface Node {
declare module "" {
global {
const __TEST__: boolean
const __STORYBOOK__: boolean
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/app/AppRegistry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { RecentlyViewedScreenQuery } from "app/Scenes/RecentlyViewed/Components/
import { RecentlyViewedScreen } from "app/Scenes/RecentlyViewed/RecentlyViewed"
import { SearchScreen, SearchScreenQuery } from "app/Scenes/Search/Search"
import { SimilarToRecentlyViewedScreen } from "app/Scenes/SimilarToRecentlyViewed/SimilarToRecentlyViewed"
import { StorybookUIRoot } from "app/storybook/StorybookUI"
import { ArtsyKeyboardAvoidingViewContext } from "app/utils/ArtsyKeyboardAvoidingView"
import { SafeAreaInsets, useScreenDimensions } from "app/utils/hooks"
import { useSelectedTab } from "app/utils/hooks/useSelectedTab"
Expand Down Expand Up @@ -617,7 +616,6 @@ export const modules = defineModules({
Show: reactModule(ShowQueryRenderer, { fullBleed: true }),
ShowMoreInfo: reactModule(ShowMoreInfoQueryRenderer),
SimilarToRecentlyViewed: reactModule(SimilarToRecentlyViewedScreen),
Storybook: reactModule(StorybookUIRoot),
SubmitArtwork: reactModule(SubmitArtwork, { hidesBackButton: true }),
Tag: reactModule(TagQueryRenderer, { hidesBackButton: true, fullBleed: true }),
UnlistedArtworksFAQScreen: reactModule(UnlistedArtworksFAQScreen),
Expand Down
35 changes: 0 additions & 35 deletions src/app/Components/ArtsyKeyboardAvoidingView.stories.tsx

This file was deleted.

26 changes: 0 additions & 26 deletions src/app/Components/ArtworkGrids/ArtworksFilterHeader.stories.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions src/app/Components/Cards/SmallCard.stories.tsx

This file was deleted.

Loading

0 comments on commit 4dfadba

Please sign in to comment.