Skip to content

Commit

Permalink
Add instructions for updating dependencies
Browse files Browse the repository at this point in the history
Remove diff-expo as npx expo install --fix already
handles this
  • Loading branch information
Stephen Hanson committed Mar 2, 2024
1 parent af1970a commit ec28f16
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 77 deletions.
70 changes: 60 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,20 @@ yarn dev

## Test changes locally

In Belt project directory:
You can run Belt locally with:

```bash
yarn link
node bin/belt.js MyApp
```

In some other directory:
Or, with Bun (faster):

```bash
yarn add create-belt-app
yarn link create-belt-app

# or whatever command
yarn belt NewApp
bun bin/belt.js MyApp
```

This generates a new Belt app in builds/MyApp, `cd`s to the directory, runs tests, and then `cd`s back. You can then run that app by `cd`ing to the directory and running `yarn ios` or the desired command.

## Creating a pull request

Make sure the tests pass:
Expand All @@ -48,10 +46,16 @@ Make sure the tests pass:
yarn test
```

Make your change, with new passing tests. Before committing your changes, run the code formatter:
Before committing your changes, make sure the linter, formatter, and vitest tests all pass:

```bash
yarn test:all
```

Additionally, CI runs a check that uses the CLI to build an app and then ensures that the test suite of the new app passes. You can run this locally with:

```bash
yarn pretty
node bin/checks/build-with-latest-expo.check.js
```

Follow the [style guide][style].
Expand All @@ -65,3 +69,49 @@ Push to your fork. Write a [good commit message][commit]. Submit a pull request.
Others will give constructive feedback. This is a time for discussion and
improvements, and making the necessary changes will be required before we can
merge the contribution.

## Updating Belt dependencies

It's imperative that we keep dependencies up-to-date. We should monitor Expo and other dependency releases and update Belt when they come available.

### Updating Expo

Updating Expo is straightforward. When a new Expo version is released, open the Belt codebase, then:

```bash
cd templates/boilerplate
yarn install

# install latest Expo
yarn add expo@latest

# update dependencies to match versions required by latest Expo
npx expo install --fix
```

Now, run the test suite with `yarn test:all` and then generate a new app and verify that it works with:

```bash
node bin/belt.js MyApp
```

Manually verify other commands also work (eg. push notifications). Todo: get better tests around these (i.e. tests that build an app and run the new app's test suite).

### Updating other dependencies

We can periodically update all dependencies to the latest versions with:

```bash
cd templates/boilerplate

yarn install

# with yarn 1
yarn upgrade-interactive --latest

# or, with yarn 2+
yarn up --interactive

# audit and fix any packages that aren't compatible with the installed Expo
npx expo install --fix
```
64 changes: 0 additions & 64 deletions bin/diff-expo.js

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"test:run": "vitest run",
"test:all": "yarn lint && yarn test:run",
"pub:beta": "yarn build && npm publish --tag beta",
"pub:release": "yarn build && npm publish",
"diff-expo": "node bin/diff-expo.js"
"pub:release": "yarn build && npm publish"
},
"dependencies": {
"@inquirer/prompts": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion templates/boilerplate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@react-native-async-storage/async-storage": "1.21.0",
"@react-navigation/native": "^6.1.10",
"@react-navigation/native-stack": "^6.9.18",
"expo": "~50.0.7",
"expo": "^50.0.8",
"expo-status-bar": "~1.11.1",
"jest": "^29.3.1",
"jest-expo": "~50.0.2",
Expand Down

0 comments on commit ec28f16

Please sign in to comment.