-
Notifications
You must be signed in to change notification settings - Fork 3
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
Type generating CLI #301
Draft
roncohen
wants to merge
79
commits into
main
Choose a base branch
from
typesafety-cli
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Type generating CLI #301
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ample (#289) Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/ai/nanoid/blob/main/CHANGELOG.md">nanoid's changelog</a>.</em></p> <blockquote> <h2>3.3.8</h2> <ul> <li>Fixed a way to break Nano ID by passing non-integer size (by <a href="https://github.com/myndzi"><code>@myndzi</code></a>).</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/ai/nanoid/commit/3044cd5e73f4cf31795f61f6e6b961c8c0a5c744"><code>3044cd5</code></a> Release 3.3.8 version</li> <li><a href="https://github.com/ai/nanoid/commit/4fe34959c34e5b3573889ed4f24fe91d1d3e7231"><code>4fe3495</code></a> Update size limit</li> <li><a href="https://github.com/ai/nanoid/commit/d643045f40d6dc8afa000a644d857da1436ed08c"><code>d643045</code></a> Fix pool pollution, infinite loop (<a href="https://redirect.github.com/ai/nanoid/issues/510">#510</a>)</li> <li>See full diff in <a href="https://github.com/ai/nanoid/compare/3.3.7...3.3.8">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=nanoid&package-manager=npm_and_yarn&previous-version=3.3.7&new-version=3.3.8)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/bucketco/bucket-javascript-sdk/network/alerts). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This is a piece of infrastructure needed for local overrides. We will likely need a few adjustments to this as we go about building the toolbar on top, but this is a good base.
…config` option. (#285) This PR introduces the `config`, which is an user-supplied JSON value that matches a given feature context (similar to targeting). The resolved configuration variant is then passed down to the client SDKs for use.
This PR adds support for remote configuration to the node-sdk.
roncohen
force-pushed
the
typesafety-cli
branch
from
January 30, 2025 12:42
14dcc78
to
6c9e08b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a two part PR with a CLI that generates a package
_bucket
and updates the browser/react SDK to optionally make use of the_bucket
package.It's a lot of added complexity, so any suggestions on simplifying would be greatly appreciated.
CLI
This introduces a new minimalistic CLI package which can:
bucket init
: writes an almost emptybucket.config.json
filebucket features add
: add a new feature tobucket.config.json
and callfeatures generate
bucket features generate
: write the_bucket
package out based off ofbucket.config.json
.thanks to @Swiftwork for laying the ground work for the CLI!
Browser/React SDK
The goal here has been to keep the option to use both libraries without the generated
_bucket
package and CLI. There's no way to dotry { import ... from "_bucket" } catch {}
because there's no runtime importing going on. At compile-time there's a bundler that runs and resolves all the imported packages. If you import a package that imports from "_bucket" and that module doesn't exist, you'll get an error.So, this introduces two sets of files, for each of the Browser and React SDKs:
_bucket
. This set imports from the_bucket
package and exposes a bunch the same classes/types but with the type arguments filled in.Example:
@bucketco/browser-sdk
and@bucketco/browser-sdk/configuredClient
.@bucketco/browser-sdk
exposes the generic version of the BucketClient:BucketClient<FeatureDefs>
and doesn't use the_bucket
package, while@bucketco/browser-sdk/configuredClient
exposes aBucketClientConfigured
which already has the types from the generated_bucket
package inserted along with the list of features (the types get removed at compile time, but since we want the toolbar to show the list of features locally, we also need to include an actual list as opposed to just the types).Similarly, in the ReactSDK we go on the assumption that people will be using the CLI workflow to generate types and this importing
@bucketco/react-sdk
will give you a BucketProvider which already has the types and the feature list loaded in from_bucket
. It imports@bucketco/browser-sdk/configuredClient
which does the hard work. You can still import@bucketco/react/baseBucketProvider
to get a vanilla BucketProvider without the types/features loaded in.Why
_bucket
I started out with
.bucket
but unfortunately rollup refuses to resolve it. It works for Prisma because they rely on Node.js package resolving while we have to deal with bundlers. Other options could be@bucketco/_generated
@bucketco/_generated-config
or similarUMD build
Unfortunately, vite doesn't support building a UMD when there are multiple entrypoints. We have multiple entrypoints to allow folks to use the libraries without the generated
_bucket
package. We can probably work around it if we think it's important.