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
+64-26Lines changed: 64 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,51 +16,82 @@ To get started with the project, run `yarn` in the root directory to install the
16
16
```sh
17
17
yarn init -2
18
18
yarn
19
+
yarn build
19
20
```
20
21
21
22
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
22
23
23
-
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
24
+
The [example app](/example/) demonstrates usage of the library.
24
25
25
-
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.
26
+
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Most changes to the library's code will be reflected in the example app without a rebuild, but changes to the Metro, Babel or compiler sections will require a rebuild.
26
27
27
-
You can use various commands from the root directory to work with the project.
28
+
You can rebuild the library by running:
29
+
30
+
```sh
31
+
yarn build
32
+
```
28
33
29
-
To start the packager:
34
+
There is no rebuild watch command, as if you are changing code that requires a rebuild, you will also need to restart the example app server to observe any changes.
30
35
31
36
```sh
32
-
yarn example start
37
+
# Alias for yarn build && yarn example debug
38
+
yarn build:debug
39
+
40
+
# Alias for yarn build && yarn example start
41
+
yarn build:start
42
+
43
+
# Tips:
44
+
45
+
## Quickly rebuild and refresh the simulator
46
+
yarn build:debug --ios
47
+
yarn build:debug --android
48
+
yarn build:debug --web
33
49
```
34
50
35
-
To run the example app on Android:
51
+
### Building the example app
52
+
53
+
The example app is built using a canary version of the Expo SDK, which requires a development build. Before running the example app on a device or simulator, you need to build the app using the following command:
36
54
37
55
```sh
56
+
yarn example expo prebuild
57
+
58
+
yarn example ios
59
+
# Or
38
60
yarn example android
39
61
```
40
62
41
-
To run the example app on iOS:
63
+
### Running the example app
64
+
65
+
You can use various commands from the root directory to work with the project.
66
+
67
+
To start the CLI:
42
68
43
69
```sh
44
-
yarn example ios
70
+
yarn example start
45
71
```
46
72
47
-
To run the example app on Web:
73
+
To start the CLI wih debugging enabled:
48
74
49
75
```sh
50
-
yarn example web
76
+
yarn example debug
51
77
```
52
78
53
-
Make sure your code passes TypeScript and ESLint. Run the following to verify:
79
+
To rebuild the example app on Android:
54
80
55
81
```sh
56
-
yarn typecheck
57
-
yarn lint
82
+
yarn example android
58
83
```
59
84
60
-
To fix formatting errors, run the following:
85
+
To rebuild the example app on iOS:
61
86
62
87
```sh
63
-
yarn lint --fix
88
+
yarn example ios
89
+
```
90
+
91
+
To run the example app on Web:
92
+
93
+
```sh
94
+
yarn example web
64
95
```
65
96
66
97
### Testing
@@ -71,6 +102,9 @@ Remember to add tests for your change if possible. Run the unit tests by:
71
102
yarn test
72
103
```
73
104
105
+
> [!NOTE]
106
+
> Ignore any ExperimentalWarning: VM Modules warnings. We are using the experimental [ECMAScript Modules](https://jestjs.io/docs/ecmascript-modules)
107
+
74
108
### Debugging
75
109
76
110
Run the example via the command line with the `debug` script to enable debugging:
@@ -81,16 +115,6 @@ yarn example debug
81
115
82
116
This will print parsed CSS and style objects to the console, which can help you understand how the library processes CSS files.
83
117
84
-
### Commands
85
-
86
-
The `yarn example` command is a shortcut for running commands in the example app. You can run any command that is available in the example app's `package.json` by prefixing it with `yarn example`.
87
-
88
-
You can also run Expo commands directly from the root directory by using the `yarn example expo` command. For example, to run the Expo prebuild, you can use:
89
-
90
-
```sh
91
-
yarn example expo prebuild
92
-
```
93
-
94
118
### Commit message convention
95
119
96
120
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
@@ -108,6 +132,19 @@ Our pre-commit hooks verify that your commit message matches this format when co
Make sure your code passes TypeScript and ESLint. Run the following to verify:
136
+
137
+
```sh
138
+
yarn typecheck
139
+
yarn lint
140
+
```
141
+
142
+
To fix formatting errors, run the following:
143
+
144
+
```sh
145
+
yarn lint --fix
146
+
```
147
+
111
148
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
112
149
113
150
Our pre-commit hooks verify that the linter and tests pass when committing.
@@ -146,6 +183,8 @@ When you're sending a pull request:
146
183
- Follow the pull request template when opening a pull request.
147
184
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
148
185
186
+
## Development notes
187
+
149
188
### Metro Transformer
150
189
151
190
> [!IMPORTANT]
@@ -185,4 +224,3 @@ yarn test babel
185
224
### Example will not run
186
225
187
226
- If you have a nested `node_modules` directory in your example app, it may cause issues with the Metro bundler. To resolve this, you need to ensure that the dependency versions used in the example app match those in the root `package.json`.
`react-native-css` officially only supports Metro as the bundler, but we welcome community contributions to support other bundlers like Webpack, Vite or Turbopack.
37
37
38
+
More documentation coming soon.
39
+
38
40
## Usage
39
41
40
42
You can use the library by importing the React Native components directly from `react-native-css/components`:
0 commit comments