Skip to content

Commit 3813316

Browse files
authored
chore: add a custom yarn script to make setup easier (callstack#2434)
1 parent 6824188 commit 3813316

File tree

6 files changed

+25
-9
lines changed

6 files changed

+25
-9
lines changed

Diff for: .github/workflows/publish-each-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
${{ runner.os }}-yarn-
3737
3838
- name: Install dependencies
39-
run: yarn bootstrap
39+
run: yarn
4040

4141
- name: Publish Expo app
4242
working-directory: ./example

Diff for: .github/workflows/publish.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,28 @@ jobs:
1515
uses: actions/setup-node@v1
1616
with:
1717
node-version: 12.x
18-
18+
1919
- name: Setup Expo
2020
uses: expo/expo-github-action@v5
2121
with:
2222
expo-version: 3.x
2323
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
2424
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
2525
expo-cache: true
26-
26+
2727
- name: Get yarn cache
2828
id: yarn-cache
2929
run: echo "::set-output name=dir::$(yarn cache dir)"
30-
30+
3131
- uses: actions/cache@v1
3232
with:
3333
path: ${{ steps.yarn-cache.outputs.dir }}
3434
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3535
restore-keys: |
3636
${{ runner.os }}-yarn-
37-
37+
3838
- name: Install dependencies
39-
run: yarn bootstrap
39+
run: yarn
4040

4141
- name: Publish Expo app
4242
working-directory: ./example

Diff for: .yarnrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yarn-path "scripts/bootstrap.js"

Diff for: CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The core team works directly on GitHub and all work is public.
1313
> **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).
1414
1515
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/)).
16-
2. Run `yarn bootstrap` to setup the development environment.
16+
2. Run `yarn` to setup the development environment.
1717
3. Do the changes you want and test them out in the example app before sending a pull request.
1818

1919
### Commit message convention

Diff for: example/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ You can run the React Native app with [this Snack](https://snack.expo.io/@react-
66

77
If you want to run the example from the repo,
88

9-
- Clone the repository and run `yarn bootstrap` in the root
9+
- Clone the repository and run `yarn` in the root
1010
- Run `yarn example start` to start the packager
1111
- Follow the instructions to open it with the [Expo app](https://expo.io/)
1212

1313
## Web App
1414

1515
You can also run the example app as a web app using [react-native-web](https://github.com/necolas/react-native-web),
1616

17-
- Clone the repository and run `yarn bootstrap` in the root
17+
- Clone the repository and run `yarn` in the root
1818
- Run `yarn example web` to start the webpack server and open the app in your browser

Diff for: scripts/bootstrap.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const child_process = require('child_process');
2+
3+
const args = process.argv.slice(2);
4+
const options = {
5+
cwd: process.cwd(),
6+
env: process.env,
7+
stdio: [process.stdin, process.stdout, process.stderr],
8+
encoding: 'utf-8',
9+
};
10+
11+
if (args.length) {
12+
child_process.spawnSync('yarn', args, options);
13+
} else {
14+
child_process.spawnSync('yarn', ['bootstrap'], options);
15+
}

0 commit comments

Comments
 (0)