Skip to content

Commit 54d8318

Browse files
committed
[BREAKING CHANGE]: disabling telemetry by default
1 parent b07e9e8 commit 54d8318

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,25 @@ It does not make a copy. Make sure your code is checked into a source control
2323
repository like Git and that you have no outstanding changes to commit before
2424
running this tool.
2525

26+
```sh
27+
$ cd my-ember-app-or-addon
28+
$ npx ember-angle-brackets-codemod ./path/of/files/ or ./some**/*glob.hbs
29+
```
30+
31+
### Running the codemod with Telemetry
32+
Telemetry helpers runs the app, grabs basic info about all of the modules at runtime. This allows the codemod to know the names of every helper, component, route, controller, etc. in the app without guessing / relying on static analysis. They basically help you to create "runtime assisted codemods".
33+
34+
See "Gathering runtime data" section of [ember-native-class-codemod](https://github.com/ember-codemods/ember-native-class-codemod#gathering-runtime-data) for some additonal information.
35+
2636
1. Start your ember development server
2737
2. Run Codemod, pointing it at the address of the development server
2838

2939
```sh
3040
$ cd my-ember-app-or-addon
31-
$ npx ember-angle-brackets-codemod http://localhost:4200 ./path/of/files/ or ./some**/*glob.hbs
41+
$ npx ember-angle-brackets-codemod --telemetry=http://localhost:4200 ./path/of/files/ or ./some**/*glob.hbs
3242
```
3343

44+
3445
## From
3546

3647
```hbs

bin/cli.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
'use strict';
33
const { gatherTelemetryForUrl, analyzeEmberObject } = require('ember-codemods-telemetry-helpers');
44

5+
const argv = require('yargs').argv;
6+
57
(async () => {
6-
await gatherTelemetryForUrl(process.argv[2], analyzeEmberObject);
8+
if (argv.telemetry) {
9+
await gatherTelemetryForUrl(process.argv[2], analyzeEmberObject);
10+
}
711

812
require('codemod-cli').runTransform(
913
__dirname,

transforms/angle-brackets/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ function getOptions() {
2424
options.skipBuiltInComponents = !!config.skipBuiltInComponents;
2525
}
2626

27+
if (cliOptions.telemetry) {
28+
options.telemetry = cliOptions.telemetry;
29+
}
30+
2731
return options;
2832
}
2933

3034
module.exports = function(file) {
31-
let invokableData = getInvokableData(getTelemetry());
35+
const options = getOptions();
36+
let invokableData = options.telemetry ? getInvokableData(getTelemetry()) : {};
3237
try {
33-
return transform(file, getOptions(), invokableData);
38+
return transform(file, options, invokableData);
3439
} catch (e) {
3540
throw new Error(
3641
`Transformation errored on file ${file.path}. Reason ${e}. Please report this in https://github.com/ember-codemods/ember-angle-brackets-codemod/issues\n\nStack trace:\n${e.stack}`

0 commit comments

Comments
 (0)