Skip to content

Commit a31b845

Browse files
committed
Merge branch 'master' into improv/remove-mysql-support
2 parents 1b572aa + 899d2fb commit a31b845

File tree

10 files changed

+130
-70
lines changed

10 files changed

+130
-70
lines changed

.github/workflows/lint.yml

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,55 @@ on:
99
- "package-lock.json"
1010

1111
jobs:
12-
# changed-files:
13-
# runs-on: ubuntu-latest
14-
# outputs:
15-
# docsContentHasChanged: ${{ steps.changed-files.outputs.doc_any_changed }}
16-
# steps:
17-
# - uses: actions/checkout@v4
18-
#
19-
# - name: Get changed files
20-
# id: changed-files
21-
# uses: tj-actions/changed-files@v46.0.3
22-
# with:
23-
# files_yaml: |
24-
# doc:
25-
# - '**.mdx'
26-
# - '**.json'
27-
# - docs/**
28-
#
29-
# - name: Print changed files
30-
# run: |
31-
# echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
32-
# echo "Any changed: ${{ steps.changed-files.outputs.any_changed }}"
33-
3412
vale-lint:
35-
# needs: changed-files
36-
# if: needs.changed-files.outputs.docsContentHasChanged == 'true'
3713
runs-on: ubuntu-latest
3814
steps:
15+
- uses: actions/checkout@v4
16+
3917
- name: Install mdx2vast
4018
run: npm install -g mdx2vast
4119

