Skip to content

Commit

Permalink
[eas-cli] [ENG-11310] Don't require expo on fresh react-native project (
Browse files Browse the repository at this point in the history
#2235)

* [eas-cli] Don't require expo

Do not require expo to be installed and configured for a fresh react-native project

See: https://linear.app/expo/issue/ENG-11310/fix-warnings-errors-that-come-up-when-adding-eas-to-a-react-native-cli

* update CHANGELOG.md

* [eas-cli] Throw other errors

Forgot to rethrow other types of errors

See: https://linear.app/expo/issue/ENG-11310/fix-warnings-errors-that-come-up-when-adding-eas-to-a-react-native-cli
  • Loading branch information
radoslawkrzemien committed Feb 19, 2024
1 parent e157473 commit 9bf1f38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This is the log of notable changes to EAS CLI and related packages.

### 🐛 Bug fixes

- Don't require expo on fresh react-native project. ([#2235](https://github.com/expo/eas-cli/pull/2235) by [@radoslawkrzemien](https://github.com/radoslawkrzemien))

### 🧹 Chores

- Upgrade [`eas-build`](https://github.com/expo/eas-build) dependencies. ([#2229](https://github.com/expo/eas-cli/pull/2229) by [@expo-bot](https://github.com/expo-bot))
Expand Down
16 changes: 14 additions & 2 deletions packages/eas-cli/src/commands/project/init.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getProjectConfigDescription } from '@expo/config';
import { ConfigError, getProjectConfigDescription } from '@expo/config';
import { ExpoConfig } from '@expo/config-types';
import { Flags } from '@oclif/core';
import chalk from 'chalk';
Expand Down Expand Up @@ -60,7 +60,19 @@ export default class ProjectInit extends EasCommand {
projectDir: string,
modifications: Partial<ExpoConfig>
): Promise<void> {
const result = await createOrModifyExpoConfigAsync(projectDir, modifications);
let result;
try {
result = await createOrModifyExpoConfigAsync(projectDir, modifications);
} catch (error) {
if (error instanceof ConfigError && error.code === 'MODULE_NOT_FOUND') {
Log.warn(
'Cannot determine which native SDK version your project uses because the module `expo` is not installed.'
);
return;
} else {
throw error;
}
}
switch (result.type) {
case 'success':
break;
Expand Down

0 comments on commit 9bf1f38

Please sign in to comment.