-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
WIP: #399 - organize vue codebase #408
WIP: #399 - organize vue codebase #408
Conversation
3ec8980
to
7a59ab5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not finished reviewing this PR, but I did add two comments, and I'm just pointing out that Travis CI failed, so double-check that everything works locally by running grunt test
before submitting a PR.
If you did do that, then that's something else that needs to be fixed. grunt test
locally should always match the result shown by Travis, and if it doesn't it means there's a test-related bug that needs to be fixed.
frontend/simple/utils/lazyLoadVue.js
Outdated
.then(() => resolve(window[component])) | ||
.catch((err) => reject(err)) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file doesn't make sense to me. It seems to be only about one thing, a single function, and yet it does two things (setup vue-script2 as well).
In summary, two issues:
- I think it is a bad idea to start doing 1-file-per-function.
- This file is poorly named as what it does / what it's for isn't adequately described by the filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I can keep it as it was before, lazyLoadVue
and mapValues
on the same file, and we can see later how to organize it better on another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding travis failing, I was at the train with low wifi, so I believe the push didn't successed. But it's fixed now :)
.editorconfig
Outdated
# 2 space indentation | ||
[*.py] | ||
indent_style = space | ||
indent_size = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think .editorconfig
should be added to .gitignore
, not added to the repo, for two reasons:
- We do not use
*.py
files anywhere inside the project - We already have rules for indentation, and those are defined by
standard
linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really agree, because one thing is the linter rules, another thing is the editor config, those are two separated concerns. Without .editorconfig
everytime I start coding I need to go to my editor config and change the size spacing to 2, instead of 4 (my default). With this file, I don't need to. Not sure if I'm the only one who needs to do it. If yes, then okay, I'll add it to .gitignore
7a59ab5
to
ff8fd9f
Compare
I want to really think this through so that we don't have to do it again, and so I've spent some time thinking about the categories the files we have belong to. I think it's possible to organize things in a simpler way. For example, it's not clear to me why @hubudibu's I'm also really not a fan of creating entire files for single functions, especially one-liners like I notice we have:
This is the standard MVC design pattern. However, we have additional folders that don't fit quite well into this. If you look at what folders we have in Thus, a category separate from MVC suggests itself, and highlights the nature of what MVC is itself:
However, you'll note the Furthermore, the contents of the
The Server-side structureSo, it's clear, there are two things we need to consider: what does the directory structure look like before the bundle is built, and what does it look like on the server after it is built. It may be easier to work backwards, starting with post-build, i.e. the files in the Let's review the 3 major conceptual categories we've discovered so far:
So perhaps our server-side directory structure can look like this:
Here we see our 3 major categories are still visible and are visibly separate as well:
From this we can deduce an improved developer-side structure as well. Developer-side structureAgain, our 3 mental categories: MVC + static resources + third-party Let's break them down individually, starting with MVC: MVCUsing
And, maybe This is a kind of MVC + MVVM pattern, but conceptually it seems to organize well this way, at least it seems that way to me. ConclusionThat, to me, seems to be a long-lasting and conceptually clear / well organized folder structure that should last for the life of the project. As this does involve editing Thoughts? |
503933f
to
ff8fd9f
Compare
A suggestion during today's call is to modify the
|
e49f073
to
d467c1f
Compare
d467c1f
to
3e99a0d
Compare
@taoeffect and @hubudibu I think I've made it! 😄 With exactly 110 files updated, I had the attention to, at each folder/file move, do a commit for it and verify if still were still working. Check Some notes:
|
3e99a0d
to
d1fa2c5
Compare
Yes, this file is important for being able to run
Eh, we'll probably rewrite/delete it but for now just ignore it. |
…azyLoadVue.js and utils/giLodash.js
…and js/events.js -> model/contracts
…js -> controller/
412cbe1
to
e021676
Compare
43b02be
to
4e434fd
Compare
4e434fd
to
a4d5d9a
Compare
Great job!! |
Closes #399.
So @taoeffect and @hubudibu this MR only moves files around and avoid any refactor inside the files itself, besides paths.
/views
router
are now sorted Alphabetical for a easier comparation toviews
folder.views
folder has only the files imported atjs/router.js
. The rest was moved to its respective foldercomponent
orcontainer
CreateGroupSteps
being imported atjs/router.js
, I've kept it at/components
because I believe that's something we'll iterate during Build out and polish generic voting / proposals system #343 Voting System implementation.included.ejs
because it's not used anywhere./containers
/views
were moved into here./components
[PascalCase].vue
YourGroupsList
to onlyGroupsList
/js
and/utils
/js
. A little of everything... So, I've moved out from there what I consider utilities to a new folder/utils
such as:currencies.js
filters/toPercent.js
- On its core a filter on vue is as simple as a utility, right? That's why I've moved. If you think we should keep filters folder, I can revert it easily.js/utils.js
has 2 functionslazyLoadVue
andmapValues
. I've split them in 2 files. Note thatmapValues
isn't being used at all at the moment. The comments talk about having our ownlodash
, so I've movedmapValues
to a new fileutils/giLodash.js
and we can feed it when needed.I didn't touch anything related to vuex, since I'm not sure the best approach. If you guys think the change is quick, I can do it on this MR too, otherwise, it can be done in another MR.
linters
.editorconfig
, just to standardize the 2 spaces, so a person doesn't need to change its editor to match the standard configs