devpunks / snuggsi

snuggsi ツ - Easy Custom Elements in ~1kB
https://snuggsi.com
MIT License
398 stars 17 forks source link

why does bin/compile invoke bin/weigh? #103

Closed tmornini closed 7 years ago

tmornini commented 7 years ago

Why are there both bin/weigh and bin/validate-weight? bin/weigh only invokes bin/validate-weight. Worse yet, it throws away the exit status.

Why does bin/compile invoke bin/weigh? Appears to violate separation of concerns.

Why does watch/index.es invoke bin/validate-weight and why is || true required? bin/validate-weight returns status code correctly, no need to embellish it, I think.

snuggs commented 7 years ago

@tmornini ll address your 1 and 2 in a PR. Seems like they are development related and can adjust watch script as such. Definitely want to validate after every time i weigh and didn't know another way besides bin/weigh && bin/validate-weight in my watch script. Perhaps that's what it should be.

  1. Where else would validate-weight be called but after bin/weigh?
  2. because i was checking weight after deploy but think it's more a test situation. And truth be told I really don't look at it now that I have a weigh routine during development. Consider it the predecessor to your script but more details about other encoding versions.
  3. is because > https://github.com/devpunks/snuggsi/pull/92#issuecomment-313950407 and was addressed in this commit > https://github.com/devpunks/snuggsi/pull/92/commits/36ccfcd4c41e40ea87e547b089217891fc5d80b0
tmornini commented 7 years ago

@snuggs

Where else would validate-weight be called but after bin/weigh?

bin/weigh only calls bin/validate-weight.

And, to make matters worse, it's not CATAT. bin/weigh doesn't weigh anything! 😄

snuggs commented 7 years ago

@tmornini confused... :thinking: My "weigh" was merely viewing byte information from an ls command. I didn't know about awk either so there was none of that /cc @pachonk. I just needed to see how many bytes each file weighed in ./dist each time they changed. https://github.com/devpunks/snuggsi/blob/master/bin/weigh#L3

tmornini commented 7 years ago

@snuggs what about:

https://github.com/devpunks/snuggsi/blob/master/bin/weigh#L5

snuggs commented 7 years ago

ok let's fall back a little @tmornini

Why are there both bin/weigh and bin/validate-weight? bin/weigh only invokes bin/validate-weight. Worse yet, it throws away the exit status

I think you were going through it as you were typing as:

  1. bin weigh doesn't throw away exit status code. THe watch script does if i'm working on code while it's watching. Again exit 0 prevents the script from running again. A normal bin/weigh doesn't throw anything away. 0b. Without that watch script running i was getting huge errors in watch script didn't know how to fix. 0c. Needed my watch script to work yesterday so put weigh it in bin/weigh due to no response when @pachonk and I hit ya up. (Truth be told i still think there's no reason for 2 files but as you mentioned it's 2 operations (but within my context it's really not. Calling it 2 operations is like calling bin/validate-weight 2 operations because there is a | in the file.

  2. weigh doesn't ONLY call that. It never was there before I just put it there bcause it logically makes sense to check if there is an overweight validation AFTER weighing. Think 18 wheeler checkpoints at the highway. No difference. The validation happens on the scale. I mentioned your feature should go in bin/weigh (which was weigh at the time) and you said shouldn't go there but didn't think you had context.

  3. if weight validation wasn't there then i'd have to kick the can down the road to somewhere else. I could put it in whatever calls weigh but that's TOO separated for our needs. I was only using it to check weight after compilation. Only makes sense to weigh after compilation as there's nothing to weigh beforehand. And usually need to know size only after compilation.

  4. Need to see weight. Was previously using eyeballs to validate. "Weigh isn't doing anything" that ls is all i needed for eyeball check before and didn't know any other way to get byte sizes but ls. Weigh is nice but having weigh and validate i feel is decoupling too much in separate files. Would be like in this case a separate file for ls and another for awk when you just need both of them to work at the same time.

Again I mentioned this few lines of script of yours should have went in weigh in the first place like it is now. Didn't think there was a need for 2 scripts but didn't think you knew what was going on with the scripts. Like the package script. it's there but i only use it one off because it duplicates much of what already is going on. Now validate weight is super handy but i feel not really bonafied to be it's own script and always felt should be an addendum to bin/weigh and/or bin/test. For now most valuable as addendum to weigh but from C/I's concern would/should be an addendum to bin/test.

My needs were only giving me this: image

And you are providing is this (which is ok) image

We are just figuring out where the batteries go and i'm telling you i'm not used to having an LED screen in the first place let alone batteries. That's why I don't know where the batteries go on my handheld scale.

Always remember if you take a fish out of water and place it next to a tree and judge it by how well it can climb. Of course the fish will seem stupid." - #FreeJewelry.

Or as @brandondees would say "If you strap a rocket on the back of a bicycle of course you're not gonna have the greatest steering to begin with." Hehe /cc @pachonk

Basically I was just getting to No. 4 on this list in the quickest way possible.

capture d ecran 2017-07-11 a 07 16 46