fivetanley / ember-cli-migrator

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

Error while running migrator/recast #70

Closed awaer closed 9 years ago

awaer commented 9 years ago

After files are moved/copied, I am seeing these errors output to console and it is unclear what steps need to be taken in order to resolve the problem.

Do not know how to import QC
Do not know how to import QC
Do not know how to import QC

assert.js:86
  throw new assert.AssertionError({
        ^
AssertionError: {kind: var, declarations: [object Object], loc: null, type: VariableDeclaration, comments: null} does not match field "init": Expression | null of type VariableDeclarator
    at add (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/types.js:525:28)
    at /usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/types.js:539:17
    at Array.forEach (native)
    at Object.defineProperty.value [as variableDeclarator] (/usr/local/lib/node_modules/ember-cli-migrator/node_modules/recast/node_modules/ast-types/lib/types.js:538:30)
    at Context.MigratorVisitorPrototype.visitAssignmentExpression (/usr/local/lib/node_modules/ember-cli-migrator/lib/migrator-visitor.js:71:67)
    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)```
awaer commented 9 years ago

It seems this issue was caused by the presence of jQuery in app/scripts/vendor while running ember-cli-migrator. Removing that file prevented the error and allowed the migrator script to terminate successfully. I was able to trace it by adding a console.log to /usr/local/lib/node_modules/ember-cli-migrator/lib/ember-migrator.js:160 before the call to self.processFile(self.splitFiles[key])

igorT commented 9 years ago

How come the migrator was running on app/scripts/vendor, usually you just run it against the ember code

awaer commented 9 years ago

@igorT Is there a way to exclude? Our Ember application files/folders are in app/scripts, which also contains vendor scripts in app/scripts/vendor. The migrator seems to run over everything contained in the source directory. I don't see any way to avoid this.

igorT commented 9 years ago

Usually people put libraries outside their ember source code, one level deeper

tringenbach commented 8 years ago

For what it's worth, I ran into the same issue. For it my paths looked like 'app/js/libs/' and libs contained jquery, ember, and a few other things.

I'm pretty sure that's the layout the ember website encouraged me to use back when I first setup my project, which was around ember-1.0.4 or so.

Also, I had to have it ignore the .git directory, which I found odd since it has special support for git.