Repository navigation
Make clerk link claim the app a signed-out clerk init created
#600
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
Open
shane-kercheval
wants to merge
15
commits into
main
Choose a base branch
from
shane/grow-1285-link-claim-and-advice
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.
+2,318
−187
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f13147d
Name the app an unlinked folder runs on
shane-kercheval 5562f28
Stop autoclaim when keys are another app's
shane-kercheval 5db9708
Claim the clerk init app in clerk link
shane-kercheval b46c606
docs(changeset): add link claim changeset
shane-kercheval 13a0889
Check SDK claim links before advising open
shane-kercheval 876495d
Handle each way a link claim can end
shane-kercheval abf9a8b
Word link claim failures by cause
shane-kercheval 0993268
Match login's claim failure advice to link
shane-kercheval 359daf3
Hedge the clerk init folder deploy message
shane-kercheval f537ff4
Check every dev env file before a claim links
shane-kercheval 837f811
Tighten claim failure advice and key reading
shane-kercheval e4a750e
Pass the SDK claim link to open as its href
shane-kercheval 7ad96cb
Guard instance-less claims and fix mismatch steps
shane-kercheval ae38e8f
Correct claim docs and the key_pair_mismatch note
shane-kercheval 0468dc1
Clarify signed-out relink wording in auth README
shane-kercheval File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "clerk": minor | ||
| --- | ||
|
|
||
| Make `clerk link` claim the application a signed-out `clerk init` created and link the folder to it, and make `clerk deploy` and `clerk deploy status` say how to link a folder that runs on an unclaimed application. If the claim fails with an error that keeps the claim token, or the workspace is managed by an integration, `clerk link` now stops with the error and says whether to rerun it or link another app with `--app`, instead of offering apps that can't include the claimed one. If the folder's publishable key belongs to a different application, `clerk link` and `clerk auth login` claim the application but leave the folder unlinked and its env files unchanged, and say which file holds the other key. | ||
|
|
||
| - `clerk auth login`'s claim-failure messages now say why the claim failed and what to do, and `clerk init`, `clerk migrate` and `clerk doctor` print them too when they sign you in. |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { afterEach, describe, expect, mock, test } from "bun:test"; | ||
| import { Command } from "@commander-js/extra-typings"; | ||
| import "../../lib/help.ts"; | ||
|
|
||
| const mockLogin = mock(); | ||
| mock.module("./login.ts", () => ({ | ||
| login: (...args: unknown[]) => mockLogin(...args), | ||
| })); | ||
| mock.module("./logout.ts", () => ({ logout: async () => {} })); | ||
| mock.module("../../lib/banner.ts", () => ({ printBanner: () => {} })); | ||
|
|
||
| const { registerAuth } = await import("./index.ts"); | ||
|
|
||
| describe("registerAuth", () => { | ||
| afterEach(() => { | ||
| mockLogin.mockReset(); | ||
| }); | ||
|
|
||
| // Only these commands check the folder's keys after a claim; `clerk init`, `clerk migrate` | ||
| // and `clerk doctor` call `login()` without the option. | ||
| test.each([[["auth", "login"]], [["login"]]])( | ||
| "`clerk %p` signs in with the claim key check on", | ||
| async (args) => { | ||
| const program = new Command(); | ||
| registerAuth(program as never); | ||
|
|
||
| await program.parseAsync(args, { from: "user" }); | ||
|
|
||
| expect(mockLogin).toHaveBeenCalledWith(expect.objectContaining({ checkClaimKeys: true })); | ||
| }, | ||
| ); | ||
| }); |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.