Files
moderne-docs/getting-started/signing-in-with-github.md
2021-08-18 05:14:03 +00:00

4.3 KiB

Quick Start: Running your first recipe

To help orient you to Moderne, let's look at how to 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 login to Moderne through GitHub, you will be 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 Recipes are cataloged at the root-level by languages. 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 search box enter OpenRewrite
  • Click to select the search results

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

Step 6: Running a search recipe

Click Dry Run to start the recipe and you should be directed to a results page.

Here you will see a summary of your recipe criteria and an indication of progress.

Each result will help you understand how many files were searched and how many changes were 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 result 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. We can either download a patch of the change and test against a locally cloned version of the repository or if we are confident in the changes create a branch and open a pull request

Clicking will 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, you might not need a fork and can create a branch directly on the project. {% endhint %}

Step 9: 🎉 Profit