Skip to content
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 .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["example"]
"ignore": ["example", "@react-native-motion-kit/swipe-deck-docs"]
}
5 changes: 5 additions & 0 deletions .changeset/pnpm-root-package.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@react-native-motion-kit/swipe-deck': patch
---

Migrate repository tooling from Yarn to pnpm while keeping the npm package published from the repository root.
30 changes: 7 additions & 23 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,17 @@ description: Setup Node.js and install dependencies
runs:
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa # v4
with:
run_install: false

- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: .nvmrc

- name: Restore dependencies
id: yarn-cache
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
**/node_modules
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-
cache: pnpm

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
run: pnpm install --frozen-lockfile
shell: bash

- name: Cache dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
**/node_modules
.yarn/install-state.gz
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
uses: ./.github/actions/setup

- name: Check formatting
run: yarn format:check
run: pnpm format:check

- name: Lint files
run: yarn lint:ci
run: pnpm lint:ci

- name: Typecheck files
run: yarn typecheck
run: pnpm typecheck

test:
runs-on: ubuntu-latest
Expand All @@ -45,7 +45,7 @@ jobs:
uses: ./.github/actions/setup

- name: Run unit tests
run: yarn test --maxWorkers=2 --coverage
run: pnpm test --maxWorkers=2 --coverage

build-library:
runs-on: ubuntu-latest
Expand All @@ -58,7 +58,13 @@ jobs:
uses: ./.github/actions/setup

- name: Build package
run: yarn prepare
run: pnpm build

- name: Build example bundle
run: yarn example:build
run: pnpm example:build

- name: Typecheck docs
run: pnpm docs:typecheck

- name: Build docs
run: pnpm docs:build
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
run: npm install -g npm@latest

- name: Build
run: yarn build
run: pnpm build

- name: Create Release Pull Request or Publish to yarn
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@3841a0683d3cfa6dae0f9bb335290003010fe3f0 # v1.9.0
with:
commit: 'chore(release): version packages'
title: 'chore(release): version packages'
version: 'yarn changeset version'
publish: 'yarn changeset publish'
version: 'pnpm changeset version'
publish: 'pnpm changeset publish'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 5 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,15 @@ example/vendor/
# node.js
#
node_modules/
.pnpm-store/
npm-debug.log
yarn-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Expo
.expo/

Expand All @@ -80,6 +71,7 @@ android/keystores/debug.keystore

# generated by bob
lib/
coverage/

# React Native Codegen
ios/generated
Expand All @@ -90,3 +82,6 @@ nitrogen/

# Expo export
example/dist/

# Rspress build
docs/doc_build/
2 changes: 1 addition & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"ignorePatterns": [".yarn/**", "lib/**", "*.min.js", "CHANGELOG.md"],
"ignorePatterns": ["lib/**", "*.min.js", "CHANGELOG.md"],
"sortImports": {
"groups": [
"type-import",
Expand Down
2 changes: 1 addition & 1 deletion .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@
"globals": {
"__DEV__": "readonly"
},
"ignorePatterns": [".yarn/**", "lib/**"]
"ignorePatterns": ["lib/**"]
}
940 changes: 0 additions & 940 deletions .yarn/releases/yarn-4.15.0.cjs

This file was deleted.

5 changes: 0 additions & 5 deletions .yarnrc.yml

This file was deleted.

75 changes: 36 additions & 39 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,41 @@ Contributions are always welcome, no matter how large or small!

We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md).

## Development workflow
## Development Workflow

This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:
This project uses pnpm workspaces for the example app and documentation site, while the npm package itself remains at the repository root. It contains:

- The library package in the root directory.
- An example app in the `example/` directory.
- The library package at the repository root.
- An example app in `example/`.
- The Rspress documentation site in `docs/`.

