Skip to content

Commit ad13247

Browse files
NullVoxPopuliChris Garrett
authored andcommitted
[FEAT] Extract out shared telemetry package (#173)
1 parent 49813a5 commit ad13247

10 files changed

Lines changed: 20 additions & 437 deletions

File tree

bin/cli.js

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

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

66
(async () => {
7-
await gatherTelemetry(process.argv[2]);
7+
await gatherTelemetryForUrl(process.argv[2]);
88

99
require('codemod-cli').runTransform(
1010
__dirname,

bin/temeletry.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 & 248 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"update-docs": "codemod-cli update-docs"
3636
},
3737
"dependencies": {
38+
"ember-codemods-telemetry-helpers": "^0.5.0",
3839
"codemod-cli": "^2.0.0",
3940
"fs-extra": "^8.0.1",
4041
"git-repo-info": "^2.1.0",

transforms/ember-object/test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
const path = require('path');
44
const { runTransformTest } = require('codemod-cli');
5+
const { setTelemetry } = require('ember-codemods-telemetry-helpers');
56

67
// bootstrap the mock telemetry data
78
const walkSync = require('walk-sync');
89
const mockTelemetryData = require('./__testfixtures__/-mock-telemetry.json');
910

10-
const cache = require('../../lib/cache');
11-
1211
// This is nasty, cwd is screwed up here for some reason
1312
let testFiles = walkSync('./transforms/ember-object/__testfixtures__', {
1413
globs: ['**/*.input.js'],
@@ -22,7 +21,7 @@ for (let testFile of testFiles) {
2221
mockTelemetry[path.resolve(__dirname, `./__testfixtures__/${moduleName}`)] = value;
2322
}
2423

25-
cache.set('telemetry', JSON.stringify(mockTelemetry));
24+
setTelemetry(mockTelemetry);
2625

2726
runTransformTest({
2827
type: 'jscodeshift',

transforms/helpers/parse-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path');
22
const camelCase = require('camelcase');
3+
const { getTelemetryFor } = require('ember-codemods-telemetry-helpers');
34
const { capitalizeFirstLetter, get, startsWithUpperCaseLetter } = require('./util');
4-
const { getTelemetryFor } = require('./util/get-telemetry-for');
55
const { hasValidProps, isFileOfType, isTestFile } = require('./validation-helper');
66
const { createClass, withComments } = require('./transform-helper');
77
const { createDecoratorImportDeclarations, getImportedDecoratedProps } = require('./import-helper');

0 commit comments

Comments
 (0)