Skip to content
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

chore: add cl helper #1479

Merged
merged 6 commits into from
Apr 27, 2023
Merged

chore: add cl helper #1479

merged 6 commits into from
Apr 27, 2023

Conversation

janniks
Copy link
Collaborator

@janniks janniks commented Apr 10, 2023

This PR was published to npm with the version 6.5.1-pr.f11b880.0
e.g. npm install @stacks/[email protected] --save-exact

summary

Adds a Cl bundled export that allows better discovery of clarity methods and less importing.

examples

NEW

import { Cl } from '@stacks/transactions'
const tup = Cl.tuple({ a: Cl.unit(2) })

VS previously

import { uintCV, tupleCV } from '@stacks/transactions'
const tup = tupleCV({ a: unitCV(2) })

discussion

I'm still in love with the idea to add the type-constructors in uppercase, e.g. Cl.Int(2) (lowercase Cl.false won't works since false is a keyword) and keep methods lowercase, e.g. Cl.serialize(...) to add more distinction (and potentially group more methods under a new namespace, similar to Buffer.from) -- but I realize it could be confusing.. 🤷‍♂ cc @hugocaillard @lgalabru

@janniks janniks requested a review from hugocaillard April 10, 2023 21:36
@janniks janniks self-assigned this Apr 10, 2023
@vercel
Copy link

vercel bot commented Apr 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stacksjs-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2023 4:00pm

@codecov
Copy link

codecov bot commented Apr 10, 2023

Codecov Report

Merging #1479 (f11b880) into master (0370bf6) will increase coverage by 0.23%.
The diff coverage is 97.72%.

@@            Coverage Diff             @@
##           master    #1479      +/-   ##
==========================================
+ Coverage   65.95%   66.18%   +0.23%     
==========================================
  Files         117      118       +1     
  Lines        8597     8621      +24     
  Branches     1898     1899       +1     
==========================================
+ Hits         5670     5706      +36     
+ Misses       2689     2677      -12     
  Partials      238      238              
Impacted Files Coverage Δ
packages/common/src/utils.ts 41.52% <0.00%> (+0.34%) ⬆️
packages/transactions/src/clarity/deserialize.ts 94.28% <ø> (ø)
packages/transactions/src/clarity/serialize.ts 100.00% <ø> (ø)
...ckages/transactions/src/clarity/types/booleanCV.ts 100.00% <ø> (ø)
...ackages/transactions/src/clarity/types/bufferCV.ts 87.50% <ø> (ø)
packages/transactions/src/clarity/types/intCV.ts 100.00% <ø> (ø)
packages/transactions/src/clarity/types/listCV.ts 100.00% <ø> (ø)
...kages/transactions/src/clarity/types/optionalCV.ts 54.54% <ø> (ø)
...kages/transactions/src/clarity/types/responseCV.ts 100.00% <ø> (ø)
packages/transactions/src/clarity/types/tupleCV.ts 87.50% <ø> (ø)
... and 4 more

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@hugocaillard hugocaillard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just small remarks regarding JSDocs.

I feel like Cl.trueBool and Cl.falseBool could almost be omitted (in favor of bool(true|false)). But I guess it makes sense to have them for completeness.

Co-authored-by: Hugo C <[email protected]>
@janniks
Copy link
Collaborator Author

janniks commented Apr 19, 2023

I sort of agree, I don't like the trueBool method -- leaving out for now, we can always add it again later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Cl bundled export
2 participants