Skip to content

Commit

Permalink
docs: consolidate getting started and quickstart guide
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel committed Oct 11, 2024
1 parent 6e235a9 commit d14204d
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 190 deletions.
5 changes: 1 addition & 4 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ export default defineConfig({
{
label: 'Guides',
items: [
{
label: 'Code Push Quickstart',
link: '/guides/code-push-quickstart',
},
{
label: 'Staging Patches',
link: '/guides/staging-patches',
Expand Down Expand Up @@ -180,6 +176,7 @@ export default defineConfig({
'guides/crash-reporting': 'guides/crash-reporting/uploading-symbols',
'guides/fastlane': 'ci/fastlane',
'guides/flavors': 'guides/flavors/android',
'guides/code-push-quickstart': '/',
'guides/hybrid-app': 'guides/hybrid-apps/android',
'guides/hybrid-app/android': 'guides/hybrid-apps/android',
'guides/hybrid-app/ios': 'guides/hybrid-apps/ios',
Expand Down
161 changes: 0 additions & 161 deletions src/content/docs/guides/code-push-quickstart.mdx

This file was deleted.

161 changes: 136 additions & 25 deletions src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ template: doc

import { Tabs, TabItem } from '@astrojs/starlight/components';

This guide will walk you through [creating an account](#sign-up), [installing Shorebird](#install), and [logging in](#login).
Welcome to Shorebird! πŸ‘‹

## Sign Up

To create an account, head over to the [Shorebird Console](https://console.shorebird.dev) and authenticate with your Google account.
In this guide, we'll walk you through setting up Shorebird and integrating it
into your app in just a few minutes.

## Install

Expand Down Expand Up @@ -116,43 +115,155 @@ Engine β€’ revision e81fa131e59506d9f6af2a0cee7de749131f1bf0
No issues detected!
```

## Login
## Sign up

Before you can create a Shorebird app, you will need to sign up for Shorebird.

### Create an account

To create an account, head over to the [Shorebird
Console](https://console.shorebird.dev) and authenticate with one of the available authentication methods.

Once you have logged into the console, follow the instructions to install the
Shorebird CLI on your machine.

## Integrate Shorebird

Once you have registered and installed the CLI, you're ready to use code push!

You can login using the `shorebird login` command:
Start by creating a new Flutter app:

```sh
shorebird login
flutter create my_shorebird_app
```

Example output:
As with any Flutter app, you can verify this created the standard Counter app by
following the instructions printed by `flutter create`:

```sh
cd my_shorebird_app
flutter run
```

### Initialize Shorebird

To make this a Shorebird app, run:

```sh
shorebird init
```

This will create a `shorebird.yaml` file in the root of your project. This file
contains your Shorebird `app_id`.

This will also run `shorebird doctor` to ensure everything is set up correctly.

:::note
Shorebird expects to find the latest stable `flutter` installed on your
machine. Shorebird can be configured to work with older versions of Flutter
(back to 3.10.0). See [Flutter Version Management](/flutter-version) for more
info.
:::

### Create a release

We will create a release using the unmodified Counter app. Run:

<Tabs>

<TabItem value="android" label="Android">

```sh
shorebird release android
```

</TabItem>

<TabItem value="ios" label="iOS">

```sh
shorebird release ios
```

</TabItem>
</Tabs>

When prompted, use the suggested version number (`1.0.0+1`), and enter `y` when
asked if you would like to continue.

### Preview the release

To preview the release with Shorebird (that is, with [Shorebird's fork of the
Flutter engine](/faq#how-does-shorebird-relate-to-flutter)), run:

```sh
shorebird preview
```
shorebird login
The Shorebird CLI needs your authorization to manage apps, releases, and patches
on your behalf.

In a browser, visit this URL to log in:
Now kill the app on your device or emulator.

### Create a patch

We will now make a small change to the Counter app. In `lib/main.dart`, change
the app theme's `primarySwatch` from blue to green:

```diff
class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
- primarySwatch: Colors.blue,
+ primarySwatch: Colors.green,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
```

https://accounts.google.com/o/oauth2/v2/auth...
After making this change, save the file and run:

Waiting for your authorization...
<Tabs>

πŸŽ‰ Welcome to Shorebird! You are now logged in as <email>.
<TabItem value="android" label="Android">

πŸ”‘ Credentials are stored in ./path/to/credentials.json.
πŸšͺ To logout use: "shorebird logout".
```sh
shorebird patch android
```

That's it πŸŽ‰
</TabItem>

You now have a Shorebird account, have installed Shorebird CLI on your machine, and are ready to start using Shorebird.
<TabItem value="ios" label="iOS">

```sh
shorebird patch ios
```

</TabItem>

</Tabs>

### See the patch in action

Launch the app from your device or emulator. The app will still have the
original blue theme, but it will be downloading the patch we just created in the
background. Kill and launch the app again, and the app will be green! πŸŽ‰

## Connect on Discord

Shorebird has an active Discord where we're happy to help you:
Shorebird has an active Discord where we're happy to help you with any questions
https://discord.gg/shorebird

We also offer a private support channel for paying customers. We don't yet have
an automated way to add you to the channel, so please message a member of our
team on Discord and we'll happily add you to the customer support channel.
https://github.com/shorebirdtech/shorebird/issues/308

0 comments on commit d14204d

Please sign in to comment.