# Productivity

## Scripts

Every Rapid project comes with a set of scripts defined in the `melos.yaml` in the project root.
More information on running melos scripts can be found [here](https://melos.invertase.dev/configuration/scripts).

Available scripts:

| Script Name         | Description                                          |
| ------------------- | ---------------------------------------------------- |
| analyze             | Analyze all packages.                                |
| format              | Format all packages.                                 |
| build_runner        | Run `build_runner` in a package.                     |
| build_runner:watch  | Run `build_runner` in a package. (Watch mode)        |
| build_runner:clean  | Clean `build_runner` outputs in a package.           |
| gen-l10n            | (Re)-generate localizations of a package.            |
| run:dev             | Run app in debug mode. (development)                 |
| run:test            | Run app in debug mode. (test)                        |
| run:prod            | Run app in debug mode. (production)                  |
| test                | Run tests in a package.                              |
| test:coverage       | Run tests with coverage in a package.                |
| test:update:goldens | Update goldens of a package.                         |
| test:e2e:dev        | Run e2e tests in non web root package. (development) |
| test:e2e:dev:web    | Run e2e tests in web root package. (development)     |
| test:e2e:test       | Run e2e tests in non web root package. (test)        |
| test:e2e:test:web   | Run e2e tests in web root package. (test)            |
| test:e2e:prod       | Run e2e tests in non web root package. (production)  |
| test:e2e:prod:web   | Run e2e tests in web root package. (production)      |
| coverage            | Calculate coverage for a package.                    |
| coverage:html       | Generate a html-coverage report for a package.       |

<Warning>
  Some of these scripts have prerequisites to run successfully. Please see the
  `melos.yaml` file in the project root for more information.
</Warning>

## Code Generation

<Info>
  In the future, the introduction of [static
  meta-programming](https://github.com/dart-lang/language/issues/1482) has the
  potential to further accelerate this topic.
</Info>

Rapid projects rely extensively on code generation to facilitate fast development. Since Rapid projects are composed of small modular packages, the generation times will be lower compared to projects with a monolithic package structure. To execute code generation within a package, utilize the following command:

<Tabs
  values={[
    { label: "rapid", value: "rapid" },
    { label: "native", value: "native" },
  ]}
>
<TabItem value="rapid">

```bash
# Single run
melos build_runner

# Watch mode
melos build_runner:watch
```

</TabItem>
<TabItem value="native">

```bash
# Single run
dart run build_runner build --delete-conflicting-outputs

# Watch mode
dart run build_runner watch --delete-conflicting-outputs
```

</TabItem>
</Tabs>

## Snippets

<Info>Snippets for IntelliJ are planned for 2023</Info>

<Info>Snippets for VS Code are planned for 2023</Info>

Once a project has been created and the necessary packages and Rapid Components have been added, developers can start implementing. To maximize productivity, Rapid will include context-specific snippets that enable developers to implement components and packages more efficiently. By utilizing these snippets, developers can significantly speed up their workflow and achieve faster results.
