Skip to content

Commit 5776ba7

Browse files
Merge branch 'master' into fix/outer-functions
2 parents 9cdf9a7 + 7911f36 commit 5776ba7

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55

66
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.
88
They basically help you to create "runtime assisted codemods".
99

1010
## 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.
1313

1414
## Usage
1515

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).
1717

1818
```javascript
1919
#!/usr/bin/env node
@@ -42,7 +42,7 @@ function findHelpers(possibleEmberObject) {
4242
})();
4343
```
4444

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:
4646

4747
```javascript
4848
{
@@ -53,12 +53,24 @@ All invocations of `gatherTelemetryForUrl` internally returns an object enumerat
5353
'input/helpers/singularize': true,
5454
}
5555
```
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.
5757

5858
```javascript
5959
const { analyzeEmberObject } = require('ember-codemods-telemetry-helpers');
6060
```
6161

62+
## Upgrading from `0.5.0`
63+
64+
After `0.5.0`, a few breaking changes occured.
65+
66+
* `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`.
68+
69+
Therefore:
70+
```javascript
71+
gatherTelemetryForUrl(url, gatherFunction, puppeteerArgs);
72+
```
73+
6274
## Caveats
6375
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:
6476

0 commit comments

Comments
 (0)