Files
moderne-docs/getting-started/signing-in-with-github.md
2021-08-26 16:36:26 +00:00

4.1 KiB

Quick Start: Running your first recipe

To help orient you to Moderne, let's run a couple of recipes on some open source projects that we have imported into Moderne.

In this guide, we will

  • Login with GitHub
  • Find a recipe to search across multiple repositories
  • Examine the results of our recipe
  • Narrow our focus and run a recipe to transform a repository based on the search
  • Verify the results and issue a Pull Request to transform the code

Step 1: Go to app.moderne.io and Login

Step 2: Sign in with GitHub

The first time you sign in to Moderne through GitHub, you are presented with an authorization prompt for a few permissions to help enhance your experience.

{% hint style="info" %} For a better understanding of the permissions requested, please see GitHub Permissions. {% endhint %}

Step 3: Exploring the recipe catalog

Let's start by exploring Recipes organized by language. As you navigate down into the catalog, you'll find different topical categories of recipes.

Step 4: Selecting a recipe

Let's find a good recipe to start from to help illustrate how to search across multiple repositories.

  1. Select Browse __from the left-hand menu
  2. Then select Java __ from the list of languages
  3. Select the Spring category
  4. Select the Core category
  5. Click on Remove @RequestMapping annotation to expand the listing and then click More Details __ to go to the recipe details

Step 5: Selecting repositories

To narrow our scope a little bit, from the Recipe details page for SpringBoot 2.x Best Practices:

  • Click the Select Repositories button
  • In the search dropdown field, enter OpenRewrite
  • Click to select the search results

Now we should see a number in the Select Repositories button indicating how many repositories we to search.

Step 6: Running a search recipe

Click Dry Run to start the recipe.

On the results page, you see a summary of your recipe criteria and an indication of progress.

Each result for a repository shows files searched and changes detected.

Click on either button or the name of the repository (e.g. spring-cloud/spring-cloud-aws) to view the proposed changes.

Step 7: Viewing results

The resulting diff allows you to preview the changes from the recipe and then decide what to do.

As an example, the screenshot above illustrates how this recipe converts @RequestMapping(…) to the more specific HTTP Verb @GetMapping(…).

Step 8: Creating a Branch & Pull Request

The next course of action is to commit the changes. There are a few options available:

  • Download a patch of the change to test locally.
  • Create a branch and open a pull request .

Clicking present you with a prompt to select whether or not you wish to create a fork of the project into your personal GitHub.

From this prompt, you can customize either the Branch Name or Commit Message to match the contributing guidelines of a particular repository.

{% hint style="info" %} If you have committer access to the repository, create a branch directly on the project. {% endhint %}

Step 9: 🎉 Profit