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
+18-6Lines changed: 18 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,16 @@
4
4
5
5
6
6
Telemetry helpers runs the app, grabs basic info about all of the modules at runtime.
7
-
This allows the codemod to know the names of every helper, component, route, controller, etc in the app without guessing / relying on static analysis.
7
+
This allows the codemod to know the names of every helper, component, route, controller, etc. in the app without guessing / relying on static analysis.
8
8
They basically help you to create "runtime assisted codemods".
9
9
10
10
## Goal
11
-
The goal of the project though was to enable each codemod to manage its own type of data gathering
12
-
and that the gather-telemetry-helpers package provides the harness to run that custom gathering function
11
+
The goal of this project is to enable each codemod to manage its own type of data gathering
12
+
and that this package provides the harness to run that custom gathering function.
13
13
14
14
## Usage
15
15
16
-
Assuming you are authoring a codemod with [codemod-cli](https://github.com/rwjblue/codemod-cli), `ember-codemods-telemetry-helpers` allows you freedom to assign your own "telemetry gathering" function while provide one of its own out of the box (opt-in).
16
+
Assuming you are authoring a codemod with [codemod-cli](https://github.com/rwjblue/codemod-cli), `ember-codemods-telemetry-helpers` allows you the freedom to assign your own "telemetry gathering" function while provide one of its own out of the box (opt-in).
17
17
18
18
```javascript
19
19
#!/usr/bin/env node
@@ -42,7 +42,7 @@ function findHelpers(possibleEmberObject) {
42
42
})();
43
43
```
44
44
45
-
All invocations of `gatherTelemetryForUrl` internally returns an object enumerated with properties named after all possible entries within `window.require.entries`. The values of each property is the value returned from within the gathering function. Usuing the example above, the output might be (for example):
45
+
All invocations of `gatherTelemetryForUrl` internally returns an object enumerated with properties named after all possible entries within `window.require.entries`. The values of each property is the value returned from within the gathering function. Usuing the example above, the output might be:
46
46
47
47
```javascript
48
48
{
@@ -53,12 +53,24 @@ All invocations of `gatherTelemetryForUrl` internally returns an object enumerat
53
53
'input/helpers/singularize':true,
54
54
}
55
55
```
56
-
This package does provide one gathering function: `analyzeEmberObject`. The function does a "best effort" analysis of the app runtime, return such things as most Ember object types (Components, Helpers, Routes, etc) and "own" properties.
56
+
This package provides one gathering function: `analyzeEmberObject`. The function does a "best effort" analysis of the app runtime, returning such things as Components, Helpers, Routes, etc. and their particular properties.
*`gatherTelemetryForUrl` requires a function as it's second argument to do work. This is refer to as a "gathering function". The default `analyzeEmberObject` can be used here.
67
+
* The optional `puppeteerArgs` have been moved to the last arg position of `gatherTelemetryForUrl`.
If the gather function references functions defined outside of the the gather function body, all of those functions must be exported as well. It is strongly suggested that the gather function be self contained, and if functions must be used (code maintainability/readability), that they be defined within the function. If this is not possible, the `gatherTelemetryForUrl` has been enhanced to accept all functions that must go along with the gather function:
0 commit comments