Skip to content

Commit 38cb697

Browse files
author
Robert Jackson
committed
Release 1.1.0
1 parent 1fc0d23 commit 38cb697

File tree

4 files changed

+193
-20
lines changed

4 files changed

+193
-20
lines changed

CHANGELOG.md

+31
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
## v1.1.0 (2019-08-20)
2+
3+
#### :rocket: Enhancement
4+
* [#177](https://github.com/ember-codemods/ember-native-class-codemod/pull/177) Fixup class naming logic and make it work with pods ([@pzuraq](https://github.com/pzuraq))
5+
* [#176](https://github.com/ember-codemods/ember-native-class-codemod/pull/176) Removes `@className` and `@attribute` in favor of `@classNameBindings` and `@attributeBindings` ([@pzuraq](https://github.com/pzuraq))
6+
7+
#### :bug: Bug Fix
8+
* [#179](https://github.com/ember-codemods/ember-native-class-codemod/pull/179) Ignore chained class definitions ([@pzuraq](https://github.com/pzuraq))
9+
* [#152](https://github.com/ember-codemods/ember-native-class-codemod/pull/152) Remove remaining traces of wrapComputed. ([@rwjblue](https://github.com/rwjblue))
10+
* [#150](https://github.com/ember-codemods/ember-native-class-codemod/pull/150) Do nothing for non-JS files. ([@rwjblue](https://github.com/rwjblue))
11+
12+
#### :memo: Documentation
13+
* [#184](https://github.com/ember-codemods/ember-native-class-codemod/pull/184) Improve markup in codemod options table in the README.md. ([@chriskrycho](https://github.com/chriskrycho))
14+
* [#164](https://github.com/ember-codemods/ember-native-class-codemod/pull/164) Fix typo in the readme ([@lolmaus](https://github.com/lolmaus))
15+
* [#155](https://github.com/ember-codemods/ember-native-class-codemod/pull/155) Fix helpers link in README ([@rajasegar](https://github.com/rajasegar))
16+
17+
#### :house: Internal
18+
* [#180](https://github.com/ember-codemods/ember-native-class-codemod/pull/180) Adds tests for reopening classes ([@pzuraq](https://github.com/pzuraq))
19+
* [#173](https://github.com/ember-codemods/ember-native-class-codemod/pull/173) Swap out the telemetry helpers for the `ember-codemods-telemetry-helpers` package ([@NullVoxPopuli](https://github.com/NullVoxPopuli))
20+
* [#143](https://github.com/ember-codemods/ember-native-class-codemod/pull/143) Add test for using ember-concurrency tasks in converted objects. ([@rwjblue](https://github.com/rwjblue))
21+
* [#151](https://github.com/ember-codemods/ember-native-class-codemod/pull/151) Fixup typo in method name closet -> closest. ([@rwjblue](https://github.com/rwjblue))
22+
23+
#### Committers: 7
24+
- Andrey Mikhaylov (lolmaus) ([@lolmaus](https://github.com/lolmaus))
25+
- Chris Garrett ([@pzuraq](https://github.com/pzuraq))
26+
- Chris Krycho ([@chriskrycho](https://github.com/chriskrycho))
27+
- L. Preston Sego III ([@NullVoxPopuli](https://github.com/NullVoxPopuli))
28+
- Rajasegar Chandran ([@rajasegar](https://github.com/rajasegar))
29+
- Robert Jackson ([@rwjblue](https://github.com/rwjblue))
30+
- [@dependabot-preview[bot]](https://github.com/apps/dependabot-preview)
31+
132
## v1.0.1 (2019-06-23)
233

334
#### :bug: Bug Fix

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ transformation of
8888

8989
<!--TRANSFORMS_START-->
9090
* [ember-object](transforms/ember-object/README.md)
91-
* [helpers](transforms/helpers)
91+
* [helpers](transforms/helpers/README.md)
9292
<!--TRANSFORMS_END-->
9393

9494
## Contributing

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-native-class-codemod",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "Codemods for transforming ember app code to native class syntax with decorators.",
55
"keywords": [
66
"codemod-cli"

transforms/ember-object/README.md

+160-18
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,16 @@ ember-native-class-codemod ember-object path/of/files/ or/some**/*glob.js
1717
<!--FIXTURES_TOC_START-->
1818
* [action-invalid](#action-invalid)
1919
* [basic](#basic)
20+
* [chained-class-definition](#chained-class-definition)
2021
* [class-fields](#class-fields)
22+
* [class-reopen](#class-reopen)
2123
* [decorators-invalid](#decorators-invalid)
2224
* [decorators](#decorators)
2325
* [default-export](#default-export)
2426
* [double-quotes](#double-quotes)
27+
* [ember-concurrency](#ember-concurrency)
2528
* [import](#import)
29+
* [injecting-service](#injecting-service)
2630
* [runtime](#runtime)
2731
<!--FIXTURES_TOC_END-->
2832

@@ -217,6 +221,24 @@ class Foo extends Test.extend(MyMixin) {
217221
@classic
218222
class Foo extends EmberObject.extend(MixinA, MixinB) {}
219223

224+
```
225+
---
226+
<a id="chained-class-definition">**chained-class-definition**</a>
227+
228+
**Input** (<small>[chained-class-definition.input.js](transforms/ember-object/__testfixtures__/chained-class-definition.input.js)</small>):
229+
```js
230+
import EmberObject from '@ember/object';
231+
232+
export default EmberObject.extend({}).reopenClass({});
233+
234+
```
235+
236+
**Output** (<small>[chained-class-definition.output.js](transforms/ember-object/__testfixtures__/chained-class-definition.output.js)</small>):
237+
```js
238+
import EmberObject from '@ember/object';
239+
240+
export default EmberObject.extend({}).reopenClass({});
241+
220242
```
221243
---
222244
<a id="class-fields">**class-fields**</a>
@@ -282,6 +304,34 @@ class Foo extends Test {
282304
}
283305
}
284306

307+
```
308+
---
309+
<a id="class-reopen">**class-reopen**</a>
310+
311+
**Input** (<small>[class-reopen.input.js](transforms/ember-object/__testfixtures__/class-reopen.input.js)</small>):
312+
```js
313+
import EmberObject from '@ember/object';
314+
315+
const Foo = EmberObject.extend({});
316+
317+
Foo.reopenClass({});
318+
319+
export default Foo;
320+
321+
```
322+
323+
**Output** (<small>[class-reopen.output.js](transforms/ember-object/__testfixtures__/class-reopen.output.js)</small>):
324+
```js
325+
import classic from 'ember-classic-decorator';
326+
import EmberObject from '@ember/object';
327+
328+
@classic
329+
class Foo extends EmberObject {}
330+
331+
Foo.reopenClass({});
332+
333+
export default Foo;
334+
285335
```
286336
---
287337
<a id="decorators-invalid">**decorators-invalid**</a>
@@ -566,7 +616,15 @@ const Foo = EmberObject.extend({
566616
**Output** (<small>[decorators.output.js](transforms/ember-object/__testfixtures__/decorators.output.js)</small>):
567617
```js
568618
import classic from 'ember-classic-decorator';
569-
import { attribute, className, classNames, tagName, layout as templateLayout } from '@ember-decorators/component';
619+
620+
import {
621+
classNames,
622+
attributeBindings,
623+
classNameBindings,
624+
tagName,
625+
layout as templateLayout,
626+
} from '@ember-decorators/component';
627+
570628
import { observes as watcher, on } from '@ember-decorators/object';
571629
import { inject as controller } from '@ember/controller';
572630
import { inject as service } from '@ember/service';
@@ -647,20 +705,16 @@ class Foo extends EmberObject {
647705
}
648706

649707
@classic
650-
class Comp extends EmberObject {
708+
@classNameBindings('isEnabled:enabled:disabled', 'a:b:c', 'c:d')
709+
@attributeBindings('customHref:href')
710+
class comp extends EmberObject {
651711
@computed('a', 'c')
652-
@className('enabled', 'disabled')
653712
get isEnabled() {
654713
return false;
655714
}
656715

657-
@className('b', 'c')
658716
a = true;
659-
660-
@className('d')
661717
c = '';
662-
663-
@attribute('href')
664718
customHref = 'http://emberjs.com';
665719
}
666720

@@ -784,7 +838,7 @@ export default EmberObject.extend({});
784838
```js
785839
import classic from 'ember-classic-decorator';
786840
@classic
787-
export default class DefaultExportInput extends EmberObject {}
841+
export default class DefaultExport extends EmberObject {}
788842

789843
```
790844
---
@@ -877,6 +931,43 @@ class Foo extends Test.extend(MyMixin) {
877931
@classic
878932
class Foo extends EmberObject.extend(MixinA, MixinB) {}
879933

934+
```
935+
---
936+
<a id="ember-concurrency">**ember-concurrency**</a>
937+
938+
**Input** (<small>[ember-concurrency.input.js](transforms/ember-object/__testfixtures__/ember-concurrency.input.js)</small>):
939+
```js
940+
import Component from '@ember/component';
941+
import { task } from 'ember-concurrency';
942+
943+
export default Component.extend({
944+
fetchAlerts: task(function*() {
945+
let alerts = yield this.store.query('alert', {
946+
filter: { id: this.get('alert.id') }
947+
});
948+
return alerts.sortBy('createdAt').reverse();
949+
}).drop(),
950+
});
951+
952+
```
953+
954+
**Output** (<small>[ember-concurrency.output.js](transforms/ember-object/__testfixtures__/ember-concurrency.output.js)</small>):
955+
```js
956+
import classic from 'ember-classic-decorator';
957+
import Component from '@ember/component';
958+
import { task } from 'ember-concurrency';
959+
960+
@classic
961+
export default class EmberConcurrency extends Component {
962+
@(task(function*() {
963+
let alerts = yield this.store.query('alert', {
964+
filter: { id: this.get('alert.id') }
965+
});
966+
return alerts.sortBy('createdAt').reverse();
967+
}).drop())
968+
fetchAlerts;
969+
}
970+
880971
```
881972
---
882973
<a id="import">**import**</a>
@@ -908,35 +999,65 @@ import Controller from '@ember/controller';
908999
import Evented from '@ember/object/evented';
9091000

9101001
@classic
911-
class Ser extends Service {}
1002+
class ser extends Service {}
9121003

9131004
@classic
914-
class Ctrl extends Controller {}
1005+
class ctrl extends Controller {}
9151006

9161007
@classic
917-
class Evt extends Service.extend(Evented) {
1008+
class evt extends Service.extend(Evented) {
9181009
@on('click')
9191010
e() {
9201011
return 'e';
9211012
}
9221013
}
9231014

924-
export { Ser, Ctrl, Evt };
1015+
export { ser, ctrl, evt };
1016+
1017+
```
1018+
---
1019+
<a id="injecting-service">**injecting-service**</a>
1020+
1021+
**Input** (<small>[injecting-service.input.js](transforms/ember-object/__testfixtures__/injecting-service.input.js)</small>):
1022+
```js
1023+
import Service, { service as injectService } from '@ember/service';
1024+
1025+
export default Service.extend({
1026+
something: injectService(),
1027+
otherThing: injectService('some-thing'),
1028+
});
1029+
1030+
```
1031+
1032+
**Output** (<small>[injecting-service.output.js](transforms/ember-object/__testfixtures__/injecting-service.output.js)</small>):
1033+
```js
1034+
import classic from 'ember-classic-decorator';
1035+
import Service, { service as injectService } from '@ember/service';
1036+
1037+
@classic
1038+
export default class InjectingServiceService extends Service {
1039+
@injectService()
1040+
something;
1041+
1042+
@injectService('some-thing')
1043+
otherThing;
1044+
}
9251045

9261046
```
9271047
---
9281048
<a id="runtime">**runtime**</a>
9291049

9301050
**Input** (<small>[runtime.input.js](transforms/ember-object/__testfixtures__/runtime.input.js)</small>):
9311051
```js
932-
import RuntimeInput from 'common/runtime/input';
1052+
import Runtime from 'common/runtime';
9331053
import { alias } from '@ember/object/computed';
9341054
import { computed } from '@ember/object';
1055+
import { service } from '@ember/service';
9351056

9361057
/**
9371058
* Program comments
9381059
*/
939-
export default RuntimeInput.extend(MyMixin, {
1060+
export default Runtime.extend(MyMixin, {
9401061
/**
9411062
* Property comments
9421063
*/
@@ -946,6 +1067,9 @@ export default RuntimeInput.extend(MyMixin, {
9461067
[MY_VAL]: 'val',
9471068
queryParams: {},
9481069

1070+
error: service(),
1071+
errorService: service('error'),
1072+
9491073
unobservedProp: null,
9501074
offProp: null,
9511075

@@ -957,6 +1081,11 @@ export default RuntimeInput.extend(MyMixin, {
9571081

9581082
computedMacro: customMacro(),
9591083

1084+
anotherMacro: customMacroWithInput({
1085+
foo: 123,
1086+
bar: 'baz'
1087+
}),
1088+
9601089
/**
9611090
* Method comments
9621091
*/
@@ -1001,13 +1130,14 @@ import classic from 'ember-classic-decorator';
10011130
import { off, unobserves } from '@ember-decorators/object';
10021131
import { action, computed } from '@ember/object';
10031132
import { alias } from '@ember/object/computed';
1004-
import RuntimeInput from 'common/runtime/input';
1133+
import Runtime from 'common/runtime';
1134+
import { service } from '@ember/service';
10051135

10061136
/**
10071137
* Program comments
10081138
*/
10091139
@classic
1010-
export default class RuntimeInputEmberObject extends RuntimeInput.extend(MyMixin) {
1140+
export default class _Runtime extends Runtime.extend(MyMixin) {
10111141
/**
10121142
* Property comments
10131143
*/
@@ -1018,6 +1148,12 @@ export default class RuntimeInputEmberObject extends RuntimeInput.extend(MyMixin
10181148
[MY_VAL] = 'val';
10191149
queryParams = {};
10201150

1151+
@service
1152+
error;
1153+
1154+
@service('error')
1155+
errorService;
1156+
10211157
@unobserves('prop3', 'prop4')
10221158
unobservedProp;
10231159

@@ -1032,9 +1168,15 @@ export default class RuntimeInputEmberObject extends RuntimeInput.extend(MyMixin
10321168
@alias('numPlusOne')
10331169
numPlusPlus;
10341170

1035-
@customMacro
1171+
@customMacro()
10361172
computedMacro;
10371173

1174+
@customMacroWithInput({
1175+
foo: 123,
1176+
bar: 'baz'
1177+
})
1178+
anotherMacro;
1179+
10381180
/**
10391181
* Method comments
10401182
*/

0 commit comments

Comments
 (0)