You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-133Lines changed: 2 additions & 133 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,137 +4,6 @@ The official CLI for Emerge Tools.
4
4
5
5
[Emerge](https://emergetools.com) offers a suite of products to help optimize app size, performance, and quality by detecting regressions before they make it to production. This plugin provides a set of actions to interact with the Emerge API.
6
6
7
-
## Installation
7
+
#Documentation
8
8
9
-
This tool is packaged as a Ruby Gem which can be installed by:
10
-
11
-
```
12
-
gem install emerge
13
-
```
14
-
15
-
## API Key
16
-
17
-
Follow our guide to obtain an [API key](https://docs.emergetools.com/docs/uploading-basics#obtain-an-api-key) for your organization. The API Token is used by the CLI to authenticate with the Emerge API. The CLI will automatically pick up the API key if configured as an `EMERGE_API_TOKEN` environment variable, or you can manually pass it into individual commands with the `--api-token` option.
18
-
19
-
## Snapshots
20
-
21
-
Uploads a directory of images to be used in [Emerge Snapshot Testing](https://docs.emergetools.com/docs/snapshot-testing).
22
-
23
-
Run `emerge upload snapshots -h` for a full list of supported options.
24
-
25
-
Example:
26
-
27
-
```shell
28
-
emerge upload snapshots \
29
-
--name "AwesomeApp" \
30
-
--id "com.emerge.awesomeapp" \
31
-
--repo-name "EmergeTools/AwesomeApp" \
32
-
path/to/snapshot/images
33
-
```
34
-
35
-
### Git Configuration
36
-
37
-
For CI diffs to work, Emerge needs the appropriate Git `sha` and `base_sha` values set on each build. Emerge will automatically compare a build at `sha` against the build we find matching the `base_sha` for a given application id. We also recommend setting `pr_number`, `branch`, and `repo_name` for the best experience.
38
-
39
-
For example:
40
-
41
-
-`sha`: `pr-branch-commit-1`
42
-
-`base_sha`: `main-branch-commit-1`
43
-
-`pr_number`: `42`
44
-
-`branch`: `my-awesome-feature`
45
-
-`repo_name`: `EmergeTools/hackernews`
46
-
47
-
Will compare the snapshot diffs of your pull request changes.
48
-
49
-
This plugin will automatically configure Git values for you assuming certain Github workflow triggers:
50
-
51
-
```yaml
52
-
on:
53
-
# Produce base builds with a 'sha' when commits are pushed to the main branch
54
-
push:
55
-
branches: [main]
56
-
57
-
# Produce branch comparison builds with `sha` and `base_sha` when commits are pushed
58
-
# to open pull requests
59
-
pull_request:
60
-
branches: [main]
61
-
...
62
-
```
63
-
64
-
If this doesn't cover your use-case, manually set the `sha` and `base_sha` values when calling the Emerge plugin.
65
-
66
-
### Using with swift-snapshot-testing
67
-
68
-
Snapshots generated via [swift-snapshot-testing](https://github.com/pointfreeco/swift-snapshot-testing) are natively supported by the CLI by setting `--client-library swift-snapshot-testing` and a `--project-root` directory. This will scan your project for all images found in `__Snapshot__` directories.
Snapshots generated via [Paparazzi](https://github.com/cashapp/paparazzi) are natively supported by the CLI by setting `--client-library paparazzi` and a `--project-root` directory. This will scan your project for all images found in `src/test/snapshots/images` directories.
84
-
85
-
Example:
86
-
87
-
```shell
88
-
emerge upload snapshots \
89
-
--name "AwesomeApp Paparazzi" \
90
-
--id "com.emerge.awesomeapp.paparazzi" \
91
-
--repo-name "EmergeTools/AwesomeApp" \
92
-
--client-library paparazzi \
93
-
--project-root /my/awesomeapp/android/repo
94
-
```
95
-
96
-
### Using with Roborazzi
97
-
98
-
Snapshots generated via [Roborazzi](https://github.com/takahirom/roborazzi) are natively supported by the CLI by setting `--client-library roborazzi` and a `--project-root` directory. This will scan your project for all images found in `**/build/outputs/roborazzi` directories.
99
-
100
-
Example:
101
-
102
-
```shell
103
-
emerge upload snapshots \
104
-
--name "AwesomeApp Roborazzi" \
105
-
--id "com.emerge.awesomeapp.roborazzi" \
106
-
--repo-name "EmergeTools/AwesomeApp" \
107
-
--client-library roborazzi \
108
-
--project-root /my/awesomeapp/android/repo
109
-
```
110
-
111
-
## Reaper
112
-
113
-
Experimental support has been added to interactively examine [Reaper](https://docs.emergetools.com/docs/reaper) results and also **delete them from your codebase**.
After which it will prompt you to select classes to delete.
123
-
124
-
### How it works
125
-
126
-
Under the hood we are using [Tree Sitter](https://tree-sitter.github.io/tree-sitter/) to parse your source files into an AST which is then used for deletions. There are some obvious limitations to this approach, namely that Tree Sitter is designed for source code editors and only looks at a single file at a time. We are exploring some better long-term approaches but this works well enough for now!
127
-
128
-
### Supported languages
129
-
130
-
We currently support the following languages:
131
-
132
-
- Swift
133
-
- Kotlin
134
-
- Java
135
-
136
-
Please open an issue if you need an additional language grammar.
137
-
138
-
### Building
139
-
140
-
Because many of the language grammars we use are third-party, we have to package them with our CLI tool as shared libraries for distribution. We depend on [tsdl](https://github.com/stackmystack/tsdl) to build the grammars from our `parsers.toml` file.
9
+
See [Emerge CLI](https://docs.emergetools.com/docs/emerge-cli#/) for our full documentation.
0 commit comments