Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Fix formatting and verbiage issues in Bare and brownfield guides #28242

Merged
merged 5 commits into from Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/common/error-utilities.ts
Expand Up @@ -448,5 +448,5 @@ const RENAMED_PAGES: Record<string, string> = {
'/guides/customizing-webpack': '/archive/customizing-webpack',

// Stop encouraging usage of Expo Go when using native modules
'/bare/using-expo-client': '/archive/using-expo-client',
'/bare/using-expo-client/': '/archive/using-expo-client/',
};
1 change: 1 addition & 0 deletions docs/constants/navigation.js
Expand Up @@ -516,6 +516,7 @@ const archive = [
makePage('archive/notification-channels.mdx'),
makePage('archive/publishing-websites-webpack.mdx'),
makePage('archive/customizing-webpack.mdx'),
makePage('archive/using-expo-client.mdx'),
makePage('archive/glossary.mdx'),
]),
];
Expand Down
3 changes: 3 additions & 0 deletions docs/deploy.sh
Expand Up @@ -349,6 +349,9 @@ redirects[versions/latest/sdk/overview]=versions/latest
# Deprecated webpack
redirects[guides/customizing-webpack]=archive/customizing-webpack

# Stop encouraging usage of Expo Go when using native modules
redirects[bare/using-expo-client]=archive/using-expo-client

echo "::group::[5/6] Add custom redirects"
for i in "${!redirects[@]}" # iterate over keys
do
Expand Down
26 changes: 13 additions & 13 deletions docs/pages/bare/install-dev-builds-in-bare.mdx
Expand Up @@ -13,23 +13,21 @@ The following guide explains how to install and configure `expo-dev-client` in a

<Collapsible summary="Do you need to create a new project?">

If you're starting a project, you can create a new project with the `with-dev-client` template. Run this command to initialize the project:
If you're starting with a new project, create it using the `with-dev-client` template:

<Terminal cmd={['$ npx create-expo-app -e with-dev-client']} />

</Collapsible>

<Collapsible summary="Do you use Continuous Native Generation (CNG) in your project?">

You may be reading the wrong guide then! To use `expo-dev-client` in a project that uses [CNG](/workflow/continuous-native-generation/), see ["Create a development build"](/develop/development-builds/create-a-build/).
You may be reading the wrong guide then. To use `expo-dev-client` in a project that uses [CNG](/workflow/continuous-native-generation/), see [Create a development build](/develop/development-builds/create-a-build/).

</Collapsible>

## Prerequisites

**The `expo` package must be installed and configured**: if you created your project with `npx react-native init` and do not have any other Expo packages installed, you will need to [install Expo modules](/bare/installing-expo-modules) before proceeding.

## Installation
**The `expo` package must be installed and configured.** If you created your project with `npx react-native init` and do not have any other Expo libraries installed, you will need to [install Expo modules](/bare/installing-expo-modules) before proceeding.

<Step label="1">

Expand All @@ -39,44 +37,46 @@ Add the `expo-dev-client` library to your **package.json**:

<Terminal cmd={['$ npx expo install expo-dev-client']} />

