javascriptember.jsember-cliember-pods

Ember CLI pod structure migration


I just started using Ember for a real application, and already got myself into a bit of a bind.

I set up my environment.js file with the following:

modulePrefix: 'appname',
podModulePrefix: 'appname/pods'

However, this did not work and Ember CLI continues to generate files in the old/normal structure. I unfortunately did not even notice until I had a decent amount of work done... cause I was excited just to have an Ember app going! ;)

So the question I have is two-fold:

  1. Why is podModulePrefix not working? I've read up on it, and it seems like it should be fine. I'm probably missing the point on why it's not working.
  2. How can I migrate my existing file structure into the pod structure? Is it just manually doing so, or is there a tool out there that helps with things?

Thanks for any help!


Solution

  • I am going to answer

    1- you should just stop Ember and start again and your code should be

     podModulePrefix: 'app/pod', //just an example 
    

    then start creating a test component like

    ember g component test-com --pod
    

    the result would be this

    installing component
      create app/pod/components/test-com/component.js
      create app/pod/components/test-com/template.hbs
    installing component-test
      create tests/integration/pod/components/test-com/component-test.js
    

    2- no way, you must just simply create and copy and paste your code.

    If you would like to use the pods structure as the default for your project, you can set usePods in your .ember-cli config file to true (setting was previously named usePodsByDefault). To generate or destroy a blueprint in the classic type structure while usePods is true, use the --classic flag.

    With the usePods set to true.

    // .ember-cli
    {
        "usePods": true
    }