Skip to content

Commit a034007

Browse files
authored
Replace yarn with pnpm (#762)
1 parent 62a1146 commit a034007

22 files changed

+15395
-23262
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module.exports = {
22
root: true,
33
extends: '@react-native-community',
4-
rules: {'prettier/prettier': ['error', {endOfLine: 'auto'}]},
54
};

.github/workflows/ci.yml

Lines changed: 77 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,119 +6,145 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
node-version: [14, 16]
9+
node-version: [16]
1010
steps:
1111
- uses: actions/checkout@v2
1212
- uses: actions/setup-node@v1
1313
with:
1414
node-version: ${{ matrix.node-version }}
15-
- name: Get yarn cache
16-
id: yarn-cache
17-
run: echo "::set-output name=dir::$(yarn cache dir)"
18-
- uses: actions/cache@v2
15+
- uses: pnpm/action-setup@v2
1916
with:
20-
path: ${{ steps.yarn-cache.outputs.dir }}
21-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
17+
version: 8.6.9
18+
- name: Get pnpm store directory
19+
id: pnpm-cache
20+
shell: bash
21+
run: |
22+
echo "::set-output name=dir::$(pnpm store path)"
23+
- uses: actions/cache@v3
24+
name: Setup pnpm cache
25+
with:
26+
path: ${{ steps.pnpm-cache.outputs.dir }}
27+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
28+
restore-keys: |
29+
${{ runner.os }}-pnpm-store-
2230
- name: Install Dependencies
23-
run: yarn
31+
run: pnpm install
2432
- name: ESLint Checks
25-
run: yarn lint
33+
run: pnpm lint
2634
flow:
2735
runs-on: ubuntu-latest
2836
strategy:
2937
matrix:
30-
node-version: [14, 16]
38+
node-version: [16]
3139
steps:
3240
- uses: actions/checkout@v2
3341
- uses: actions/setup-node@v1
3442
with:
3543
node-version: ${{ matrix.node-version }}
36-
- name: Get yarn cache
37-
id: yarn-cache
38-
run: echo "::set-output name=dir::$(yarn cache dir)"
39-
- uses: actions/cache@v2
44+
- uses: pnpm/action-setup@v2
45+
with:
46+
version: 8.6.9
47+
- name: Get pnpm cache
48+
id: pnpm-cache
49+
run: echo "::set-output name=dir::$(pnpm store path)"
50+
- uses: actions/cache@v3
51+
name: Setup pnpm cache
4052
with:
41-
path: ${{ steps.yarn-cache.outputs.dir }}
42-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
53+
path: ${{ steps.pnpm-cache.outputs.dir }}
54+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
55+
restore-keys: |
56+
${{ runner.os }}-pnpm-store-
4357
- name: Install Dependencies
44-
run: yarn
58+
run: pnpm install
4559
- name: Flow Checks
46-
run: yarn flow check
60+
run: pnpm flow check
4761
tsc:
4862
runs-on: ubuntu-latest
4963
strategy:
5064
matrix:
51-
node-version: [14, 16]
65+
node-version: [16]
5266
steps:
5367
- uses: actions/checkout@v2
5468
- uses: actions/setup-node@v1
5569
with:
5670
node-version: ${{ matrix.node-version }}
57-
- name: Get yarn cache
58-
id: yarn-cache
59-
run: echo "::set-output name=dir::$(yarn cache dir)"
60-
- uses: actions/cache@v2
71+
- uses: pnpm/action-setup@v2
72+
with:
73+
version: 8.6.9
74+
- name: Get pnpm cache
75+
id: pnpm-cache
76+
run: echo "::set-output name=dir::$(pnpm store path)"
77+
- uses: actions/cache@v3
78+
name: Setup pnpm cache
6179
with:
62-
path: ${{ steps.yarn-cache.outputs.dir }}
63-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
80+
path: ${{ steps.pnpm-cache.outputs.dir }}
81+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
82+
restore-keys: |
83+
${{ runner.os }}-pnpm-store-
6484
- name: Install Dependencies
65-
run: yarn
85+
run: pnpm install
6686
- name: TypeScript type check
67-
run: yarn tsc
87+
run: pnpm tsc
6888
android:
6989
runs-on: ubuntu-latest
7090
strategy:
7191
matrix:
72-
node-version: [14, 16]
92+
node-version: [16]
7393
java-version: [11]
7494
steps:
7595
- uses: actions/checkout@v2
7696
- uses: actions/setup-node@v1
7797
with:
7898
node-version: ${{ matrix.node-version }}
99+
- uses: pnpm/action-setup@v2
100+
with:
101+
version: 8.6.9
79102
- uses: actions/setup-java@v3
80103
with:
81104
distribution: 'zulu'
82105
java-version: ${{ matrix.java-version }}
83-
- name: Get yarn cache
84-
id: yarn-cache
85-
run: echo "::set-output name=dir::$(yarn cache dir)"
86-
- uses: actions/cache@v2
106+
- name: Get pnpm cache
107+
id: pnpm-cache
108+
run: echo "::set-output name=dir::$(pnpm store path)"
109+
- uses: actions/cache@v3
110+
name: Setup pnpm cache
87111
with:
88-
path: ${{ steps.yarn-cache.outputs.dir }}
89-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
112+
path: ${{ steps.pnpm-cache.outputs.dir }}
113+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
114+
restore-keys: |
115+
${{ runner.os }}-pnpm-store-
90116
- name: Install Dependencies
91-
run: yarn
92-
- name: Install Example Dependencies
93-
run: cd example && yarn
117+
run: pnpm install
94118
- name: Build android
95-
run: cd example && yarn build:android
119+
run: cd example && pnpm build:android
96120
- name: Build Android Example App and Library
97121
run: cd example/android && ./gradlew clean assembleDebug
98122
ios:
99123
runs-on: macos-latest
100124
strategy:
101125
matrix:
102-
node-version: [14, 16]
126+
node-version: [16]
103127
steps:
104128
- uses: actions/checkout@v2
105129
- uses: actions/setup-node@v1
106130
with:
107131
node-version: ${{ matrix.node-version }}
108-
- name: Get yarn cache
109-
id: yarn-cache
110-
run: echo "::set-output name=dir::$(yarn cache dir)"
111-
- uses: actions/cache@v2
132+
- uses: pnpm/action-setup@v2
133+
with:
134+
version: 8.6.9
135+
- name: Get pnpm cache
136+
id: pnpm-cache
137+
run: echo "::set-output name=dir::$(pnpm store path)"
138+
- uses: actions/cache@v3
139+
name: Setup pnpm cache
112140
with:
113-
path: ${{ steps.yarn-cache.outputs.dir }}
114-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
141+
path: ${{ steps.pnpm-cache.outputs.dir }}
142+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
143+
restore-keys: |
144+
${{ runner.os }}-pnpm-store-
115145
- name: Install Dependencies
116-
run: yarn
117-
- name: Install Example
118-
run: cd example && yarn
146+
run: pnpm install
119147
- name: Build ios
120-
run: cd example && yarn build:ios
148+
run: cd example && pnpm build:ios
121149
- name: Pod install
122150
run: cd example && pod install --project-directory=ios
123-
- name: Run ios app
124-
run: cd example && yarn ios

.github/workflows/publish.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,25 @@ jobs:
1818
- uses: actions/setup-node@v1
1919
with:
2020
node-version: ${{ matrix.node-version }}
21-
- name: Get yarn cache
22-
id: yarn-cache
23-
run: echo "::set-output name=dir::$(yarn cache dir)"
24-
- uses: actions/cache@v2
21+
- uses: pnpm/action-setup@v2
2522
with:
26-
path: ${{ steps.yarn-cache.outputs.dir }}
27-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
23+
version: 8.6.9
24+
- name: Get pnpm store directory
25+
id: pnpm-cache
26+
shell: bash
27+
run: |
28+
echo "::set-output name=dir::$(pnpm store path)"
29+
- uses: actions/cache@v3
30+
name: Setup pnpm cache
31+
with:
32+
path: ${{ steps.pnpm-cache.outputs.dir }}
33+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pnpm-store-
2836
- name: Install Dependencies
29-
run: yarn
37+
run: pnpm
3038
- name: Publish Package
31-
run: yarn ci:publish
39+
run: pnpm ci:publish
3240
env:
3341
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
3442
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node-linker=hoisted
2+
shamefully-hoist=true
3+
auto-install-peers=true

CONTRIBUTING.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ All work on React Native SegmentedControl happens directly on GitHub. Contributo
77
> **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://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
88
99
1. Fork the repo and create your branch from `master` (a guide on [how to fork a repository](https://help.github.com/articles/fork-a-repo/)).
10-
2. Run `yarn` or `npm install` to install all required dependencies.
10+
2. Run `pnpm install` to install all required dependencies.
1111
3. Now you are ready to make your changes!
1212

1313
## Tests & Verifications
1414

1515
Currently we use `flow` for typechecking, `eslint` with `prettier` for linting and formatting the code, and `jest` for unit testing. We also use `detox` for end-to-end testing. All of these are run on Github Actions for all opened pull requests, but you should use them locally when making changes.
1616

17-
- `yarn test`: Run all tests and validations.
18-
- `yarn lint`: Run `eslint`.
19-
- `yarn lint --fix`: Run `eslint` and automatically fix issues. This is useful for correcting code formatting.
20-
- `yarn flow`: Run `flow` typechecking.
21-
<!-- * `yarn validate:typescript`: Run `typescript` typechecking. -->
22-
<!-- * `yarn test:jest`: Run unit tests with `jest`. -->
23-
<!-- * `yarn test:detox:<android|ios>:build:<debug|release>`: Build the `debug` or `release` app for end-to-end tests with `detox` on either `android` or `ios`. You need to run this before running the test command and whenever you make changes to the native code. -->
24-
<!-- * `yarn test:detox:<android|ios>:test:<debug|release>`: Run the `debug` or `release` end-to-end tests with `detox` on either `android` or `ios`. -->
17+
- `pnpm test`: Run all tests and validations.
18+
- `pnpm lint`: Run `eslint`.
19+
- `pnpm lint --fix`: Run `eslint` and automatically fix issues. This is useful for correcting code formatting.
20+
- `pnpm flow`: Run `flow` typechecking.
21+
<!-- * `pnpm test:jest`: Run unit tests with `jest`. -->
22+
<!-- * `pnpm test:detox:<android|ios>:build:<debug|release>`: Build the `debug` or `release` app for end-to-end tests with `detox` on either `android` or `ios`. You need to run this before running the test command and whenever you make changes to the native code. -->
23+
<!-- * `pnpm test:detox:<android|ios>:test:<debug|release>`: Run the `debug` or `release` end-to-end tests with `detox` on either `android` or `ios`. -->
2524

2625
## Sending a pull request
2726

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,22 @@ This module is NOT supported in the Expo Go app on iOS, because it requires cust
2323

2424
## Getting started
2525

26-
Install the library using either Yarn:
26+
Install the library using your package manager:
27+
28+
pnpm:
29+
30+
```
31+
pnpm install --save @react-native-segmented-control/segmented-control
32+
```
33+
34+
35+
yarn:
2736

2837
```
2938
yarn add @react-native-segmented-control/segmented-control
3039
```
3140

32-
or npm:
41+
npm:
3342

3443
```
3544
npm install --save @react-native-segmented-control/segmented-control

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['module:metro-react-native-babel-preset'],
3+
};

example/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @flow
66
*/
77

8-
import SegmentedControl from '@react-native-segmented-control/segmented-control';
8+
import SegmentedControl from '..';
99
import React, {useEffect, useState} from 'react';
1010
import {ScrollView, StyleSheet, Text, View, useColorScheme} from 'react-native';
1111

example/ios/.xcode.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export NODE_BINARY=/Users/naturalclar/.volta/tools/image/node/18.15.0/bin/node

example/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require_relative '../node_modules/react-native-test-app/test_app'
1+
require_relative '../../node_modules/react-native-test-app/test_app'
22

33
use_flipper!({ 'Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3' })
44

0 commit comments

Comments
 (0)