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

Does this support pods? #3

Open
eibrahim opened this issue Jun 7, 2016 · 8 comments
Open

Does this support pods? #3

eibrahim opened this issue Jun 7, 2016 · 8 comments

Comments

@eibrahim
Copy link

eibrahim commented Jun 7, 2016

I tried gf on multiple things and it doesn't seem to be jumping anywhere. It always displays error:

can't find file 'xxxx' in path

@AndrewRadev
Copy link
Owner

I haven't really tried to support pods, since I've never used a pod structure, but I'd like to give it a shot. Could you give me an example of your directory structure?

So, for instance, if you gf on a component in a template, where would that template be located? Right now, I assume templates live in app/templates/<path-to-template>.hbs, and component templates are either in app/components/<component-name>/template.hbs, or app/templates/components/<component-name>.hbs. Could you describe where these would be located in your pods?

@eibrahim
Copy link
Author

eibrahim commented Jun 8, 2016

say you have a component called nav-bar, it will be located at

app/pods/nav-bar/component.js
app/pods/nav-bar/template.hbs

for a blog route it would be

app/pods/blog/controller.js
app/pods/blog/model.js
app/pods/blog/template.js
app/pods/blog/route.js

PS: Pod structure is so much better :)

@mszoernyi
Copy link

mszoernyi commented Jun 19, 2016

The Folder pods is optional or can be different per project. Not sure if this config has been removed. For example we don't use a pods folder but used the pod sturucture.

addon/
├── application
│   ├── adapter.js
│   ├── controller.js
│   ├── route.js
│   └── serializer.js
├── components
│   ├── application-container
│   │   ├── component.js
│   │   ├── style.scss
│   │   └── template.hbs
│   ├── creative-uploader
│   │   ├── component.js
│   │   ├── style.scss
│   │   └── template.hbs
│   ├── data-form
│   │   ├── component.js
│   │   ├── header <-- child component
│   │   ├── style.scss
│   │   └── template.hbs
│   ├── data-table
│   │   ├── cell <-- child component
│   │   ├── column <-- child component
│   │   ├── column-header <-- child component
│   │   ├── component.js
│   │   ├── editable-cells.js <-- mixin for compoment
│   │   ├── filterable.js <-- mixin for component
│   │   ├── header <-- child component
│   │   ├── selectable-columns.js <-- mixin
│   │   ├── selectable.js <-- mixin
│   │   ├── sortable.js <-- mixin
│   │   ├── style.scss
│   │   ├── template.hbs
│   ├── drop-down
│   │   ├── component.js
│   │   ├── container
│   │   ├── mixin.js
│   │   ├── template.hbs
│   │   └── toggle
│   ├── form-field
│   │   ├── component.js
│   │   └── template.hbs
│   ├── form-wizard
│   │   ├── component.js
│   │   ├── fieldset.js
│   │   └── template.hbs
│   ├── im-icon
│   │   └── component.js
│   ├── label-select
│   │   └── component.js
│   ├── login-form
│   │   ├── component.js
│   │   ├── style.scss
│   │   └── template.hbs

I just found this addon but I guess pod structure is just setting this up in the projectionist config. Haven't used it yet but will dig into it.

There is an open RFC for a new file structure https://github.com/dgeb/rfcs/blob/module-unification/text/0000-module-unification.md#example-application. Still in progress but it's pretty well defined.

https://github.com/fivetanley/ember-cli-migrator tries to solve the migration between classic, pod and new structures. Might be helpful for get an idea about the different structures.

@AndrewRadev
Copy link
Owner

AndrewRadev commented Jun 28, 2016

@eibrahim I've tried to add support for files within "app/pods". For components, for instance, it would be something like "if you gf on {{foo/bar-baz}}, check if app/pods/foo/bar-baz/template.hbs exists". Could you try out what has been described in the README and let me know which ones still don't work for your project structure? I don't have a real project to experiment with (that's structured like this), so I've been relying on specs.

@AndrewRadev
Copy link
Owner

AndrewRadev commented Jun 28, 2016

@mszoernyi For starters, I haven't even tried to support an "addons" directory. How does this work? Is it "app/addons", or is that in the root of the project?

What I currently do is look for an ember-cli-build.js file in the current or parent directories, and if I find it, I consider its containing directory the "ember root", which contains "app" and so on. Is this the case in your project? If there's no such file, can you think of a more reliable way to detect an ember application?

As for your example structure: Right now, a component like app/components/application-container/<component-contents> will be detected, so a gf on {{application-container}} will jump to app/components/application-container/template.hbs. In your case, it's not "app", but "addon", so maybe that's the only thing I need to change? Waiting for confirmation on where the "addon" directory is located in the project structure.

How does it work with child components? For instance, do you call {{data-table/cell}}, or do you write {{cell}} within the {{data-table}} templates and that one gets automatically namespaced? In the first case, it should actually work out of the box (after fixing the whole app/addons thing), but in the second case, I'll need to do some more adjustments.

Thanks for the links. Seems like a lot of content, though :). I'l see when I can go through it.

@GCorbel
Copy link

GCorbel commented Nov 13, 2016

Hi,

I have the same issue, I have this component :

{{kh-subscriptions-chart subscriptions=model.subscriptions}}

I want to go in app/pods/components/kh-subscriptions-chart/template.hbs but it doesn't find the file.

@AndrewRadev
Copy link
Owner

@GCorbel In your case, it seems the component is in app/pods/components/kh-subscriptions-chart. Based on what @eibrahim explained, I thought it would be app/pods/kh-subscriptions-chart. Guess both work.

I've just pushed a change to support this.

@GCorbel
Copy link

GCorbel commented Nov 13, 2016

It works. Thanks a lot! You was very fast!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants