Skip to content

Commit c55b5f0

Browse files
Remove the telemetry code and use the extracted telemetry helpers package (#17)
1 parent 690d696 commit c55b5f0

14 files changed

Lines changed: 48 additions & 356 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ A collection of codemod's for ember-no-implicit-this-codemod.
88
To run a specific codemod from this project, you would run the following:
99

1010
```
11-
npx ember-no-implicit-this-codemod no-implicit-this path/of/files/ or/some**/*glob.hbs
11+
npx ember-no-implicit-this-codemod http://localhost:4200 path/of/files/ or/some**/*glob.hbs
1212
1313
# or
1414
1515
yarn global add ember-no-implicit-this-codemod
16-
ember-no-implicit-this-codemod <TRANSFORM NAME> path/of/files/ or/some**/*glob.js
16+
ember-no-implicit-this-codemod http://url/of/local/dev-server path/of/files/ or/some**/*glob.js
1717
```
1818

1919
The codemod accepts the following options:
@@ -41,4 +41,4 @@ The codemod accepts the following options:
4141

4242
### Update Documentation
4343

44-
* `yarn update-docs`
44+
* `yarn update-docs`

bin/cli.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
const transformName = process.argv[2];
5-
const args = process.argv.slice(3);
4+
const { gatherTelemetryForUrl } = require('ember-codemods-telemetry-helpers');
65

7-
require('codemod-cli').runTransform(__dirname, transformName, args, 'hbs');
6+
(async () => {
7+
await gatherTelemetryForUrl(process.argv[2]);
8+
9+
require('codemod-cli').runTransform(
10+
__dirname,
11+
'no-implicit-this',
12+
process.argv.slice(2) /* paths or globs */
13+
);
14+
})();

bin/telemetry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
const gatherTelemetry = require('../lib/gather-telemetry');
4+
const { gatherTelemetry } = require('ember-codemods-telemetry-helpers');
55

66
gatherTelemetry(process.argv[2]);

lib/cache.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/gather-telemetry.js

Lines changed: 0 additions & 160 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
],
3333
"dependencies": {
3434
"codemod-cli": "^1.1.0",
35+
"ember-codemods-telemetry-helpers": "^0.2.0",
3536
"ember-template-recast": "^3.1.1",
3637
"fs-extra": "^8.1.0",
3738
"git-repo-info": "^2.1.0",

test/run-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const execOpts = { cwd: inputDir, stderr: 'inherit' };
3030

3131
console.log('running codemod');
3232

33-
await execa('../../../bin/cli.js', ['no-implicit-this', 'app'], execOpts);
33+
await execa('../../../bin/cli.js', ['http://localhost:4200', 'app'], execOpts);
3434

3535
console.log('codemod complete, ending serve');
3636

transforms/no-implicit-this/helpers/determine-this-usage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path');
22
const recast = require('ember-template-recast');
3-
const { getTelemetryFor } = require('./utils/get-telemetry-for');
3+
const { getTelemetryFor } = require('ember-codemods-telemetry-helpers');
4+
45
const logger = require('./log-helper');
56
const transformPlugin = require('./plugin');
67

transforms/no-implicit-this/helpers/plugin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { telemetry } = require('./utils/get-telemetry-for');
1+
const { getTelemetry } = require('ember-codemods-telemetry-helpers');
22
// everything is copy-pasteable to astexplorer.net.
33
// sorta. telemetry needs to be defined.
44
// telemtry can be populated with -mock-telemetry.json
@@ -109,6 +109,7 @@ function doesTokenNeedThis(
109109
function populateInvokeables() {
110110
let components = [];
111111
let helpers = [];
112+
let telemetry = getTelemetry();
112113

113114
for (let name of Object.keys(telemetry)) {
114115
let entry = telemetry[name];

transforms/no-implicit-this/helpers/utils/get-telemetry-for.js

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)