Skip to content

Commit

Permalink
One-stop-shop for "yarn watch"
Browse files Browse the repository at this point in the history
Should be able to run it from mobile and watch [shared] and [web] as well
  • Loading branch information
jsubloom committed Sep 12, 2023
1 parent 1551490 commit 4208882
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 34 deletions.
7 changes: 7 additions & 0 deletions packages/mobile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Expo/React Native driver wrapping @bloom-reader-lite/app goes here
It should also provide a backend or pseudo-backend to handle native-specific requests.

# Build loop

yarn
yarn start

Any changes you make in [web] or [mobile] should be hot reloaded.

# Development Notes

After updating something in the "shared" package, you often need to manually Restart Typescript Server (use Ctrl+Shift+P in Visual Studio) before it gets the updates, unfortunately. I'm not sure why it has trouble picking it up.
Expand Down
6 changes: 0 additions & 6 deletions packages/mobile/TODO.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
Hot reloading doesn't seem to work right. When the webapp is changed, the Expo app will hot reload but oftentimes the webview will report an error or a blank screen and you'll have to restart the app (meaning you don't really get hot reload)
I thought at one point i fixed some state resetting problems and it was working nicely again (temporarily)

Change the status bar color
AppBar needs some padding - amount TBD

Android builds fail in beta and release - Looks like https://github.com/expo/expo/issues/23265. Does this workaround work? https://github.com/expo/expo/issues/23265#issuecomment-1662709655
Well, or if you just publish the packages to the NPM repository, that would solve it for the release case. For local builds, you can continue using yarn link, and we have a viable workaround in local development and alpha mode.

packages/mobile's copyWebDist.ts

- Make it so that when you run "yarn start", it also watches for changes from web.
Expand Down
30 changes: 20 additions & 10 deletions packages/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@
"license": "MIT",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "yarn copy:web && tsc && cross-env RELEASE_CHANNEL=developer expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"build:ios": "yarn && eas build --platform ios --profile developer",
"build:ios:prod": "yarn && eas build --platform ios --profile production",
"preinstall": "cd ../shared && yarn && yarn build && cd ../web && yarn && yarn build && cd ../mobile",
"postinstallComments": "// Runs automatically after running 'yarn' or 'yarn install'",
"postinstall": "yarn copy:web",
"copy:web": "ts-node scripts/copyWebDist.ts"
"start": "tsc && npm-run-all --parallel watch start:expo",
"start:expo": "cross-env RELEASE_CHANNEL=developer expo start",
"start:android": "expo start --android",
"start:ios": "expo start --ios",
"build": "yarn build:all",
"build:all": "npm-run-all build:shared build:web copy:webDist build:mobile",
"build:shared": "cd ../shared && yarn && yarn build && cd ../mobile",
"build:web": "cd ../web && yarn && yarn build && cd ../mobile",
"build:mobile": "tsc",
"copy:webDist": "ts-node scripts/copyWebDist.ts",
"eas:build:ios": "yarn && eas build --platform ios --profile developer",
"eas:build:ios:release": "yarn && eas build --platform ios --profile release",
"eas-build-post-install": "yarn build:shared && yarn build:web && yarn copy:webDist",
"watchComments": "This will watch the local packages that this app depends on, but you need to run start:expo to get hot reloading of the mobile app itself to trigger",
"watch": "npm-run-all --parallel watch:shared watch:web watch:webDist",
"watch:shared": "cd ../shared && yarn watch && cd ../mobile",
"watch:web": "cd ../web && yarn watch && cd ../mobile",
"watch:webDist": "chokidar \"../web/dist/**/*\" -c \"yarn copy:webDist\" --debounce 1000"
},
"dependencies": {
"@react-native-async-storage/async-storage": "1.18.2",
Expand All @@ -39,12 +47,14 @@
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
"babel-plugin-module-resolver": "^5.0.0",
"chokidar-cli": "^3.0.0",
"cpx": "^1.5.0",
"cross-env": "^7.0.3",
"eslint": "^8.48.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.0.0",
"npm-run-all": "^4.1.5",
"ts-node": "^10.9.1",
"typescript": "^5.1.3"
},
Expand Down
Loading

0 comments on commit 4208882

Please sign in to comment.