Skip to content

Commit 73cc7d0

Browse files
committed
chore: update README.md
1 parent c496d78 commit 73cc7d0

File tree

3 files changed

+69
-27
lines changed

3 files changed

+69
-27
lines changed

CONTRIBUTING.md

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,82 @@ To get started with the project, run `yarn` in the root directory to install the
1616
```sh
1717
yarn init -2
1818
yarn
19+
yarn build
1920
```
2021

2122
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
2223
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.
2425

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.
2627

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+
```
2833

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.
3035

3136
```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
3349
```
3450

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:
3654

3755
```sh
56+
yarn example expo prebuild
57+
58+
yarn example ios
59+
# Or
3860
yarn example android
3961
```
4062

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:
4268

4369
```sh
44-
yarn example ios
70+
yarn example start
4571
```
4672

47-
To run the example app on Web:
73+
To start the CLI wih debugging enabled:
4874

4975
```sh
50-
yarn example web
76+
yarn example debug
5177
```
5278

53-
Make sure your code passes TypeScript and ESLint. Run the following to verify:
79+
To rebuild the example app on Android:
5480

5581
```sh
56-
yarn typecheck
57-
yarn lint
82+
yarn example android
5883
```
5984

60-
To fix formatting errors, run the following:
85+
To rebuild the example app on iOS:
6186

6287
```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
6495
```
6596

6697
### Testing
@@ -71,6 +102,9 @@ Remember to add tests for your change if possible. Run the unit tests by:
71102
yarn test
72103
```
73104

105+
> [!NOTE]
106+
> Ignore any ExperimentalWarning: VM Modules warnings. We are using the experimental [ECMAScript Modules](https://jestjs.io/docs/ecmascript-modules)
107+
74108
### Debugging
75109

76110
Run the example via the command line with the `debug` script to enable debugging:
@@ -81,16 +115,6 @@ yarn example debug
81115

82116
This will print parsed CSS and style objects to the console, which can help you understand how the library processes CSS files.
83117

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-
94118
### Commit message convention
95119

96120
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
108132

109133
[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
110134

135+
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+
111148
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.
112149

113150
Our pre-commit hooks verify that the linter and tests pass when committing.
@@ -146,6 +183,8 @@ When you're sending a pull request:
146183
- Follow the pull request template when opening a pull request.
147184
- For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.
148185

186+
## Development notes
187+
149188
### Metro Transformer
150189

151190
> [!IMPORTANT]
@@ -185,4 +224,3 @@ yarn test babel
185224
### Example will not run
186225

187226
- 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`.
188-
- For the moment, you must use a dev client

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The goal of this library is to provide the most complete CSS support for React N
1313
### Metro based projects
1414

1515
> [!TIP]
16-
> All Expo and React Native community projects use Metro as the bundler, so this guide applies to them.
16+
> All Expo and React Native Community CLI projects use Metro as the bundler, so this guide applies to them.
1717
1818
You will need to add `withReactNativeCSS` to your Metro configuration.
1919

@@ -35,6 +35,8 @@ export default withReactNativeCSS(defaultConfig, {
3535

3636
`react-native-css` officially only supports Metro as the bundler, but we welcome community contributions to support other bundlers like Webpack, Vite or Turbopack.
3737

38+
More documentation coming soon.
39+
3840
## Usage
3941

4042
You can use the library by importing the React Native components directly from `react-native-css/components`:

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
"lint": "eslint",
7777
"typecheck": "tsc --noEmit",
7878
"build": "bob build",
79+
"build:debug": "yarn build && yarn example debug",
80+
"build:start": "yarn build && yarn example start",
7981
"prepublishOnly": "bob build",
8082
"prepare": "bob build",
8183
"example": "yarn workspace react-native-css-example",

0 commit comments

Comments
 (0)