-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(cli): Expo Go compat deps * feat(tests) Add expo go config changes tests I also moved around the expo go configuration and `findAndUpdateDependencyVersions()` function so that it would be easier to test. --------- Co-authored-by: Mark Rickert <mjar81@gmail.com>
- Loading branch information
1 parent
9b768dd
commit fce89e1
Showing
5 changed files
with
981 additions
and
1,040 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// The expoGoCompat object specifies version overrides for packages that are not | ||
// compatible with the Expo Go app. We use this object to specify the latest compatible | ||
// version of each package when generating a new project using Expo Go. | ||
// New ignited apps using prebuild will have more up-to-date versions of these packages. | ||
export const expoGoCompatExpectedVersions = { | ||
"@react-native-async-storage/async-storage": "1.18.2", | ||
"expo-application": "~5.3.0", | ||
"expo-device": "~5.4.0", | ||
"expo-file-system": "~15.4.4", | ||
"expo-font": "~11.4.0", | ||
"expo-localization": "~14.3.0", | ||
} | ||
|
||
// This function takes a package.json file as a string and updates the versions of the | ||
// dependencies specified in expoGoCompatExpectedVersions to the values in that object | ||
// and returns the updated package.json as a string. | ||
// This function is used when generating a new project using Expo Go. | ||
export function findAndUpdateDependencyVersions( | ||
packageJsonRaw: string, | ||
dependencies: Record<string, string>, | ||
): string { | ||
let updatedPackageJson = packageJsonRaw | ||
|
||
Object.keys(dependencies).forEach((depName) => { | ||
const desiredVersion = dependencies[depName] | ||
const regex = new RegExp(`"${depName}"\\s*:\\s*"[^"]+"`, "g") | ||
updatedPackageJson = updatedPackageJson.replace(regex, `"${depName}": "${desiredVersion}"`) | ||
}) | ||
|
||
return updatedPackageJson | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.