Skip to content
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

chore: rename examples dir #614

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
value: Thanks for taking the time to file a bug! Please make sure to create a reproduction as minimal as possible and to describe everything necessary to trigger the unexpected behavior.
- type: markdown
attributes:
value: You can use the [Bug Report template](https://github.com/maplibre/maplibre-react-native/blob/main/packages/examples/src/examples/BugReport.tsx) within the example apps. Otherwise create a new standalone app (`npx create-expo-app@latest` or `npx @react-native-community/cli@latest init`) which reproduces the bug and provide the public repository URL. Please avoid external dependencies where possible.
value: You can use the [Bug Report template](https://github.com/maplibre/maplibre-react-native/blob/main/examples/shared/src/examples/BugReport.tsx) within the example apps. Otherwise create a new standalone app (`npx create-expo-app@latest` or `npx @react-native-community/cli@latest init`) which reproduces the bug and provide the public repository URL. Please avoid external dependencies where possible.
- type: textarea
id: description
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Added `your feature` that allows ...
- [ ] I formatted JS and TS files with running `yarn lint:eslint:fix` in the root folder
- [ ] I have run tests via `yarn test` in the root folder
- [ ] I updated the documentation with running `yarn codegen` in the root folder
- [ ] I added/updated a sample (`/packages/examples`)
- [ ] I added/updated a sample (`/examples/shared`)

## Screenshot OR Video

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/review-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/react-native-app
working-directory: ./examples/react-native-app
strategy:
matrix:
new-arch: [false, true]
Expand All @@ -34,9 +34,9 @@ jobs:
with:
path: |
./android/build
./packages/react-native-app/android/.gradle
./packages/react-native-app/android/app/build
./packages/react-native-app/android/build
./examples/react-native-app/android/.gradle
./examples/react-native-app/android/app/build
./examples/react-native-app/android/build
key: ${{ runner.os }}-android-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}-${{ hashFiles('android/**') }}
restore-keys: |
${{ runner.os }}-android-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ hashFiles('yarn.lock') }}-
Expand All @@ -50,15 +50,15 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: android-app-${{ matrix.new-arch && 'new' || 'old' }}-arch
path: ./packages/react-native-app/android/app/build/outputs/apk/release/app-release.apk
path: ./examples/react-native-app/android/app/build/outputs/apk/release/app-release.apk

test-android:
name: Test ${{ matrix.new-arch && 'new' || 'old'}} Arch
needs: [build-android]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./packages/react-native-app
working-directory: ./examples/react-native-app
strategy:
matrix:
new-arch: [false, true]
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
target: google_apis
arch: x86_64
force-avd-creation: false
working-directory: ./packages/react-native-app
working-directory: ./examples/react-native-app
script: echo "Generated Android Virtual Device Snapshot for Caching"

- name: Install Maestro
Expand All @@ -104,7 +104,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: android-app-${{ matrix.new-arch && 'new' || 'old' }}-arch
path: ./packages/react-native-app/android/
path: ./examples/react-native-app/android/

