-
Notifications
You must be signed in to change notification settings - Fork 8
feat(generateId): encode a UUID as base58 for the generateId method #20
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
Conversation
@nikgraf I see it broke ci/cd (and makes sense with my changes). So if you agree to the approach, I will get ci/cd working. |
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.
Only if we think moving to this build pattern is a good call; otherwise, will revert
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.
no objection
usually I keep them in parallel so it's easier to see what fails and also to parallelize things, but currently everything fast enough to do this
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.
Yeah had same thought. Parallelizing has the advantage of being able to rerun specific jobs, etc. But felt like we were constantly reinstalling deps, etc. and this let me run build beforehand.
const uuid = uuidv4(); | ||
const stripped = uuid.replaceAll(/-/g, ""); | ||
const encoded = encodeBase58(stripped); | ||
return encoded.padStart(22, "1"); |
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.
hmm, do we need it? If the string is shorter we don't need to extend it afaik
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.
Good point. Will remove
very nice PR @cmwhited
feel free to merge once CI/CD is fixed |
Description
Implement the
generateId
function, that can run in any JS env(Browser, NodeJS server, ReactNative), to:Also:
decodeBase58ToUUID
method that takes the base58 encoded UUID and expands it back to its original UUIDNotes
@nikgraf I added some package management with vite to:
tsconfig.build.json
that excludes any.spec.ts
or.test.ts
filesThis may be overkill, so let me know if you think we shouldn't/don't need to go down this path.
resolves #10