helix

https://github.com/Lokeh/helix
lilactown 2020-05-15T14:39:16.303100Z

https://github.com/Lokeh/helix/issues/57

đź‘Ť 1
đź‘€ 1
❤️ 1
lilactown 2020-05-15T14:39:24.303500Z

any thoughts from folks?

Aron 2020-05-15T14:43:08.305Z

for me the reverse problem is more interesting, I don't need spec for checking dev time code, I need it to generate data

dominicm 2020-05-15T14:46:22.307900Z

I don't think hs needs to wrap def. I think we just need some kind of spec which does {"helix/props" <spec>} as a js obj.

Aron 2020-05-15T14:47:40.308400Z

some? :)

dominicm 2020-05-15T14:48:08.308500Z

there's ops, etc. I don't remember the spec thing I mean.

lilactown 2020-05-15T14:49:05.309400Z

I want to at least expose the cdef because it allows helix to change the way it handles props w/o messing with people’s specs

lilactown 2020-05-15T14:49:53.310200Z

since it’s hidden behind the cdef macro

lilactown 2020-05-15T14:50:31.311Z

helix.spec/def would be there just for the removal of specs at release

dominicm 2020-05-15T14:50:40.311100Z

Same thing is achieved by (hs/props map?) where map? is user spec.

dominicm 2020-05-15T14:50:45.311200Z

You can change as much as you like.

lilactown 2020-05-15T14:51:04.311500Z

hmm i’m not sure

lilactown 2020-05-15T14:51:47.312400Z

(s/fdef greeting :args (s/cat :props (hs/props map?)))

lilactown 2020-05-15T14:52:11.312700Z

it’s kind of a mouthful

lilactown 2020-05-15T14:52:21.313100Z

but maybe it would be good to have both

lilactown 2020-05-15T14:52:45.313600Z

it also assumes that greeting is a function component

lilactown 2020-05-15T14:52:54.314Z

and I am wondering how I might extend this to class components

lilactown 2020-05-15T14:53:04.314400Z

probably not important for the first iteration

lilactown 2020-05-15T14:53:19.314700Z

i use classes so rarely :)

lilactown 2020-05-15T14:55:10.315400Z

@ashnur once you can spec a component, creating generators isn’t too far off

Aron 2020-05-15T14:57:47.315800Z

thanks, I realized this along the way, way after I wrote it down : | : )

đź‘Ť 1
Aron 2020-05-15T14:59:01.316Z

apart from error boundaries, I don't know why would you use them

lilactown 2020-05-15T15:00:04.316200Z

yep same

dominicm 2020-05-15T15:06:37.316500Z

I wouldn't say it's much more of a mouthful than the equivalent without hs: (s/fdef greeting :args (s/cat :props (hs/props map?))).

dominicm 2020-05-15T15:06:47.316600Z

Leverage the knowledge people already have about spec :)

Aron 2020-05-15T15:09:33.316900Z

deez peepl

lilactown 2020-05-15T15:11:25.317500Z

yeah, I want to introduce the minimal amount of API. seems good!

lilactown 2020-05-15T15:17:03.321400Z

next thing to think about is how to compose component specs, e.g.:

;; somehow get props spec of a specific component
(s/def ::greeting-props (hs/props-of greeting))

(s/def ::greeting-container-props
  (s/keys [::greeting-props]))

(s/fdef greeting-container
  :args (s/cat :props (hs/props greeting-container-props)))

(defnc greeting-container
  [{:keys [greeting-props]}]
  ($ greeting {& greeting-props}))

alidlorenzo 2020-05-15T17:57:33.322800Z

Fulcro has guardrails (https://github.com/fulcrologic/guardrails) * not sure if it helps spec JS object but it has a similar goal of only being for development time and not impact prod bundle size (haven’t used it though, but might be a good reference)

lilactown 2020-05-15T17:57:59.323300Z

yeah, definitely inspirational