To get started with the project, make sure you have the correct version of [Node.js](https://nodejs.org/) installed. See the [`.nvmrc`](./.nvmrc) file for the version used in this project.
To get started, make sure you have the correct version of [Node.js](https://nodejs.org/) installed. See [`.nvmrc`](./.nvmrc) for the version used in this project.

Run `yarn` in the root directory to install the required dependencies for each package:
Enable Corepack and install dependencies from the root directory:

```sh
yarn
corepack enable
pnpm install
```

> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development without manually migrating.

The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.

It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.

You can use various commands from the root directory to work with the project.
The [example app](/example/) demonstrates usage of the library. It depends on the local root package through `workspace:*`, so changes under `src` are reflected in the example app.

To start the packager:

```sh
yarn example start
pnpm example start
```

To run the example app on Android:

```sh
yarn example android
pnpm example android
```

To run the example app on iOS:

```sh
yarn example ios
pnpm example ios
```

To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:
Expand All @@ -56,48 +52,49 @@ Note the `"fabric":true` and `"concurrentRoot":true` properties.
Make sure your code passes TypeScript:

```sh
yarn typecheck
pnpm typecheck
```

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

```sh
yarn test
pnpm test
```

### Commit message convention
## Commit Message Convention

We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for commit messages:

- `fix`: bug fixes, e.g. fix crash due to deprecated method.
- `feat`: new features, e.g. add new method to the module.
- `refactor`: code refactor, e.g. migrate from class components to hooks.
- `docs`: changes into documentation, e.g. add usage example for the module.
- `test`: adding or updating tests, e.g. add integration tests using detox.
- `test`: adding or updating tests, e.g. add integration tests.
- `chore`: tooling changes, e.g. change CI config.

Our pre-commit hooks verify that your commit message matches this format when committing.

### Scripts

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

- `yarn`: setup project by installing dependencies.
- `yarn format`: format supported files with Oxfmt.
- `yarn format:check`: check formatting without writing files.
- `yarn lint`: lint source files with Oxlint.
- `yarn lint:fix`: apply safe Oxlint fixes.
The root `package.json` contains scripts for common tasks:

OXC owns formatting for JavaScript, TypeScript, JSON, YAML, and Markdown files.
Oxlint uses the same strict categories as the reference library, including `nursery` as errors, so OXC version upgrades should be intentional and verified with the full local check sequence. React-specific lint settings follow the shared React minor used by the root library and example app.
- `pnpm install`: install workspace dependencies.
- `pnpm format`: format supported files with Oxfmt.
- `pnpm format:check`: check formatting without writing files.
- `pnpm lint`: lint source files with Oxlint.
- `pnpm lint:fix`: apply safe Oxlint fixes.
- `pnpm typecheck`: type-check the library package.
- `pnpm test`: run library unit tests with [Jest](https://jestjs.io/).
- `pnpm build`: build the root library package with Bob.
- `pnpm example start`: start the Metro server for the example app.
- `pnpm example android`: run the example app on Android.
- `pnpm example ios`: run the example app on iOS.
- `pnpm docs:typecheck`: type-check the Rspress docs package.
- `pnpm docs:build`: build the Rspress docs package.

- `yarn typecheck`: type-check files with TypeScript.
- `yarn test`: run unit tests with [Jest](https://jestjs.io/).
- `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.
OXC owns formatting for JavaScript, TypeScript, JSON, YAML, and Markdown files. Oxlint uses the same strict categories as the reference library, including `nursery` as errors, so OXC version upgrades should be intentional and verified with the full local check sequence.

### Sending a pull request
## Sending A Pull Request

> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).

Expand Down
2 changes: 0 additions & 2 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ expo-env.d.ts

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
Expand Down
7 changes: 4 additions & 3 deletions example/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const path = require('path');
const { getDefaultConfig } = require('@expo/metro-config');
const { getConfig } = require('react-native-builder-bob/metro-config');
const { withMetroConfig } = require('react-native-monorepo-config');

const root = path.resolve(__dirname, '..');

const config = getConfig(getDefaultConfig(__dirname), {
const config = withMetroConfig(getDefaultConfig(__dirname), {
root,
project: __dirname,
dirname: __dirname,
workspaces: ['.', 'example', 'docs'],
});

config.resolver.unstable_enablePackageExports = true;
Expand Down
5 changes: 3 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
"react-native": "0.83.6",
"react-native-gesture-handler": "^2.31.2",
"react-native-reanimated": "^4.4.0",
"react-native-worklets": "^0.9.1"
"react-native-worklets": "^0.10.0"
},
"devDependencies": {
"@babel/core": "^7.28.0",
"@react-native/metro-config": "0.83.6",
"@types/babel__core": "^7"
"@types/babel__core": "^7",
"react-native-monorepo-config": "^0.3.5"
}
}
10 changes: 5 additions & 5 deletions lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ pre-commit:
commands:
fmt:
glob: '**/*.{js,jsx,ts,tsx,json,yml,yaml,md}'
run: yarn format {staged_files}
run: pnpm format {staged_files}
stage_fixed: true
fmt-config:
glob: '.ox*.json'
run: yarn format {staged_files}
run: pnpm format {staged_files}
stage_fixed: true
lint:
glob: '**/*.{js,ts,jsx,tsx}'
run: yarn lint {staged_files}
run: pnpm lint {staged_files}
types:
glob: '**/*.{js,jsx,ts,tsx}'
run: yarn typecheck
run: pnpm typecheck
commit-msg:
parallel: true
commands:
commitlint:
run: yarn commitlint --edit {1}
run: pnpm exec commitlint --edit {1}
Loading
Loading