- name: Run Tests
uses: reactivecircus/android-emulator-runner@v2
Expand All @@ -113,7 +113,7 @@ jobs:
target: google_apis
arch: x86_64
force-avd-creation: false
working-directory: ./packages/react-native-app
working-directory: ./examples/react-native-app
script: |
adb install ./android/app-release.apk
maestro test ./e2e --format junit
Expand All @@ -124,5 +124,5 @@ jobs:
with:
name: Android Report ${{ matrix.new-arch && 'new' || 'old' }} Arch
path: |
./packages/react-native-app/report.xml
./examples/react-native-app/report.xml
~/.maestro/tests/**/*
18 changes: 9 additions & 9 deletions .github/workflows/review-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: macos-latest
defaults:
run:
working-directory: ./packages/react-native-app
working-directory: ./examples/react-native-app
strategy:
matrix:
new-arch: [false, true]
Expand All @@ -25,7 +25,7 @@ jobs:
uses: actions/cache@v4
id: cocoapods-cache
with:
path: ./packages/react-native-app/ios/Pods
path: ./examples/react-native-app/ios/Pods
key: ${{ runner.os }}-cocoapods-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
restore-keys: |
${{ runner.os }}-cocoapods-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ hashFiles('yarn.lock') }}-
Expand All @@ -38,7 +38,7 @@ jobs:
uses: actions/cache@v4
id: ios-build-cache
with:
path: ./packages/react-native-app/ios/build
path: ./examples/react-native-app/ios/build
key: ${{ runner.os }}-ios-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}-${{ hashFiles('ios/**') }}
restore-keys: |
${{ runner.os }}-ios-build-${{ matrix.new-arch && 'new' || 'old' }}-arch-${{ hashFiles('yarn.lock') }}-
Expand All @@ -55,17 +55,17 @@ jobs:
name: ios-app-${{ matrix.new-arch && 'new' || 'old' }}-arch
# `.app` is a directory, so we have to archive one level above
path: |
./packages/react-native-app/ios/build/Build/Products/Release-iphonesimulator
!./packages/react-native-app/ios/build/Build/Products/Release-iphonesimulator/**
./packages/react-native-app/ios/build/Build/Products/Release-iphonesimulator/MapLibreReactNativeExample.app
./examples/react-native-app/ios/build/Build/Products/Release-iphonesimulator
!./examples/react-native-app/ios/build/Build/Products/Release-iphonesimulator/**
./examples/react-native-app/ios/build/Build/Products/Release-iphonesimulator/MapLibreReactNativeExample.app

test-ios:
name: Test ${{ matrix.new-arch && 'new' || 'old'}} Arch
needs: [build-ios]
runs-on: macos-latest
defaults:
run:
working-directory: ./packages/react-native-app
working-directory: ./examples/react-native-app
strategy:
matrix:
new-arch: [false, true]
Expand All @@ -82,7 +82,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: ios-app-${{ matrix.new-arch && 'new' || 'old' }}-arch
path: ./packages/react-native-app/ios
path: ./examples/react-native-app/ios

- name: Run Tests
run: |
Expand All @@ -97,5 +97,5 @@ jobs:
with:
name: iOS Report ${{ matrix.new-arch && 'new' || 'old' }} Arch
path: |
./packages/react-native-app/report.xml
./examples/react-native-app/report.xml
~/.maestro/tests/**/*
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ coverage
*.iml
.env

# Expo
packages/expo-app/ios
packages/expo-app/android

# Build by bob
lib/

Expand Down
52 changes: 26 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ This project consists of these parts:
- [`/plugin`](/src/plugin): Expo plugin
- [`/scripts`](/scripts): Codegen responsible native sourcecode for Styles and documentation
- Examples
- [`/packages/examples`](/packages/examples): Shared code for examples
- [`/packages/expo-app`](/packages/expo-app): Expo example app, uses new architecture
- [`/packages/react-native-app`](/packages/react-native-app): React Native example app, uses old architecture
- [`/examples/shared`](/examples/shared): Shared code for examples
- [`/examples/expo-app`](/examples/expo-app): Expo example app, uses new architecture
- [`/examples/react-native-app`](/examples/react-native-app): React Native example app, uses old architecture

## Environment Setup

Expand Down Expand Up @@ -54,7 +54,7 @@ IDE of you choice which supports TypeScript like VSCode, WebStorm or similar.
#### Android

