emerge 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65f13db01f807a85200615394b091f5bfea4cd3bf4cf4f94ec0a742d5b93c597
4
- data.tar.gz: 322a6582fd941518f080ae8d38af3555a404e295a99658083d5032a0127640d9
3
+ metadata.gz: 7df9bc68c4aa8766d26378a7d8164770f2e0aee37dd919e3b7cf54de77b69ac5
4
+ data.tar.gz: 776950af8aa7c3cc32150a0969ac8074a62833c54b39166c48f896f1d87985e6
5
5
  SHA512:
6
- metadata.gz: 6e7adb6bafb19cec3408a3e866d9a148ebe99cf80dde147c47f9133fad0a6d8e7e655a2bfdce7ece4be9596235c650d7abf60ef07f899f30a0a700ef40eccb03
7
- data.tar.gz: 9ee165532fb1443fda2f5dce215bb545b9a9997d6684cc5e36d3b18de416a73496779dad9685fac1a03735d327077f040dcd4b17050027abe1accaf7ec1562f8
6
+ metadata.gz: 81c866f015a8e6d6a29d107c307fefa792a210ed7d2063bb98f8cb6870357702c6a21dfcad27e72b4953ca3ba6b0df41fe1e3f4f96e33db534650ad149cef41f
7
+ data.tar.gz: e6afe32068d8068f57e211973b13309317714e4bce8a29ea22725b57557c376da8daf222b38aac46993dc451e962923882e65959fea2d206b70a695196f01e30
data/README.md CHANGED
@@ -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.
69
-
70
- Example:
71
-
72
- ```shell
73
- emerge upload snapshots \
74
- --name "AwesomeApp swift-snapshot-testing" \
75
- --id "com.emerge.awesomeapp.swift-snapshot-testing" \
76
- --repo-name "EmergeTools/AwesomeApp" \
77
- --client-library swift-snapshot-testing \
78
- --project-root /my/awesomeapp/ios/repo
79
- ```
80
-
81
- ### Using with Paparazzi
82
-
83
- 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**.
114
-
115
- Use the `reaper` subcommand to get started, e.g.:
116
-
117
- ```shell
118
- emerge reaper --upload-id 40f1dfe7-6c57-47c3-bc52-b621aec0ba8d \
119
- --project-root /path/to/your/repo
120
- ```
121
-
122
- 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.
@@ -35,7 +35,7 @@ module EmergeCLI
35
35
 
36
36
  option :profile, type: :boolean, default: false, desc: 'Enable performance profiling metrics'
37
37
 
38
- option :batch, type: :boolean, default: false, desc: 'Upload images in batch using zip file'
38
+ option :batch, type: :boolean, default: true, desc: 'Upload images in batch using zip file'
39
39
 
40
40
  argument :image_paths, type: :array, required: false, desc: 'Paths to folders containing images'
41
41
 
@@ -210,11 +210,14 @@ module EmergeCLI
210
210
  }
211
211
 
212
212
  used_filenames, = check_duplicate_files(image_files, client)
213
+ file_info_map = {}
213
214
 
214
215
  @profiler.measure('process_image_metadata') do
215
216
  image_files.each do |image_path|
216
217
  metadata_semaphore.async do
217
218
  file_info = client.parse_file_info(image_path)
219
+ file_name_without_extension = File.basename(file_info[:file_name], '.*')
220
+ file_info_map[image_path] = file_info
218
221
 
219
222
  dimensions = @profiler.measure('chunky_png_processing') do
220
223
  datastream = ChunkyPNG::Datastream.from_file(image_path)
@@ -225,15 +228,14 @@ module EmergeCLI
225
228
  end
226
229
 
227
230
  metadata = {
228
- fileName: file_info[:file_name],
231
+ fileName: file_name_without_extension,
229
232
  groupName: file_info[:group_name],
230
233
  displayName: file_info[:variant_name],
231
234
  width: dimensions[:width],
232
235
  height: dimensions[:height]
233
236
  }
234
237
 
235
- image_name = File.basename(image_path, '.*')
236
- image_metadata[:images][image_name] = metadata
238
+ image_metadata[:images][file_name_without_extension] = metadata
237
239
  end
238
240
  end
239
241
 
@@ -246,9 +248,9 @@ module EmergeCLI
246
248
  zipfile.get_output_stream('manifest.json') { |f| f.write(JSON.generate(image_metadata)) }
247
249
 
248
250
  image_files.each do |image_path|
249
- filename = File.basename(image_path)
250
- # Only add files we haven't seen before
251
- zipfile.add(filename, image_path) if used_filenames[filename] == image_path
251
+ file_info = file_info_map[image_path]
252
+ # Only add files we haven't seen before, otherwise it will crash
253
+ zipfile.add(file_info[:file_name], image_path) if used_filenames[file_info[:file_name]] == image_path
252
254
  end
253
255
  end
254
256
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module EmergeCLI
2
- VERSION = '0.7.2'.freeze
2
+ VERSION = '0.7.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emerge Tools
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-06 00:00:00.000000000 Z
11
+ date: 2025-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http