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

fix: Allow generating SDKs locally without Fern token #2551

Closed
wants to merge 4 commits into from

Conversation

NathanFlurry
Copy link

Using Fern in an open source repo can be tricky since outside contributors currently need to have their own Fern token.

The fern generate --local does not require a Fern token to function. This PR disables prompting the user to sign in when using the local Docker generation.

NathanFlurry added a commit to rivet-gg/rivet that referenced this pull request Jan 6, 2024
Simplifies using Fern for open source contributors by generating repos to local `sdks` folder.

Simplifies the fern script for `./scripts/fern/gen.rs`.

Related PR: fern-api/fern#2551
@zdunecki
Copy link

Hi,

Any update on this? I see it's one of the factors that may help to run fern locally without any token/login required.

Best

@@ -59,6 +59,9 @@ export async function generateWorkspace({
context
});
} else {
if (!token) {
return context.failAndThrow("Must provide token if 'useLocalDocker' is false");
Copy link
Member

Choose a reason for hiding this comment

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

useLocalDocker is not a flag the user knows about -- they only know about --local

Copy link
Member

Choose a reason for hiding this comment

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

how about Please run fern login.

@@ -25,7 +25,7 @@ export async function generateWorkspace({
version: string | undefined;
groupName: string | undefined;
shouldLogS3Url: boolean;
token: FernToken;
token?: FernToken;
Copy link
Member

Choose a reason for hiding this comment

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

can we type this as FernToken | undefined, so that consumers are forced to provide a value

@@ -59,6 +59,9 @@ export async function generateWorkspace({
context
});
} else {
if (!token) {
return context.failAndThrow("Must provide token if 'useLocalDocker' is false");

Choose a reason for hiding this comment

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

@dsinghvi what are your thoughts on this?

Suggested change
return context.failAndThrow("Must provide token if 'useLocalDocker' is false");
return context.failAndThrow("Please run fern login. No token was found, and `--local` is not enabled.");

Choose a reason for hiding this comment

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

Not sure if "no token was found" or "no token was provided" makes more sense here.

@@ -25,7 +25,7 @@ export async function generateWorkspace({
version: string | undefined;
groupName: string | undefined;
shouldLogS3Url: boolean;
token: FernToken;
token?: FernToken;

Choose a reason for hiding this comment

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

Suggested change
token?: FernToken;
token: FernToken | undefined;

@Amenocy
Copy link

Amenocy commented Jun 6, 2024

is there any update regarding this pr?! it would be useful to merge it :)

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

Successfully merging this pull request may close these issues.

6 participants