Skip to content

Commit

Permalink
[expo-dev-launcher][expo-dev-menu] gate config plugin mods by SDK ver…
Browse files Browse the repository at this point in the history
…sion (#16495)
  • Loading branch information
esamelson committed Mar 3, 2022
1 parent 4771ed2 commit ca2c059
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 16 deletions.
1 change: 1 addition & 0 deletions packages/expo-dev-launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- Add the `isDevelopmentBuild` function to determine if you are running in a development build. ([#16486](https://github.com/expo/expo/pull/16486) by [@lukmccall](https://github.com/lukmccall))
- Add expo-modules automatic setup on Android. ([#16441](https://github.com/expo/expo/pull/16441) by [@esamelson](https://github.com/esamelson))
- Add support for auto-setup with updates integration on Android. ([#16442](https://github.com/expo/expo/pull/16442) by [@esamelson](https://github.com/esamelson))
- Remove regex-based config plugin mods in SDK 45+ projects. ([#16495](https://github.com/expo/expo/pull/16495) by [@esamelson](https://github.com/esamelson))

### 🐛 Bug fixes

Expand Down
12 changes: 8 additions & 4 deletions packages/expo-dev-launcher/plugin/build/withDevLauncher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions packages/expo-dev-launcher/plugin/src/withDevLauncher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,14 @@ const withErrorHandling: ConfigPlugin = (config) => {
};

const withDevLauncher = (config: ExpoConfig) => {
config = withDevLauncherActivity(config);
config = withDevLauncherApplication(config);
config = withDevLauncherPodfile(config);
config = withDevLauncherAppDelegate(config);
// projects using SDKs before 45 need the old regex-based integration
// TODO: remove these once we drop support for SDK 44
if (config.sdkVersion && semver.lt(config.sdkVersion, '45.0.0')) {
config = withDevLauncherActivity(config);
config = withDevLauncherApplication(config);
config = withDevLauncherPodfile(config);
config = withDevLauncherAppDelegate(config);
}
config = withErrorHandling(config);
return config;
};
Expand Down
1 change: 0 additions & 1 deletion packages/expo-dev-menu/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ __mocks__
__tests__

/babel.config.js
/metro.config.js
/android/src/androidTest/
/android/src/test/
1 change: 1 addition & 0 deletions packages/expo-dev-menu/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

- Add unit tests for react app. ([#16005](https://github.com/expo/expo/pull/16005) by [@ajsmth](https://github.com/ajsmth))
- Add expo-modules automatic setup on Android. ([#16441](https://github.com/expo/expo/pull/16441) by [@esamelson](https://github.com/esamelson))
- Remove regex-based config plugin mods in SDK 45+ projects. ([#16495](https://github.com/expo/expo/pull/16495) by [@esamelson](https://github.com/esamelson))

### 🐛 Bug fixes

Expand Down
3 changes: 2 additions & 1 deletion packages/expo-dev-menu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
},
"dependencies": {
"@expo/config-plugins": "^4.0.14",
"expo-dev-menu-interface": "0.5.1"
"expo-dev-menu-interface": "0.5.1",
"semver": "^7.3.5"
},
"devDependencies": {
"@apollo/client": "^3.4.10",
Expand Down
11 changes: 8 additions & 3 deletions packages/expo-dev-menu/plugin/build/withDevMenu.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions packages/expo-dev-menu/plugin/src/withDevMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { ExpoConfig } from '@expo/config-types';
import fs from 'fs';
import path from 'path';
import semver from 'semver';

import { InstallationPage } from './constants';
import { withDevMenuAppDelegate } from './withDevMenuAppDelegate';
Expand Down Expand Up @@ -118,9 +119,13 @@ const withDevMenuPodfile: ConfigPlugin = (config) => {
};

const withDevMenu = (config: ExpoConfig) => {
config = withDevMenuActivity(config);
config = withDevMenuPodfile(config);
config = withDevMenuAppDelegate(config);
// projects using SDKs before 45 need the old regex-based integration
// TODO: remove this config plugin once we drop support for SDK 44
if (config.sdkVersion && semver.lt(config.sdkVersion, '45.0.0')) {
config = withDevMenuActivity(config);
config = withDevMenuPodfile(config);
config = withDevMenuAppDelegate(config);
}
return config;
};

Expand Down

0 comments on commit ca2c059

Please sign in to comment.