Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try cp-property-map codemod from ember-3x-codemods #727

Merged
merged 3 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ All blueprints are up-to-date!`;
statsOnly,
listCodemods,
runCodemods,
codemodsUrl: 'https://raw.githubusercontent.com/ember-cli/ember-cli-update-codemods-manifest/v3/manifest.json',
codemodsUrl: 'https://raw.githubusercontent.com/rajasegar/ember-cli-update-codemods-manifest/cp-property-map/manifest.json',
createCustomDiff,
ignoredFiles: [await getBlueprintFilePath(cwd)],
wasRunAsExecutable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Controller from '@ember/controller';
import Ember from 'ember';
import { assign } from '@ember/polyfills';
import { map } from '@ember/object/computed';

export default Controller.extend({
fullName: computed('firstName', 'lastName', function() {
Expand All @@ -11,6 +12,10 @@ export default Controller.extend({
return `${this.firstName} ${this.lastName}`;
},

friendNames: map('friends', ['nameKey'], function(friend) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you import map? Just in case the codemod starts following the source in the future, and not codemodding things that don't come from ember.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, similarly for the computed properties also we need to import the computed right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but I wouldn't worry about it for this pull request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then, I will make changes for importing map

return friend[this.nameKey];
}),

actions: {
foo(object) {
this.doStuff(object);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Ember from 'ember';
import { merge } from '@ember/polyfills';
import { map } from '@ember/object/computed';

export default Ember.Controller.extend({
fullName: computed(function() {
Expand All @@ -10,6 +11,10 @@ export default Ember.Controller.extend({
return `${this.firstName} ${this.lastName}`;
}).volatile('firstName', 'lastName'),

friendNames: map('friends', function(friend) {
return friend[this.nameKey];
}).property('nameKey'),

actions: {
foo(object) {
Ember.propertyWillChange(object, 'someProperty');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Controller from '@ember/controller';
import Ember from 'ember';
import { assign } from '@ember/polyfills';
import { map } from '@ember/object/computed';

export default Controller.extend({
fullName: computed('firstName', 'lastName', function() {
Expand All @@ -11,6 +12,10 @@ export default Controller.extend({
return `${this.firstName} ${this.lastName}`;
},

friendNames: map('friends', ['nameKey'], function(friend) {
return friend[this.nameKey];
}),

actions: {
foo(object) {
this.doStuff(object);
Expand Down