martyjs / marty

A Javascript library for state management in React applications
http://martyjs.org
MIT License
1.09k stars 76 forks source link

v0.10 refactor marty-constants and marty-utils #256

Closed dariocravero closed 9 years ago

dariocravero commented 9 years ago

First steps towards refactoring and extracting packages for #253. Put marty-constants and marty-utils into their own package. Removed deprecated stuff in constants. Will expand on the code later on, have to run but wanted to share it :) Thoughts?

jhollingworth commented 9 years ago

ah annoying, I just did the same thing this afternoon!

jhollingworth commented 9 years ago

I'm going to publish where i'm at tomorrow morning

jhollingworth commented 9 years ago

I'm going to close this if its ok

dariocravero commented 9 years ago

Sure. After a first pass at the refactoring and the registering mechanism presented I think there's lots of room for simplification - need to play more with it but I think we might not even need the whole registering process at all. From my PR I'd rescue things like the playground, everything on root instead of lib and the build/test process inside package.json as scripts rather than bash scripts orchestrated from a Makefile but I understand if you like that approach better. Thoughts?

jhollingworth commented 9 years ago
jhollingworth commented 9 years ago

Somewhat in the middle about co-locating __tests__, it seems its the way everyone is going with them. maybe I should move with the times?

dariocravero commented 9 years ago
lib/index.js
lib/file.js
lib/module/file.js

and want to require/import say, lib/module/file.js I need to either have it exported in lib/index.js and import the main lib as you said above or require('my-lib/lib/module/file') which adds lib in between because of the way node_modules are required. If it's not prefixed by lib I can simply require('my-lib/module/file') which is the file I was after.

Of course you can also have a build process that puts the files in the correct path inside that dist/node folder but unless I'm missing something on why dist/node is being generated (other than it being ES5 compatible-code), I think that having babel properly setup (through the use of a .babelrc file which came out in 5.0.0) should ease the conversion process and allow us to build for ES6 without having to compile that down to dist/node.

oliverwoodings commented 9 years ago

I personally prefer unit tests next to the source (but you probably already know this :+1: )