Skip to content

Commit

Permalink
Add INTERNALLY_TEST_PREBUILD
Browse files Browse the repository at this point in the history
  • Loading branch information
robertherber committed Jan 27, 2025
1 parent 1ef869a commit 7dc9df9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ The example project is linked specifically to simplify development. This means i
- The swift files in the targets folder are linked to the root project instead of duplicated. If adding new swift files, try to link them instead of duplicating to keep things clean.
- The entitlements and info.plist files however duplicated - to not mess with the example project/signing etc.
- There is a Shared.swift file that can be accessed by all targets. This is linked to each target in the example project, but in the published package it's copied and duplicated to each target. I prefer this to making more changes in @bacons/xcode package which only supports swift files on the root level of each target directory.

## Prebuild
To try out prebuild functionality (i.e. the config plugin) run `npm run prebuild` in the example project (it uses the `INTERNALLY_TEST_PREBUILD` env variable to behave like a published package). This should be used to verify changes are expected, but the result should not in it's full state be commited to the example project, since it will break the DX of the example project as explained above.
5 changes: 3 additions & 2 deletions config-plugin/getAppGroupFromExpoConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ const getAppGroupFromExpoConfig = (config) => {
if (Array.isArray(plugin)) {
const [pluginName] = plugin;
return (
pluginName === "react-native-device-activity"
// || pluginName === "../app.plugin.js" // only for trying it out locally
pluginName === "react-native-device-activity" ||
(process.env.INTERNALLY_TEST_PREBUILD &&
pluginName === "../app.plugin.js")
);
}

Expand Down
2 changes: 1 addition & 1 deletion config-plugin/withCopyTargetFolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require("fs");

/** @type {import('@expo/config-plugins').ConfigPlugin<{ appGroup: string; copyToTargetFolder?: boolean }>} */
const withCopyTargetFolder = (config, { copyToTargetFolder = true }) => {
if (!copyToTargetFolder) {
if (!copyToTargetFolder && !process.env.INTERNALLY_TEST_PREBUILD) {
return config;
}

Expand Down
3 changes: 2 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"prebuild": "rm -rf targets && INTERNALLY_TEST_PREBUILD=true npx expo prebuild --platform=ios --clean"
},
"dependencies": {
"expo": "~51.0.39",
Expand Down

0 comments on commit 7dc9df9

Please sign in to comment.