42-
- uses: actions/checkout@v4
20+
- name: Get changed files
21+
id: changed-mdx-files
22+
uses: tj-actions/changed-files@v46.0.3
23+
with:
24+
files: |
25+
**.mdx
26+
docs/**.mdx
4327
44-
- uses: errata-ai/vale-action@v2.1.1
28+
- name: Run vale
29+
uses: errata-ai/vale-action@v2.1.1
30+
if: steps.changed-mdx-files.outputs.any_changed == 'true'
4531
with:
4632
files: docs
33+
34+
# format-code:
35+
# runs-on: ubuntu-latest
36+
# steps:
37+
# - uses: actions/checkout@v4
38+
#
39+
# - uses: oven-sh/setup-bun@v2
40+
#
41+
# - name: Install Dependencies
42+
# run: bun install
43+
#
44+
# - uses: docker/setup-buildx-action@v3
45+
#
46+
# - name: Get changed files
47+
# id: changed-mdx-files
48+
# uses: tj-actions/changed-files@v46.0.3
49+
# with:
50+
# files: |
51+
# **.mdx
52+
# docs/**.mdx
53+
# separator: ","
54+
#
55+
# - name: Print changed files
56+
# if: steps.changed-mdx-files.outputs.any_changed == 'true'
57+
# run: |
58+
# echo ${{ steps.changed-mdx-files.outputs.all_changed_files }}
59+
# echo ${{ steps.changed-mdx-files.outputs.any_changed }}
60+
61+
# - name: Check code snippets for ${{ matrix.language }}
62+
# working-directory: ./scripts/code-type-checking/${{ matrix.language }}
63+
# run: docker build -t code-check-${{ matrix.language }} .

docs/authentication/email-password/disable-signup.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ This can be done in two steps:
2222
- Update the **UI** to get rid of any sign up information
2323
- Change the **Backend SDK** to prevent sign up attempts
2424

25+
2526
## Before you start
2627

2728
This guide assumes that you already have configured your application to use **SuperTokens** for authentication.
2829
If you have not, please check the [Quickstart Guide](/docs/quickstart/introduction).
2930

31+
32+
3033
## Remove the sign up UI
3134

3235
<UIType.Switch/>

docs/deployment/self-host-supertokens.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ You also need to make the database listen on all the IPs of the local machine.
249249
Edit the `postgresql.conf` configuration file and set the value of `listen_addresses` to `0.0.0.0`.
250250
:::
251251

252+
:::caution
253+
It is important to use the `postgresql://` scheme designator in the PostgreSQL Connection URI. Using `postgres://` will lead to a startup error.
254+
:::
255+
252256
```bash
253257

254258
docker run \

docs/quickstart/frontend-setup.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Run the following command in your terminal to install the package.
195195

196196
<FrontendPrebuiltUITabs showMobileTab>
197197
<FrontendPrebuiltUITabs.TabItem value="reactjs">
198-
In order for the **pre-built UI** to be rendered inside your application, will will have to specify which routes will show the authentication components.
198+
In order for the **pre-built UI** to be rendered inside your application, you will have to specify which routes will show the authentication components.
199199
The **React SDK** uses [**React Router**](https://reactrouter.com/en/main) under the hood to achieve this.
200200
Based on whether you already use this package or not in your project, there are two different ways of configuring the routes.
201201

scripts/format-code-blocks.ts

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type CodeBlock = {
4747
console.log(`Writing file`);
4848
await writeCodeBlocks(fullFilePath, codeBlocks);
4949
}
50-
// await stopContainer();
50+
await stopContainer();
5151
} catch (error) {
5252
console.error(error);
5353
}
@@ -59,22 +59,27 @@ async function formatCodeBlock(codeBlocks: CodeBlock[]) {
5959
const snippetLocalPath = "./tmp/code-snippet";
6060
const snippetContainerPath = "/tmp/code-snippet";
6161
for (const codeBlock of codeBlocks) {
62-
const parsedCodeBlockValue = codeBlock.language === "go" ? `package main\n\n${codeBlock.value}` : codeBlock.value;
63-
await write(snippetLocalPath, parsedCodeBlockValue);
64-
execSync(`docker cp ${snippetLocalPath} ${DOCKER_CONTAINER_NAME}:${snippetContainerPath}`);
65-
if (codeBlock.language === "go") {
66-
execSync(`docker exec ${DOCKER_CONTAINER_NAME} gofmt ${snippetContainerPath}`);
67-
} else if (codeBlock.language === "python") {
68-
execSync(`docker exec ${DOCKER_CONTAINER_NAME} black ${snippetContainerPath} > /dev/null`);
69-
} else if (codeBlock.language === "typescript") {
70-
execSync(`docker exec ${DOCKER_CONTAINER_NAME} prettier --parser typescript --write ${snippetContainerPath}`);
71-
}
62+
try {
63+
const parsedCodeBlockValue = codeBlock.language === "go" ? `package main\n\n${codeBlock.value}` : codeBlock.value;
64+
await write(snippetLocalPath, parsedCodeBlockValue);
65+
execSync(`docker cp ${snippetLocalPath} ${DOCKER_CONTAINER_NAME}:${snippetContainerPath}`);
66+
if (codeBlock.language === "go") {
67+
execSync(`docker exec ${DOCKER_CONTAINER_NAME} gofmt ${snippetContainerPath}`);
68+
} else if (codeBlock.language === "python") {
69+
execSync(`docker exec ${DOCKER_CONTAINER_NAME} black ${snippetContainerPath} > /dev/null`);
70+
} else if (codeBlock.language === "typescript") {
71+
execSync(`docker exec ${DOCKER_CONTAINER_NAME} prettier --parser typescript --write ${snippetContainerPath}`);
72+
}
7273

73-
execSync(`docker cp ${DOCKER_CONTAINER_NAME}:${snippetContainerPath} ${snippetLocalPath}`);
74-
let formattedCodeBlock = await file(snippetLocalPath).text();
75-
formattedCodeBlock =
76-
codeBlock.language === "go" ? formattedCodeBlock.replace("package main\n\n", "") : formattedCodeBlock;
77-
codeBlock.value = formattedCodeBlock;
74+
execSync(`docker cp ${DOCKER_CONTAINER_NAME}:${snippetContainerPath} ${snippetLocalPath}`);
75+
let formattedCodeBlock = await file(snippetLocalPath).text();
76+
formattedCodeBlock =
77+
codeBlock.language === "go" ? formattedCodeBlock.replace("package main\n\n", "") : formattedCodeBlock;
78+
codeBlock.value = formattedCodeBlock;
79+
} catch (error) {
80+
console.error(`Error formatting code block in ${codeBlock.filePath} ${codeBlock.language}`);
81+
console.error(error);
82+
}
7883
}
7984
}
8085

src/lib/amplitude.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const initAmplitude = () => {
99
return;
1010
}
1111
const sessionReplayTracking = sessionReplayPlugin({
12-
sampleRate: 1,
12+
sampleRate: 0.3,
1313
});
1414
amplitude.add(sessionReplayTracking);
1515
amplitude.init("b61f581fe0775f56038a6264af879aa9", {

src/plugins/generateLllmsFullTxt.ts

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from "fs";
2+
import type { OpenAPIV3 } from "@scalar/openapi-types";
23
import path from "path";
34
import matter from "gray-matter";
45
import { getAllMdxFiles } from "./utils/getAllMdxFiles";
@@ -153,7 +154,7 @@ function removeReferences(content: string): string {
153154
return lines.join("\n").trim();
154155
}
155156

156-
async function parseMdxContent(filePath: string): Promise<string> {
157+
async function parseMdxContent(filePath: string, usePageTitle = false): Promise<string> {
157158
const mdxContent = await fs.promises.readFile(filePath, "utf8");
158159
const { content } = matter(mdxContent);
159160
const imports: Array<{ name: string; module: string }> = await extractImportStatements(content);
@@ -223,8 +224,8 @@ async function parseMdxContent(filePath: string): Promise<string> {
223224
const { title, content: contentWithoutTitle } = extractMainTitle(processedContent);
224225
const filePathWithoutExtension = filePath.replace(/\.[^/.]+$/, "");
225226
const [, relativePath] = filePathWithoutExtension.split("/docs").filter(Boolean);
226-
const url = `https://supertokens.com/docs/${relativePath}`;
227-
const parsedTitle = buildTitle(title, filePath);
227+
const url = `https://supertokens.com/docs${relativePath}`;
228+
const parsedTitle = usePageTitle ? title : buildTitle(title, filePath);
228229
processedContent = `
229230
# ${parsedTitle}
230231
Source: ${url}
@@ -275,6 +276,28 @@ function buildTitle(currentTitle: string, filePath: string): string {
275276
return `${title} ${currentTitle}`;
276277
}
277278

279+
async function generateApiReferenceText(apiName: "cdi" | "fdi") {
280+
const apiReference = JSON.parse(await fs.promises.readFile(`./static/${apiName}.json`, "utf8")) as OpenAPIV3.Document;
281+
const apiReferenceMapping = JSON.parse(
282+
await fs.promises.readFile(`./static/${apiName}-mapping.json`, "utf8"),
283+
) as OpenAPIV3.Document;
284+
285+
let text = ``;
286+
for (const route in apiReference.paths) {
287+
for (const method in apiReference.paths[route]) {
288+
const operation = apiReference.paths[route][method];
289+
const mapping = apiReferenceMapping[operation.operationId];
290+
if (operation.deprecated) continue;
291+
if (!mapping) continue;
292+
const title = operation.summary || route;
293+
const pathWithoutExtension = mapping.filePath.replace(/\.[^/.]+$/, "");
294+
const url = `https://supertokens.com/docs/references${pathWithoutExtension}`;
295+
text = `${text}\n\n## ${title}\nSource: ${url}\nEndpoint: ${method.toUpperCase()} ${route}`;
296+
}
297+
}
298+
return text;
299+
}
300+
278301
export default function createLLMFullFile(context) {
279302
return {
280303
name: "generate-llms-full-txt",
@@ -314,10 +337,22 @@ export default function createLLMFullFile(context) {
314337
return { files: filesWithoutReferences };
315338
},
316339
postBuild: async ({ content, outDir, routes }) => {
317-
const llmsFullTxt = (await Promise.all(content.files.map((file) => parseMdxContent(file.path)))).join("\n\n");
340+
let llmsFullTxt = (await Promise.all(content.files.map((file) => parseMdxContent(file.path)))).join("\n\n");
341+
342+
const fdiIntro = await parseMdxContent("./docs/references/fdi/introduction.mdx", true);
343+
const cdiIntro = await parseMdxContent("./docs/references/cdi/introduction.mdx", true);
344+
const fdiReferenceFullTxt = await generateApiReferenceText("fdi");
345+
const cdiReferenceFullTxt = await generateApiReferenceText("cdi");
346+
347+
llmsFullTxt = `${llmsFullTxt}
348+
${fdiIntro}
349+
${fdiReferenceFullTxt}
350+
\n\n
351+
${cdiIntro}
352+
${cdiReferenceFullTxt}
353+
`;
318354

319355
fs.writeFileSync(path.join(outDir, "llms-full.txt"), llmsFullTxt);
320356
},
321357
};
322358
}
323-

src/plugins/generateLllmsTxt.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ ${buildContent(content.files.filter((file) => file.path.includes("/platform-conf
157157
${buildContent(content.files.filter((file) => file.path.includes("/references")))}
158158
159159
160-
161160
`;
162161

163162
fs.writeFileSync(path.join(outDir, "llms.txt"), llmsTxt);

src/theme/Root.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@ export default function Root({ children }: { children: React.ReactNode }) {
1515
}, []);
1616

1717
useEffect(() => {
18-
if (localStorage.getItem("analytics-consent") === "true") {
19-
trackPageView();
20-
}
18+
trackPageView();
2119
}, [pathname]);
2220

2321
useEffect(() => {
2422
const controller = new AbortController();
2523
const handleBeforeUnload = () => {
26-
if (localStorage.getItem("analytics-consent") === "true") {
27-
trackPageExit("app-close");
28-
}
24+
trackPageExit("app-close");
2925
};
3026
window.addEventListener("beforeunload", handleBeforeUnload, { signal: controller.signal });
3127
return () => controller.abort();
@@ -34,9 +30,7 @@ export default function Root({ children }: { children: React.ReactNode }) {
3430
useEffect(() => {
3531
const controller = new AbortController();
3632
const handleVisibilityChange = () => {
37-
if (localStorage.getItem("analytics-consent") === "true") {
38-
trackPageExit("visibility-change", document.visibilityState);
39-
}
33+
trackPageExit("visibility-change", document.visibilityState);
4034
};
4135
document.addEventListener("visibilitychange", handleVisibilityChange, { signal: controller.signal });
4236
return () => controller.abort();
@@ -79,19 +73,21 @@ function AnalyticsConsentBanner() {
7973
initial: "16px",
8074
sm: "auto",
8175
}}
82-
width={{ initial: "auto", sm: "500px" }}
83-
style={{ boxShadow: "var(--shadow-4)" }}
76+
width={{ initial: "auto", sm: "370px" }}
77+
style={{
78+
boxShadow: "var(--shadow-4)",
79+
// @ts-ignore
80+
"--card-background-color": "var(--gray-2)",
81+
}}
8482
asChild
8583
>
86-
<Card size="2">
84+
<Card size="2" variant="classic">
8785
<Flex direction="column">
8886
<Text as="p" size="3">
89-
We use cookies and similar technologies to help personalize content, analyze site usage, and provide a
90-
better experience. By clicking "Accept" you consent to our use of cookies. Visit our{" "}
87+
This website uses cookies to improve your experience. Please click decline to disable tracking cookies{" "}
9188
<a href="https://supertokens.com/legal/privacy-policy" target="_blank">
9289
Privacy Policy
93-
</a>{" "}
94-
for more information.
90+
</a>
9591
</Text>
9692
<Flex gap="3" justify="end">
9793
<Button variant="soft" onClick={onDecline}>

static/fdi-mapping.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"passwordlessEmailExistsDepr": {
102102
"frontmatter": {
103103
"sidebar_position": 3,
104-
"sidebar_label": "get Check email exists (deprecated) (deprecated)",
104+
"sidebar_label": "get Check email exists (deprecated)",
105105
"title": "Check email exists (deprecated)",
106106
"description": "Check if an email exists\nNote that there is an invisible character at the end of the path, this was to avoid a conflict with the OpenAPI spec.\n"
107107
},
@@ -123,7 +123,7 @@
123123
"passwordlessPhoneNumberExistsDepr": {
124124
"frontmatter": {
125125
"sidebar_position": 4,
126-
"sidebar_label": "get Check phone exists (deprecated) (deprecated)",
126+
"sidebar_label": "get Check phone exists (deprecated)",
127127
"title": "Check phone exists (deprecated)",
128128
"description": "Check if a phone number exists\n"
129129
},
@@ -189,7 +189,7 @@
189189
"emailExistsDepr": {
190190
"frontmatter": {
191191
"sidebar_position": 2,
192-
"sidebar_label": "get Check email exists (deprecated) (deprecated)",
192+
"sidebar_label": "get Check email exists (deprecated)",
193193
"title": "Check email exists (deprecated)",
194194
"description": "Check if an email exists\n"
195195
},
@@ -538,4 +538,5 @@
538538
"method": "get",
539539
"filePath": "/fdi/webauthn/get-webauthn-email-exists.mdx"
540540
}
541-
}
541+
}
542+

0 commit comments

Comments
 (0)