Skip to content

Commit 8970e54

Browse files
author
Chris Garrett
authored
[FEAT] Fixup name logic, make it work with pods (#177)
1 parent 14c9f7c commit 8970e54

28 files changed

Lines changed: 114 additions & 46 deletions

lib/gather-telemetry.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module.exports = async function gatherTelemetry(url) {
5454
'Service',
5555
'Router',
5656
'Engine',
57+
'Helper',
5758
];
5859
return types.find(type => Ember[type] && object instanceof Ember[type]) || 'EmberObject';
5960
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"update-docs": "codemod-cli update-docs"
3636
},
3737
"dependencies": {
38-
"codemod-cli": "^1.0.0",
38+
"codemod-cli": "^2.0.0",
3939
"fs-extra": "^8.0.1",
4040
"git-repo-info": "^2.1.0",
4141
"minimatch": "^3.0.4",

test/fixtures/output/app/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import loadInitializers from 'ember-load-initializers';
55
import config from './config/environment';
66

77
@classic
8-
class AppApplication extends Application {
8+
class App extends Application {
99
modulePrefix = config.modulePrefix;
1010
podModulePrefix = config.podModulePrefix;
1111
Resolver = Resolver;
1212
}
1313

14-
loadInitializers(AppApplication, config.modulePrefix);
14+
loadInitializers(App, config.modulePrefix);
1515

16-
export default AppApplication;
16+
export default App;

test/fixtures/output/app/components/test-component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function fullNameMacro() {
99
}
1010

1111
@classic
12-
export default class TestComponentComponent extends Component {
12+
export default class TestComponent extends Component {
1313
@fullNameMacro()
1414
fullName;
1515
}

test/fixtures/output/app/router.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import EmberRouter from '@ember/routing/router';
33
import config from './config/environment';
44

55
@classic
6-
class RouterRouter extends EmberRouter {
6+
class Router extends EmberRouter {
77
location = config.locationType;
88
rootURL = config.rootURL;
99
}
1010

11-
RouterRouter.map(function() {});
11+
Router.map(function() {});
1212

13-
export default RouterRouter;
13+
export default Router;

test/fixtures/output/lib/special-sauce/addon/components/fire-sauce.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import classic from 'ember-classic-decorator';
22
import Component from '@ember/component';
33

44
@classic
5-
export default class FireSauceComponent extends Component {}
5+
export default class FireSauce extends Component {}

transforms/ember-object/__testfixtures__/-mock-telemetry.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"runtime.input": {
2+
"runtime": {
33
"computedProperties": ["computedMacro", "anotherMacro", "numPlusOne", "numPlusPlus", "error", "errorService"],
44
"observedProperties": [],
55
"observerProperties": {},
@@ -10,7 +10,7 @@
1010
"type": "EmberObject",
1111
"unobservedProperties": { "unobservedProp": ["prop3", "prop4"] }
1212
},
13-
"injecting-service.input": {
13+
"injecting-service": {
1414
"computedProperties": ["something", "otherThing"],
1515
"observedProperties": [],
1616
"observerProperties": {},
@@ -20,5 +20,23 @@
2020
"ownProperties": [],
2121
"type": "Service",
2222
"unobservedProperties": {}
23+
},
24+
"types/components/basic": {
25+
"type": "Component"
26+
},
27+
"types/controllers/basic": {
28+
"type": "Controller"
29+
},
30+
"types/helpers/basic": {
31+
"type": "Helper"
32+
},
33+
"types/routes/basic": {
34+
"type": "Route"
35+
},
36+
"types/services/basic": {
37+
"type": "Service"
38+
},
39+
"types/pods/foo/controller": {
40+
"type": "Controller"
2341
}
2442
}

transforms/ember-object/__testfixtures__/decorators.output.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Foo extends EmberObject {
9090
@classic
9191
@classNameBindings('isEnabled:enabled:disabled', 'a:b:c', 'c:d')
9292
@attributeBindings('customHref:href')
93-
class Comp extends EmberObject {
93+
class comp extends EmberObject {
9494
@computed('a', 'c')
9595
get isEnabled() {
9696
return false;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import classic from 'ember-classic-decorator';
22
@classic
3-
export default class DefaultExportInput extends EmberObject {}
3+
export default class DefaultExport extends EmberObject {}

transforms/ember-object/__testfixtures__/import.output.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import Controller from '@ember/controller';
55
import Evented from '@ember/object/evented';
66

77
@classic
8-
class Ser extends Service {}
8+
class ser extends Service {}
99

1010
@classic
11-
class Ctrl extends Controller {}
11+
class ctrl extends Controller {}
1212

1313
@classic
14-
class Evt extends Service.extend(Evented) {
14+
class evt extends Service.extend(Evented) {
1515
@on('click')
1616
e() {
1717
return 'e';
1818
}
1919
}
2020

21-
export { Ser, Ctrl, Evt };
21+
export { ser, ctrl, evt };

0 commit comments

Comments
 (0)