-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor code base and build pipeline #12
Conversation
Codecov ReportBase: 96.63% // Head: 92.10% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #12 +/- ##
==========================================
- Coverage 96.63% 92.10% -4.54%
==========================================
Files 11 5 -6
Lines 238 114 -124
Branches 40 19 -21
==========================================
- Hits 230 105 -125
- Misses 8 9 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Coverage report is sad, but I'm not sure if winning the coverage award helps here .. all the other methods are barely wrappers around |
Yeh, I don't think this is necessarily the place to fight the coverage wars 😉 I can do a review of this PR tomorrow 👍 I'm looking forward to it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks really great, I like how the api is now exposing some of the lower-level functionality while still keeping the high level Session
as the main interface.
The build pipeline is wild, fantastic to support so many targets and have a well considered flow for that.
My only comments were about clarification in doc strings I think.
Many things have changed since shirokuma got touched last: The
p2panda-js
API matured and our ideas around p2panda as well. Before we release the first version of shirokuma we want to bring it up to date with everything. This mostly concerns the "inners" of shirokuma, the actual, public API didn't change.This PR covers the following refactors:
this.#keyPair
🤯${publicKey}/${viewId}
, which means that it will just make an entry in the cache after every next entry request but never hit afterwards as the view id changes constantly. To bring back caching we need to extend the API with something which allows us to handle document instances, this can be handled in future PRs: Cache next entry arguments #13Session
instance when creating, updating, deleting documents: Return hash of published entry fromcreate()
,update()
anddelete()
methods onsession
#5p2panda-js
p2panda-js
offers a "slim" and "inlined" version, where the latter has the WebAssembly code inlined. We want to also make use of these options in shirokuma. To enable this the rollup build pipeline has been improvedThoughts on the build pipeline:
Currently we do not bundle external dependencies in our CommonJS, ESM and NodeJS builds. Only the UMD builds contain the whole thing. I couldn't find any "best practices" yet on how to do this but hopefully with a modern JS environment these decisions make sense: Webpack, Rollup etc. handles this automatically for us and if we want to go fancy ESM in the browser via
<script type="module">
we load the external dependencies manually before (will write something about it in the README.md). The UMD build should cover the needs of developers who "don't care" and simply just pull something in to play with.Todo
p2panda-js
versionFollow ups
shirokuma
on npm #6shirokuma
docs #15Closes #8, #9, #5
📋 Checklist
CHANGELOG.md