Skip to content

Commit

Permalink
feat: build codegen on postinstall (#46227)
Browse files Browse the repository at this point in the history
Summary:
This PR solves a small issue I've encountered when working with the repo.

When changing branches we often run `yarn` to reinstall dependencies (let's say we change from 0.74-stable to main).

There are lots of changes between those two versions in the `react-native-codegen` package. This causes an issue when we install pods in `packages/rn-tester` the old version of codegen is used (the one cached from 0.74-stable) leading to a big error that's hard to solve at first.

This PR solves this by building codegen on `postinstall`. I've seen many newcomers blocked by this issue (and rerunning `yarn` is the natural thing to do in this situation)

## Changelog:

[INTERNAL] [ADDED] - Build codegen on postinstall when working with the monorepo

Pull Request resolved: #46227

Test Plan: Run `yarn`

Reviewed By: cipolleschi

Differential Revision: D61849150

Pulled By: huntie

fbshipit-source-id: 24fc5cf9b6a2510298f7bcdce59043e5dcfbfdd4
  • Loading branch information
okwasniewski authored and facebook-github-bot committed Aug 27, 2024
1 parent 46d17ef commit 0cb97f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"test-typescript": "dtslint packages/react-native/types",
"test": "jest",
"trigger-react-native-release": "node ./scripts/releases-local/trigger-react-native-release.js",
"update-lock": "npx yarn-deduplicate"
"update-lock": "npx yarn-deduplicate",
"postinstall": "cd packages/react-native-codegen && yarn build"
},
"workspaces": [
"packages/*",
Expand Down

0 comments on commit 0cb97f0

Please sign in to comment.