Skip to content

Commit

Permalink
Move postInstall script to a shell file
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed Jun 9, 2023
1 parent 93a7a3d commit 3d25bd0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MIT",
"private": true,
"scripts": {
"postinstall": "npx patch-package && cd desktop && npm install",
"postinstall": "scripts/postInstall.sh",
"clean": "npx react-native clean-project-auto",
"android": "scripts/set-pusher-suffix.sh && npx react-native run-android --port=8083",
"ios": "scripts/set-pusher-suffix.sh && npx react-native run-ios --port=8082",
Expand Down
16 changes: 16 additions & 0 deletions scripts/postInstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Go to project root
ROOT_DIR=$(dirname "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)")
cd "$ROOT_DIR" || exit 1

# Run patch-package
npx patch-package

# Install node_modules in subpackages, unless we're in a CI/CD environment.
# See `.github/actions/composite/setupNode/action.yml` for more context
if [[ -n ${CI+x} ]]; then
echo 'Installing desktop/node_modules'
cd desktop || exit 1
npm install
fi

0 comments on commit 3d25bd0

Please sign in to comment.