- [Android Studio](https://developer.android.com/studio) freely available on all platforms
- Open the `packages/react-native-app/android` directory
- Open the `examples/react-native-app/android` directory
- Shows the library as `mlrn` in the sourcetree
- Shows the React Native example app as `app` in the sourcetree
- You can rebuild the React Native Android example app directly from Android Studio, when you have changed Java/Kotlin
Expand All @@ -63,15 +63,15 @@ IDE of you choice which supports TypeScript like VSCode, WebStorm or similar.
#### iOS

- [Xcode](https://developer.apple.com/xcode/) freely available on macOS
- Open the `packages/react-native-app/ios/MapLibreReactNativeExample.xcworkspace` file
- Open the `examples/react-native-app/ios/MapLibreReactNativeExample.xcworkspace` file
- Shows the library as `Pods > Development Pods > maplibre-react-native`
- Shows the React Native example app as `MapLibreReactNativeExample`
- You can rebuild the React Native iOS example app directly from Xcode, when you have changed Objective-C/Swift code

## Development

The [React Native](/packages/react-native-app) and [Expo](/packages/expo-app) example apps are set up
to use the library files in the root and the example scenes from [`/packages/examples`](/packages/examples). Therefore,
The [React Native](/examples/react-native-app) and [Expo](/examples/expo-app) example apps are set up
to use the library files in the root and the example scenes from [`/examples/shared`](/examples/shared). Therefore,
when using the `start` commands, changes to TypeScript code will be immediately refreshed. When changing native Android
or iOS code, it's necessary to rebuild the native dev clients.

Expand All @@ -84,32 +84,32 @@ workspaces.
### Expo App

- To execute commands for the Expo app, you can run with<br/>
`yarn example:expo <script>`
- Alternatively switch to the [`/packages/expo-app`](/packages/expo-app) directory and use the commands without the
`example:expo` prefix
`yarn examples:expo <script>`
- Alternatively switch to the [`/examples/expo-app`](/examples/expo-app) directory and use the commands without the
`examples:expo` prefix
- Build and run a platform:
- `yarn example:expo android` for building and running Android
- `yarn example:expo ios` for building and running iOS
- `yarn examples:expo android` for building and running Android
- `yarn examples:expo ios` for building and running iOS
- Starting the dev server<br/>
`yarn example:expo start`<br/>
`yarn examples:expo start`<br/>
- Purging all artifacts, if you want to create a clean build<br/>
`yarn example:expo purge`
`yarn examples:expo purge`

### React Native App

- To execute commands for the React Native app, you can run with<br/>
`yarn example:react-native <script>`
- Alternatively switch to the [`/packages/react-native-app`](/packages/react-native-app) directory and use the
commands without the `example:react-native` prefix
`yarn examples:react-native <script>`
- Alternatively switch to the [`/examples/react-native-app`](/examples/react-native-app) directory and use the
commands without the `examples:react-native` prefix
- Build and run a platform:
- Building and running Android<br/>
`yarn example:react-native android`
`yarn examples:react-native android`
- Building and running iOS<br/>
`yarn example:react-native ios:pod-install` (necessary on first install/changes in [
`Podfile`](/packages/react-native-app/ios/Podfile))<br/>
`yarn example:react-native ios`
`yarn examples:react-native ios:pod-install` (necessary on first install/changes in [
`Podfile`](/examples/react-native-app/ios/Podfile))<br/>
`yarn examples:react-native ios`
- Starting the dev server<br/>
`yarn example:react-native start`<br/>
`yarn examples:react-native start`<br/>
Press one of the following keys:
- `a` for building and running Android
- `i` for building and running iOS
Expand Down Expand Up @@ -138,10 +138,10 @@ is tested. Run them with `yarn test`.
### End-to-End Tests

The end-to-end tests are implemented through [Maestro](https://github.com/mobile-dev-inc/maestro) in the React
Native example app. They are found within [`/packages/react-native-app/e2e`](/packages/react-native-app/e2e). To run
Native example app. They are found within [`/examples/react-native-app/e2e`](/examples/react-native-app/e2e). To run
them locally, [install Maestro](https://maestro.mobile.dev/getting-started/installing-maestro) first. Then run the React
Native example app on Android emulator or iOS Simulator using `yarn example:react-native start`. To execute the tests
run `maestro test ./packages/react-native-app/e2e`.
Native example app on Android emulator or iOS Simulator using `yarn examples:react-native start`. To execute the tests
run `maestro test ./examples/react-native-app/e2e`.

## Documentation

Expand All @@ -162,7 +162,7 @@ following this schema, as we use [semantic-release](https://github.com/semantic-
automatically generate the [CHANGELOG](CHANGELOG.md).

If you implemented a new feature, please add tests and demonstrate the functionality through adding a scene in [
`examples`](/packages/examples). Document your feature using the appropriate TSDoc comments.
`examples`](/examples/shared). Document your feature using the appropriate TSDoc comments.

Make sure, the checks on the pipeline pass, when creating a PR. See [Testing](#testing) on how to run these locally.

Expand Down
3 changes: 3 additions & 0 deletions examples/expo-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Expo
ios
android
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const config: Config = {
],
modulePathIgnorePatterns: [
"<rootDir>/lib/",
"<rootDir>/packages/",
"<rootDir>/examples/",
"__mocks__",
"__fixtures__",
],
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
"scripts": {
"codegen": "tsx scripts/codegen.ts",
"lint": "yarn lint:tsc && yarn lint:eslint",
"lint:tsc": "tsc --project ./ && tsc --project ./packages/examples && yarn docs lint:tsc",
"lint:tsc": "tsc --project ./ && tsc --project ./examples/shared && yarn docs lint:tsc",
"lint:eslint": "eslint ./ --max-warnings 0",
"lint:eslint:fix": "yarn lint:eslint --fix",
"test": "jest",
"prepack": "bob build",
"docs": "yarn workspace docs",
"example:react-native": "yarn workspace react-native-app",
"example:expo": "yarn workspace expo-app"
"examples:react-native": "yarn workspace react-native-app",
"examples:expo": "yarn workspace expo-app"
},
"workspaces": [
"packages/*",
"docs"
"docs",
"examples/*"
],
"packageManager": "[email protected]",
"main": "./lib/commonjs/index.js",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"exclude": [
"docs",
"lib",
"packages",
"examples",
"scripts",
"jest.config.ts",
"src/__tests__"
Expand Down
Loading
Loading