fivetanley / ember-cli-migrator

migrate your files to the standard ember-cli structure, preserving git history
MIT License
106 stars 22 forks source link

Issues in 0.8 #56

Closed joeruello closed 9 years ago

joeruello commented 9 years ago

Hi all, first off, this project is amazing and a massive timesaver, thanks a lot to all involved.

I tried to use 0.8 on a project this morning I'm having issues.

/usr/local/lib/node_modules/ember-cli-migrator/lib/migrator-visitor.js:82
      var __namespace__ = leftNode.object.object && leftNode.object.object.nam
                                         ^
TypeError: Cannot read property 'object' of undefined
    at Context.MigratorVisitorPrototype.visitAssignmentExpression (/usr/local/lib/node_modules/ember-cli-migrator/lib/migrator-visitor.js:82:42)
    at Context.invokeVisitorMethod (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:306:43)
    at Visitor.PVp.visitWithoutReset (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:180:28)
    at visitChildren (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:226:21)
    at Visitor.PVp.visitWithoutReset (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:188:16)
    at NodePath.each (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/path.js:96:22)
    at visitChildren (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:199:14)
    at Visitor.PVp.visitWithoutReset (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:188:16)
    at Visitor.PVp.visit (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:124:25)
    at Object.visit (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:92:51)

I logged the value of leftNode:

{ type: 'Identifier',
  name: 'App',
  typeAnnotation: undefined,
  optional: undefined,
  loc: 
   { start: { line: 7, column: 0 },
     end: { line: 7, column: 3 },
     lines: {},
     indent: 0 } }

and here is the file:

/*****************************************************************************
 * APPLICATION
 *****************************************************************************/

Ember.MODEL_FACTORY_INJECTIONS = true;
Ember.FEATURES.HTMLBars = true;
App = Ember.Application.create({
    LOG_TRANSITIONS_INTERNAL: false,
    ENVIRONMENT: $('meta[name="environment"]').attr('content'),
    CLIENTID: $('meta[name="client-id"]').attr('content')
});

On another note, are there any plans for migrating components?

fivetanley commented 9 years ago

Ah dang. :(

For now you could try cloning the repository and try if (leftNode && leftNode.object) in that code path. I can work on fixing that soon.

On another note, are there any plans for migrating components?

Huh, there's no reason that they shouldn't be supported. I think it's just adding another type to our list of supported things.

joeruello commented 9 years ago

Seems to work great!

Adding component to typedExport.knowTypes also works.

I can work on a PR if you're short on time?