Skip to content

Commit 17b5a9c

Browse files
committed
chore: address review comments
1. Introduced more processing with yargs 2. Changed readme to show telemetry option as default 3. Tweak the transform logic for shouldIgnoreMustache
1 parent 8e4fb8b commit 17b5a9c

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +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+
1. Start your ember development server
27+
2. Run Codemod, pointing it at the address of the development server
28+
2629
```sh
2730
$ cd my-ember-app-or-addon
28-
$ npx ember-angle-brackets-codemod ./path/of/files/ or ./some**/*glob.hbs
31+
$ npx ember-angle-brackets-codemod --telemetry=http://localhost:4200 ./path/of/files/ or ./some**/*glob.hbs
2932
```
3033

31-
### Running the codemod with Telemetry
3234
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".
3335

3436
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.
3537

36-
1. Start your ember development server
37-
2. Run Codemod, pointing it at the address of the development server
38+
### Running the codemod without Telemetry
3839

3940
```sh
4041
$ cd my-ember-app-or-addon
41-
$ npx ember-angle-brackets-codemod --telemetry=http://localhost:4200 ./path/of/files/ or ./some**/*glob.hbs
42+
$ npx ember-angle-brackets-codemod ./path/of/files/ or ./some**/*glob.hbs
4243
```
4344

44-
4545
## From
4646

4747
```hbs

bin/cli.js

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

5-
const argv = require('yargs').argv;
5+
const argv = require('yargs')
6+
.usage('Usage: $0 --telemetry=http://localhost:4200 [path or glob]')
7+
.alias('t', 'telemetry')
8+
.nargs('t', 1)
9+
.describe('t', 'Address of the development server')
10+
.help('h')
11+
.alias('h', 'help').argv;
612

713
(async () => {
814
if (argv.telemetry) {

transforms/angle-brackets/transform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ function shouldIgnoreMustacheStatement(fullName, config, invokableData) {
317317
let strName = `${name}`; // coerce boolean and number to string
318318
return (isHelper || !isComponent) && !strName.includes('.');
319319
} else {
320-
return KNOWN_HELPERS.includes(name) && config.helpers.includes(name);
320+
return KNOWN_HELPERS.includes(name) || config.helpers.includes(name);
321321
}
322322
}
323323

0 commit comments

Comments
 (0)