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(lib): Migrate library to bun #916

Merged
merged 1 commit into from
Nov 22, 2024
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/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
avd-name: e2e_emulator
arch: x86_64
script: |
bun run-example-android
bun example:android:release
bun test:e2e:android

- name: Upload report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

- name: Build iOS App
run: |
bun run-example-ios
bun example:ios:release

- name: Run tests
run: |
Expand Down
44 changes: 26 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,58 @@ We want this community to be friendly and respectful to each other. Please follo

## Development workflow

To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
To get started with the project, run `bun install` in the root directory to install the required dependencies for each package:

```sh
yarn
bun install
```

> While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development.
> While it's possible to use [`npm`](https://github.com/npm/cli) or [`yarn`](https://yarnpkg.com/cli), the tooling is built around [`bun`](https://bun.sh/), so you'll have an easier time if you use `bun` for development.

While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app.

To install dependencies and pods in example directory:

```sh
bun bootstrap
```

To start the packager:

```sh
yarn example start
bun example:start
```

To run the example app on Android:

```sh
yarn example android
bun example:android
```

To run the example app on iOS:

```sh
yarn example ios
bun example:ios
```


Make sure your code passes TypeScript and ESLint. Run the following to verify:

```sh
yarn typescript
yarn lint
bun typescript
bun lint
```

To fix formatting errors, run the following:

```sh
yarn lint --fix
bun lint --fix
```

Remember to add tests for your change if possible. Run the unit tests by:

```sh
yarn test
bun test
```
To edit the Objective-C files, open `example/ios/PagerViewExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-pager-view`.

Expand Down Expand Up @@ -82,20 +88,22 @@ We use [release-it](https://github.com/release-it/release-it) to make it easier
To publish new versions, run the following:

```sh
yarn release
bun release
```

### Scripts

The `package.json` file contains various scripts for common tasks:

- `yarn bootstrap`: setup project by installing all dependencies and pods.
- `yarn typescript`: type-check files with TypeScript.
- `yarn lint`: lint files with ESLint.
- `yarn test`: run unit tests with Jest.
- `yarn example start`: start the Metro server for the example app.
- `yarn example android`: run the example app on Android.
- `yarn example ios`: run the example app on iOS.
- `bun bootstrap`: setup project by installing all dependencies and pods.
- `bun typescript`: type-check files with TypeScript.
- `bun lint`: lint files with ESLint.
- `bun test`: run unit tests with Jest.
- `bun example:start`: start the Metro server for the example app.
- `bun example:android`: run the example app on Android.
- `bun example:ios`: run the example app on iOS.
- `bun example:android:release`: run the example app on Android in release mode.
- `bun example:ios:release`: run the example app on iOS in release mode.

### Sending a pull request

Expand Down
Binary file added bun.lockb
Binary file not shown.
Binary file added example/bun.lockb
Binary file not shown.
16 changes: 8 additions & 8 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android --appId com.pagerviewexample --list-devices",
"build:android": "npm run mkdist && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"build:ios": "npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev false --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"build:visionos": "npm run mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.visionos.jsbundle --assets-dest dist",
"ios": "react-native run-ios --list-devices",
"lint": "eslint .",
"mkdist": "node -e \"require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })\"",
"start": "react-native start",
"pods": "pod-install --quiet",
"test": "jest",
"lint": "eslint .",
"mkdist": "node -e \"require('node:fs').mkdirSync('dist', { recursive: true, mode: 0o755 })\"",
"android": "react-native run-android --appId com.pagerviewexample --list-devices",
"ios": "react-native run-ios --list-devices",
"visionos": "react-native run-visionos",
"pods": "pod-install --quiet"
"build:android": "bun mkdist && react-native bundle --entry-file index.js --platform android --dev true --bundle-output dist/main.android.jsbundle --assets-dest dist/res",
"build:ios": "bun mkdist && react-native bundle --entry-file index.js --platform ios --dev false --bundle-output dist/main.ios.jsbundle --assets-dest dist",
"build:visionos": "bun mkdist && react-native bundle --entry-file index.js --platform ios --dev true --bundle-output dist/main.visionos.jsbundle --assets-dest dist"
},
"dependencies": {
"@callstack/react-native-visionos": "^0.76.0",
Expand Down
Loading
Loading