JSRocksHQ / harmonic

The next static site generator
http://harmonicjs.com/
MIT License
283 stars 26 forks source link

Code refactoring #117

Open jaydson opened 9 years ago

jaydson commented 9 years ago

It's time to apply some serious code refactoring on Harmonic. The project has evolved and we discovered a lot of quirks in tools we're using and within our own code. As a bleeding-edge project, this kind of thing can happen at any time, and this is awesome IMHO.

I'm labelling this issue with 'discussion' and 'p2' because we need to define some goals first, but after that, refactoring is absolutely one of ours priorities.

I'm starting to draft a model(kind of) of what we can do in our code structure, based on what we already have: harmonic

What we have in this first draft:

core_modules folder: All internal modules must to be placed inside the core_modules folder. We can split the code in tiny modules, so we can re-use in CLI, API, etc. Another benefit of the core_modules folder is that we can identify future node modules, so we can "promote" them to npm.

I definitely need some help and feedback here @UltCombo @leobalter @felipenmoura

UltCombo commented 9 years ago

Very nice start! :+1:

We could focus on the API, then the CLI would just have to call API functions behind the scenes. This way we don't duplicate code and it eases keeping feature parity betwen API and CLI.

Other things we should clean up:

Misc:

felipenmoura commented 9 years ago

Really cool.

I believe it would also be cool to have some hooks, like "before building", or for each generated file. For instance, I would want to get a list of videos from a feed(from my youtube channel) to bind onto a template.

jaydson commented 9 years ago

Great insights here. Thanks both @UltCombo and @felipenmoura. We can change the core_modules folder name, it was just an example.

UltCombo commented 9 years ago

@felipenmoura I believe that fits in https://github.com/es6rocks/harmonic/issues/6

UltCombo commented 9 years ago

@jaydson I think we should do this in small (but "complete") steps. E.g.:


We can change the core_modules folder name, it was just an example.

I don't really care about the name either, it was just a random idea. :stuck_out_tongue:

UltCombo commented 9 years ago

Can we focus on this refactoring soon? I guess it would be nice to get this done as soon as we merge the currently open big PRs/branches (ESLint, external themes).

@jaydson can we schedule a hangout to kick off this refactoring?