Skip to content

Commit

Permalink
chore: add a custom yarn script to make setup easier (callstack#2434)
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 authored Dec 15, 2020
1 parent 6824188 commit 3813316
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-each-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn bootstrap
run: yarn

- name: Publish Expo app
working-directory: ./example
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Setup Expo
uses: expo/expo-github-action@v5
with:
expo-version: 3.x
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
expo-cache: true

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn bootstrap
run: yarn

- name: Publish Expo app
working-directory: ./example
Expand Down
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn-path "scripts/bootstrap.js"
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The core team works directly on GitHub and all work is public.
> **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).
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/)).
2. Run `yarn bootstrap` to setup the development environment.
2. Run `yarn` to setup the development environment.
3. Do the changes you want and test them out in the example app before sending a pull request.

### Commit message convention
Expand Down
4 changes: 2 additions & 2 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ You can run the React Native app with [this Snack](https://snack.expo.io/@react-

If you want to run the example from the repo,

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

## Web App

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

- Clone the repository and run `yarn bootstrap` in the root
- Clone the repository and run `yarn` in the root
- Run `yarn example web` to start the webpack server and open the app in your browser
15 changes: 15 additions & 0 deletions scripts/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const child_process = require('child_process');

const args = process.argv.slice(2);
const options = {
cwd: process.cwd(),
env: process.env,
stdio: [process.stdin, process.stdout, process.stderr],
encoding: 'utf-8',
};

if (args.length) {
child_process.spawnSync('yarn', args, options);
} else {
child_process.spawnSync('yarn', ['bootstrap'], options);
}

0 comments on commit 3813316

Please sign in to comment.