If your project has an **ios/** directory on disk, run the following command to fully install the native code for `expo-dev-client`:
If your project has an **ios** directory on disk, run the following command to fully install the native code for `expo-dev-client`:

<Terminal cmd={['$ npx pod-install']} />

If your project doesn't have an **ios/** directory, you can skip this step.
If your project doesn't have an **ios** directory, you can skip this step.

</Step>

<Step label="2">

## Configure deep links

Expo CLI uses a deep link to launch your project, and it's also useful if you use plan to [use `expo-dev-client` for launching preview updates](/eas-update/getting-started/) if you have added a custom deep link scheme to your project. If you haven't configured a `scheme` for your app yet to support deep linking, then you can use `uri-scheme` package to do this for you.
Expo CLI uses a deep link to launch your project, and it's also useful if you use plan to [use `expo-dev-client` for launching preview updates](/eas-update/getting-started/) if you have added a custom deep link scheme to your project.

If you haven't configured a `scheme` for your app yet to support deep linking, then use `uri-scheme` library to do this for you.

<Terminal
cmd={[
"# List your project's schemes",
'$ npx uri-scheme list',
'',
'# Add a scheme to your project',
'$ npx uri-scheme add <your scheme>',
'$ npx uri-scheme add your-scheme',
]}
/>

For more information, see [uri-scheme package](https://www.npmjs.com/package/uri-scheme).
For more information, see the [`uri-scheme` library](https://www.npmjs.com/package/uri-scheme).

</Step>

<Step label="3">

## Add additional optional configuration

For certain type of errors, you can provide more helpful error messages. To turn this on, import `expo-dev-client` in the project's **index** file (in the managed workflow, you need to add this import on top of the **App.&lbrace;js|tsx&rbrace;**). Make sure that the import statement is above `import App from './App'`.
For certain types of errors, you can provide more helpful error messages. To turn this on, import `expo-dev-client` in the project's **index** file (in the managed workflow, you need to add this import on top of the **App.&lbrace;js|tsx&rbrace;**). Make sure that the import statement is above `import App from './App'`.

```js
import 'expo-dev-client';
...
import App from "./App";
/* @hide ... */ /* @end */
import App from './App';
```

For more information, see [Error handling](/develop/development-builds/use-development-builds/#add-error-handling).
Expand Down
168 changes: 95 additions & 73 deletions docs/pages/bare/installing-updates.mdx
Expand Up @@ -7,43 +7,65 @@ description: Learn how to install and configure expo-updates in bare React Nativ
import { Terminal } from '~/ui/components/Snippet';
import { DiffBlock } from '~/ui/components/Snippet';
import { Collapsible } from '~/ui/components/Collapsible';
import { Tabs, Tab } from '~/ui/components/Tabs';

The `expo-updates` library fetches and manages updates to app JavaScript and assets received from a remote server. It supports [EAS Update](/eas-update/introduction), a hosted service that serves updates and provides a variety of tools for managing them. It can also be configured to work with a [custom server](/eas-update/custom-updates-server/). This guide explains how set it up for use with EAS Update.
The `expo-updates` library fetches and manages updates to an app's JavaScript and assets that are received from a remote server. It supports [EAS Update](/eas-update/introduction), a hosted service that serves updates and provides a variety of tools for managing them. It can also be configured to work with a [custom server](/eas-update/custom-updates-server/). This guide explains how to set it up for use with EAS Update.

<Collapsible summary="Do you need to create a new project?">

If you are creating a new project, we recommend using `npx create-expo-app --template bare-minimum` (or `yarn create expo-app --template bare-minimum`) because it will handle the following configuration for you automatically. It includes the `expo-updates` [config plugin](/config-plugins/introduction/), which will handle the installation steps for you.
If you are creating a new project, we recommend using the following command:

<Tabs>

<Tab label="npm">

<Terminal cmd={['$ npx create-expo-app --template bare-minimum']} />

</Tab>

<Tab label="yarn">

<Terminal cmd={['$ yarn create expo-app --template bare-minimum']} />

</Tab>

</Tabs>

Running this command will create a new project from the `bare-minimum` template that will handle configuring the `expo-updates` [config plugin](/config-plugins/introduction/) and the installation steps described in the following sections of this guide.

</Collapsible>

<Collapsible summary="Do you use Continuous Native Generation (CNG) in your project?">

You may be reading the wrong guide then! To use `expo-updates` in a project that uses [CNG](/workflow/continuous-native-generation/), refer to the [EAS Update "Get started" guide](/eas-update/getting-started/).
You may be reading the wrong guide then. To use `expo-updates` in a project that uses [CNG](/workflow/continuous-native-generation/), see [EAS Update "Get started"](/eas-update/getting-started/).

</Collapsible>

## Prerequisites

**The `expo` package must be installed and configured**: if you created your project with `npx react-native init` and do not have any other Expo packages installed, you will need to [install Expo modules](/bare/installing-expo-modules) before proceeding.
**The `expo` package must be installed and configured.** If you created your project with `npx react-native init` and do not have any other Expo libraries installed, you will need to [install Expo modules](/bare/installing-expo-modules) before proceeding.

## Installation

To get started, install `expo-updates`:

<Terminal cmd={['$ npx expo install expo-updates']} />

Then, install pods:
Then, install pods for iOS:

<Terminal cmd={['$ npx pod-install']} />

Once installation is complete, apply the changes from the following diffs to configure `expo-updates` in your project.
## Configuring expo-updates library

Apply the changes from the diffs from the following sections to configure `expo-updates` in your project.

### Configuration in JavaScript and JSON
### JavaScript and JSON

Modify the `expo` section of **app.json**. (If you originally created your app using `npx react-native init`, you will need to add this section.)
The changes below add the updates URL to the Expo configuration.
Modify the `expo` section of **app.json**. (If you created your project using `npx react-native init`, you will need to add this section.)

> The example `updates` URL and `projectId` shown below are for use with EAS Update. The EAS CLI sets this URL correctly for the EAS Update service when running `eas update:configure`.
The changes below add the [`updates` URL](/versions/latest/config/app/#url) to the Expo configuration.

> The example `updates` URL and `projectId` shown below are used with EAS Update. The EAS CLI sets this URL correctly for the EAS Update service when running `eas update:configure`.

```diff app.json
{
Expand Down Expand Up @@ -93,65 +115,7 @@ If you want to set up a [custom server](/eas-update/custom-updates-server) inste
}
```

### Configuration for iOS

Add the file **Podfile.properties.json** to the **ios** directory:

```json ios/Podfile.properties.json
{
"expo.jsEngine": "hermes"
}
```

Modify **ios/Podfile** to check for the JS engine configuration (JSC or Hermes) in Expo files:

```diff ios/Podfile
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -2,6 +2,9 @@ require File.join(File.dirname(`node --print "require.resolve('expo/package.json
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

+require 'json'
+podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
+
platform :ios, '13.0'
prepare_react_native_project!

@@ -41,7 +44,7 @@ target 'MyApp' do
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
- :hermes_enabled => flags[:hermes_enabled],
+ :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#

```

Add the **Supporting** directory containing **Expo.plist** to your project in Xcode with the following content, to match the content in **app.json**:

```xml Expo.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EXUpdatesCheckOnLaunch</key>
<string>ALWAYS</string>
<key>EXUpdatesEnabled</key>
<true/>
<key>EXUpdatesLaunchWaitMs</key>
<integer>0</integer>
<key>EXUpdatesRuntimeVersion</key>
<string>1.0.0</string>
<key>EXUpdatesURL</key>
<string>http://localhost:3000/api/manifest</string>
</dict>
</plist>
```

### Configuration for Android
### Android

Modify **android/app/build.gradle** to check for the JS engine configuration (JSC or Hermes) in Expo files:

Expand Down Expand Up @@ -209,9 +173,67 @@ Add the Expo runtime version string key to **android/app/src/main/res/values/str

<DiffBlock source="/static/diffs/expo-update-strings-xml.diff" />

### iOS

Add the file **Podfile.properties.json** to the **ios** directory:

```json ios/Podfile.properties.json
{
"expo.jsEngine": "hermes"
}
```

Modify **ios/Podfile** to check for the JS engine configuration (JSC or Hermes) in Expo files:

```diff ios/Podfile
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -2,6 +2,9 @@ require File.join(File.dirname(`node --print "require.resolve('expo/package.json
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

+require 'json'
+podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
+
platform :ios, '13.0'
prepare_react_native_project!

@@ -41,7 +44,7 @@ target 'MyApp' do
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
- :hermes_enabled => flags[:hermes_enabled],
+ :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#

```

Add the **Supporting** directory containing **Expo.plist** to your project in Xcode with the following content, to match the content in **app.json**:

```xml Expo.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EXUpdatesCheckOnLaunch</key>
<string>ALWAYS</string>
<key>EXUpdatesEnabled</key>
<true/>
<key>EXUpdatesLaunchWaitMs</key>
<integer>0</integer>
<key>EXUpdatesRuntimeVersion</key>
<string>1.0.0</string>
<key>EXUpdatesURL</key>
<string>http://localhost:3000/api/manifest</string>
</dict>
</plist>
```

## Next steps

- To start trying out EAS Update with EAS Build, see the EAS Update [Getting Started](/eas-update/getting-started/).
- See more information about usage in the [`expo-updates` README](https://github.com/expo/expo/tree/main/packages/expo-updates/README.md).
- See [EAS Update with a local build](/eas-update/build-locally/).
- It is also possible to use `expo-updates` with a custom server that implements the [Expo Updates protocol](/technical-specs/expo-updates-1/); see the [`custom-expo-updates-server` README](https://github.com/expo/custom-expo-updates-server#readme).
- To start using EAS Update with EAS Build, see the EAS Update [Get started](/eas-update/getting-started/).
- See [`expo-updates` API reference](/versions/latest/sdk/updates/) for more information on how to use the library.
- See how to use [EAS Update with a local build directly](/eas-update/build-locally/).
- It is also possible to use `expo-updates` with a custom server that implements the [Expo Updates protocol](/technical-specs/expo-updates-1/). See [`custom-expo-updates-server` README](https://github.com/expo/custom-expo-updates-server#readme).
2 changes: 1 addition & 1 deletion docs/pages/bare/overview.mdx
Expand Up @@ -21,7 +21,7 @@ If you have a React Native app that doesn't use any Expo tools, you might be won

**All tools and services provided by Expo work great in any React Native app**.

You can use [EAS](/eas) to get quickly set up with a professional CI/CD workflow for building, reviewing, deploying, and updating your apps. [Expo CLI](/more/expo-cli/) provides the best command-line experience for working with React Native. The [Expo SDK](/versions/latest/) is an extended standard library for React Native. It gives developers high-quality, well maintained native libraries that use consistent API conventions to make them easier to learn and use.
You can use [EAS](/eas) to get quickly set up with a professional CI/CD workflow for building, reviewing, deploying, and updating your apps. [Expo CLI](/more/expo-cli/) provides the best command-line experience for working with React Native. The [Expo SDK](/versions/latest/) is an extended standard library for React Native. It gives developers high-quality, well-maintained native libraries that use consistent API conventions to make them easier to learn and use.

If you've ever written a native module for React Native, you'll be surprised how much easier it is to build and maintain modules with the idiomatic Swift and Kotlin DSL provided by the [Expo Modules API](/modules/overview/).

Expand Down
6 changes: 4 additions & 2 deletions docs/pages/bare/using-expo-cli.mdx
Expand Up @@ -8,7 +8,7 @@ import { Collapsible } from '~/ui/components/Collapsible';
import { BoxLink } from '~/ui/components/BoxLink';
import { DEMI } from '~/ui/components/Text';

To migrate from `npx react-native init` to Expo CLI, you'll need to install the `expo` package which includes the Expo Modules API and Expo CLI. This guide covers the installation step, the benefits of using Expo CLI, and how to compile and run your project after migrating to Expo CLI.
To migrate from `npx react-native init` to Expo CLI, you'll need to install the `expo` package, which includes the Expo Modules API and Expo CLI. This guide covers the installation step, the benefits of using Expo CLI, and how to compile and run your project after migrating to Expo CLI.

## Install the `expo` package

Expand Down Expand Up @@ -51,7 +51,9 @@ Windows and macOS. If building for these platforms, you can utilize Expo CLI for

After installing the `expo` package, you can use the following commands which are alternatives to `npx react-native run-android` and `npx react-native run-ios`:

<Terminal cmd={['# for Android', '$ npx expo run:android', '', '# for iOS', '$ npx expo run:ios']} />
<Terminal
cmd={['# for Android', '$ npx expo run:android', '', '# for iOS', '$ npx expo run:ios']}
/>

When building your project, you can choose a device or simulator by using the `--device` flag. This also applies to any iOS device that is connected to your computer.

Expand Down