You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+93-13Lines changed: 93 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Contributing guidelines for `blade`
2
2
3
-
## Development setup
3
+
## Local Development Setup
4
4
5
5
These steps should get you up and started for local development setup. Please ensure you've NodeJS and Yarn installed on your machine before proceeding.
6
6
@@ -22,7 +22,16 @@ These steps should get you up and started for local development setup. Please en
22
22
yarn start:web
23
23
```
24
24
25
-
- That's it!
25
+
- That's it! You can access storybook on http://localhost:9009
26
+
27
+
### Setting up React Native
28
+
29
+
If you're contributing to React Native parts, you can follow the following setup.
30
+
31
+
You can skip it if you're contributing to web only component. Our [Component Status Page in Documentation](https://blade.razorpay.com/?path=/docs/guides-component-status--docs) mentions which components are react native supported and which are web only
32
+
33
+
<details>
34
+
<summary><h4>React Native Local Development Setup</h4></summary>
26
35
27
36
### Setting up iOS
28
37
@@ -38,13 +47,13 @@ These steps should get you up and started for local development setup. Please en
> Sometimes it can take a very long time for Xcode to install. Check [here](https://apple.stackexchange.com/questions/427640/mac-app-store-xcode-download-stuck-at-installing) for troubleshooting.
44
53
45
54
- Install an iOS 13 simulator in Xcode: Xcode > Preferences > Platforms.
46
55
47
-
> **Note**
56
+
> [!Note]
48
57
>
49
58
> Sometimes this can get stuck or take a very long time. Check [here](https://stackoverflow.com/questions/29058229/download-xcode-simulator-directly) for troubleshooting.
50
59
@@ -56,7 +65,7 @@ These steps should get you up and started for local development setup. Please en
56
65
57
66
- Install pods. This can be done by running `pod install` in the `ios/` directory for Intel machine. For M1, things might not work out of box.
58
67
59
-
> **Note**
68
+
> [!Note]
60
69
>
61
70
> Follow the note [here](https://reactnative.dev/docs/environment-setup#cocoapods) if you're using M1
62
71
@@ -70,9 +79,9 @@ These steps should get you up and started for local development setup. Please en
70
79
>
71
80
> You don't need to build the app everytime (only when you're changing native dependencies), once the app is built you can just start the storybook server and open the app directly on your simulator
72
81
73
-
- If the stars aligned correctly, the storybook app should get installed and up and running on the simulator. If not, please refer to the official [guide](https://reactnative.dev/docs/environment-setup) for any deviations.
82
+
- If the stars aligned correctly, the storybook app should get installed and up and running on the simulator. If not, please refer to the official [guide](https://reactnative.dev/docs/environment-setup) for any deviations.
74
83
75
-
*The storybook can take some time to open after simulator starts. Don't worry, it will start after few minutes (hopefully 🤞).*
84
+
_The storybook can take some time to open after simulator starts. Don't worry, it will start after few minutes (hopefully 🤞)._
76
85
77
86
### Setting up Android
78
87
@@ -93,28 +102,99 @@ These steps should get you up and started for local development setup. Please en
93
102
yarn start:android
94
103
```
95
104
96
-
> **Note**
105
+
> [!Note]
97
106
>
98
107
> If you already have `yarn start:ios` running, you might have to close it since `yarn start:android` will try to run react-native server on the same port and fail with port taken error.
99
-
>
108
+
>
100
109
> If you want to run both, android and ios at the same time, you can use `yarn start:native` instead.
101
110
102
-
> **Note**
111
+
> [!Note]
103
112
>
104
113
> Make sure `$ANDROID_SDK_ROOT` is added before running the above command, you can run `echo $ANDROID_SDK_ROOT` in same terminal to confirm. (You can run `source ~/.zshrc` or `source ~/.bash_profile` depending on where you added the variables)
105
114
106
115
- If the stars aligned correctly, the storybook app should get installed and up and running on the emulator 🎉
107
116
108
-
## Tips
117
+
> [!TIP]
118
+
>
119
+
> You can use `yarn start:all` command to run storybooks on all platforms like web, android, and ios (better to not use it in development though to avoid stressing your laptop)
120
+
121
+
</details>
122
+
123
+
## Codebase Terminologies and Structure
109
124
110
-
- You can use `yarn start:all` command to run storybooks on all platforms like web, android, and ios (better to not use it in development though to avoid stressing your laptop)
125
+
### Base Component Terminology in Code
111
126
112
-
## TypeScript Guide
127
+
We have some base components defined internally such as BaseInput, BaseButton, BaseText which act as a base for multiple exposed components.
128
+
129
+
E.g.
130
+
131
+
- Heading, Display, Text all use BaseText internally
132
+
- TextInput, PasswordInput, SelectInput all use BaseInput internally
133
+
- Majority of our components use BaseBox internally which is a more flexible version of the exposed Box component.
134
+
135
+
### Cross Platform Guide
136
+
137
+
You will see files with `.web.tsx` or `.native.tsx` syntax. The `.web.tsx` files end up in web bundle and `.native.tsx` files end up in react native bundle. You can define common logic in normal `.tsx` files which can be imported in both web and native files.
138
+
139
+
#### Cross Platform TypeScript Guide
113
140
114
141
[Writing Cross-Platform TypeScript In Blade](./rfcs/writing-cross-platform-typescript.md)
115
142
143
+
## Testing Changes
144
+
145
+
### Unit Tests
146
+
147
+
We have unit tests which you can run by running following commands
148
+
149
+
```sh
150
+
cd packages/blade
151
+
yarn test:react # web tests
152
+
yarn test:react-native # native tests
153
+
```
154
+
155
+
### Visual Tests
156
+
157
+
We also have visual tests that run on every PR. So if your PR changes / breaks a certain component, the diff will show up on chromatic checks of PR
We support writing interaction tests using playwright. You can check example interaction tests of toast at [Toast.test.stories.tsx](./packages/blade/src/components/Toast/__tests__/Toast.test.stories.tsx). You can run these tests by visiting the Interaction Tests section in blade documentation E.g. [Toast Stacking Interaction Test on Documentation](https://blade.razorpay.com/?path=/story/components-interaction-tests-toast--toast-stacking)
164
+
165
+
## Editor Setup
166
+
167
+
- Make sure you have [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) installed and setup on your VSCode. This will guide you and autofix errors to keep the code consistent with this project's guidelines
168
+
- Make sure you have [VSCode MDX](https://marketplace.visualstudio.com/items?itemName=JounQin.vscode-mdx) installed on your VSCode. This will help you with linting the markdown files if you're modifying or adding any `mdx` files for documentation purpose.
169
+
- After installing this plugin navigate to your settings and add `mdx` extension to your `eslint` config. Below is how your settings will look after configuring `mdx` to work with eslint
- VSCode auto imports can sometimes mess things up due to import aliases and `.web` / `.native` extensions. If something is breaking weirdly after adding / importing a new module this might be related
119
193
- Ensure you're not using any `.web`, `.native` files directly in respective imports in `.web` / `.native` modules. For example, if you end up importing a `.web` module accidentally in a `.native` module, you might see a blank component being rendered or module not found error
120
194
- If you forget to import types inside a `.d.ts` file, sometimes TS won't complain and it can throw the typecheck logic in other modules off
195
+
196
+
-`Blade requires "FRAMEWORK" environment variable to be set. Valid values are "REACT" and "REACT_NATIVE". Instead, received: undefined`
197
+
198
+
**Issue:** This is an issue that happens mostly if you run `yarn android` directly. For some reason `FRAMEWORK` doesn't gets passed to React Native application
199
+
200
+
**Fix:** If you come across this issue then you first run `yarn start` and then run `yarn android`.
- Cross-Platform (Works Natively on [React Web](https://blade.razorpay.com/?path=/docs/guides-installation--page#%EF%B8%8F-installation) and [React Native](https://blade.razorpay.com/?path=/docs/guides-installation--page#react-native-projects))
- eaa75c64: feat(ActionList): add ActionListItemAvatar component for leading prop
49
+
50
+
### Patch Changes
51
+
52
+
- c6f8bc72: fix(blade): support overriding tooltip interactive wrapper display prop
53
+
54
+
## 11.28.2
55
+
56
+
### Patch Changes
57
+
58
+
- 12f30712: fix(input): change `wordBreak` behaviour of input hint text & fix alignment
59
+
- 601cedc8: feat(StepItem): add `isDisabled` prop to StepItem
60
+
61
+
## 11.28.1
62
+
63
+
### Patch Changes
64
+
65
+
- 830c8744: fix(Table): table sticky column overlapping with relative cell
66
+
67
+
## 11.28.0
68
+
69
+
### Minor Changes
70
+
71
+
- 95f19f49: feat: expose link negative/positive colors
72
+
73
+
## 11.27.1
74
+
75
+
### Patch Changes
76
+
77
+
- 8ba3eab7: fix: datepicker necessityIndicator
78
+
79
+
## 11.27.0
80
+
81
+
### Minor Changes
82
+
83
+
- f036ef58: feat: add EqualsIcon
84
+
85
+
## 11.26.1
86
+
87
+
### Patch Changes
88
+
89
+
- 5d7317ca: fix: remove default `rel` values
90
+
91
+
> [!NOTE]
92
+
>
93
+
> While its non-ui-breaking change, you might want to add `rel="noopener noreferrer"` to your Button if that is what you're expecting. This PR removes the defaults in-order to not break analytics that relies on referrer.
94
+
95
+
- 4dcad016: fix: set min-width on Radio to avoid shrinking
96
+
97
+
## 11.26.0
98
+
99
+
### Minor Changes
100
+
101
+
- f26cf80d: chore: expose brand colors
102
+
- 39742907: feat(TableEditableCell): refactor TableEditableCell and add TableEditableDropdownCell
Blade is an open-source project and we accept contributions from our other teams at Razorpay and also from outside of Razorpay. You can checkout the links below to help you get started with contribution
8
+
9
+
## 🧑🏻💻 Local Development and Guidelines
10
+
11
+
Check out [CONTRIBUTING.md](https://github.com/razorpay/blade/blob/master/CONTRIBUTING.md) for local installation, codebase terminologies, editor setup and more.
12
+
13
+
## 📄 License
14
+
15
+
Blade is MIT Licensed. You can read full license at [LICENSE](https://github.com/razorpay/blade/blob/master/LICENSE.md)
16
+
17
+
## 🏘️ Slack Channel (For Razorpay Employees)
18
+
19
+
Razorpay Employees can reach out on `#design-system` and tag `@designsystem` for anything related to contributing to Blade.
0 commit comments