Skip to content

[Monorepo] Setup monorepo structure #3482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

[Monorepo] Setup monorepo structure #3482

wants to merge 12 commits into from

Conversation

m-bert
Copy link
Contributor

@m-bert m-bert commented Apr 11, 2025

Description

This is base PR that will be used to migrate our repository into monorepo structure. At this point it creates following structure:

  • /apps - here we will put our example apps.
  • /packages - main directory for Gesture Handler package, along with documentation.

Steps

We will gradually merge PRs that will fix issues caused by changing structure of the repository. Here is the list of PRs that are connected with this process:

  1. [Monorepo] Move config files  #3487
  2. [Monorepo] Add BasicExample app #3490
  3. [Monorepo] Add ExpoExample #3494
  4. [Monorepo] Add MacOSExample app #3495
  5. [Monorepo] Add CommonApp #3496
  6. [Monorepo] Fix CI paths #3497
  7. [Monorepo] Setup linters #3503
  8. awkward placeholder no. 1
    8.1. [Monorepo] Move scripts directory to root #3506
    8.2 [Monorepo] Update spotless #3507
  9. [Monorepo] Add PAPER_ENABLED env variable #3510
  10. [Monorepo] Cleanup #3515
  11. [Monorepo] Fix hoisting #3518

Note that each of them depends on previous ones, so they have to be merged in given order (unless they're in the same subgroup).

Test plan

Not yet 💀

@m-bert m-bert changed the title Monorepo setup [Monorepo] Setup monorepo structure Apr 18, 2025
m-bert added 11 commits May 5, 2025 12:12
## Description

This PR moves config files to root level in monorepo.

> [!NOTE]
> `prepare` was changed to `postinstall`, however this change is already on `main` so it shouldn't be critical.

## Test plan

- [x] Perform test commit to check if commit hooks work
- [x] Build package and install it on external app
## Description

This PR removes currently existing example apps and adds `BasicExample` app - previously `FabricExample`

## Test plan

Build and run `BasicExample` on android and ios
## Description

This PR adds `ExpoExample` app into our repository. This will replace old `example`.

## Test plan

Test `ExpoExample` on `iOS`, `android` and `web`
## Description

This PR adds MacOSExample app to monorepo.

>[!NOTE]
>This app contains only basic examples. It will be merged with `ExpoExample` in upcoming PR

>[!WARNING]
>This PR lacks support for `clangd` introduced in #3069. I'd like to add it right away, but I'm not yet sure where to put required scripts

## Test plan

Build & run MacOSExample
## Description

This PR adds `CommonApp` that holds shared source code for our examples.

## Test plan

Run `ExpoExample` and `MacOSExample`
## Description

This PR updates paths used in github actions. Here we should focus on paths that are responsible for building example apps, linter will be fixed in upcoming PRs

## Test plan

Check CIs
## Description

This PR sets up `eslint`, `prettier` and `tsc` so that we can finally run lint checks in monorepo.

Each workspace has `ts-check` and `lint-js` scripts which run in given workspace. Running those scripts in `root` results in running them in each workspace. 

> [!NOTE]
> Running those scripts from `root` does not trigger any checks in `ExpoExample` and `MacOSExample`, as they only export app from `CommonApp`

## Test plan

Run `yarn ts-check` and `yarn lint-js` from `root`.
## Description

This PR moves `scripts` directory to root of the monorepo. It also

- Brings back `clangd` support,
- Renames some of scripts to be [global](https://yarnpkg.com/features/workspaces#global-scripts)

## Test plan

Check that CI passes and that building iOS app generates `compile_commands.json` file.
## Description

This PR bumps `spotless` (android formatter) to version 7.0.3.

## Test plan

Run `yarn lint:android`
## Description

This PR adds `PAPER_ENABLED` environmental variable in order to easily switch to old architecture in `ExpoExample`. It also adds CIs that test paper build on both platforms. 

## Test plan

Verified in `App.tsx` with the following snippet:

```jsx
const uiManager = global?.nativeFabricUIManager ? 'Fabric' : 'Paper';
console.log(`Using ${uiManager}`);
```

Check that CIs pass.
## Description

This PR consists of changes that aim to clean repository after moving into monorepo, namely:

- Unify quotations in github workflows
- Remove unnecessary config files
- Remove unnecessary dependencies
- Changes scripts:
  - Android format script now drops argument instead of only working at one file. I wanted to make it work only on staged files, however it takes a lot of time since `gradle` has to start over and over. Unfortunately, multiple files for `spotlessIdeHook` [are not in the roadmap](diffplug/spotless#791 (comment)).
  - Added apple format script which formats only staged files (or whole apple codebase if run without argument)
  - Added script for checking whether staged android files are included in `package.json` 😅 
- Make sure that `lint-staged` operates only on staged files (if possible)
- Remove `e2e` app
- Add `yarn clean` script

## Test plan

Check that CIs pass and example apps work as expected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant