Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
tmilewski authored Oct 28, 2024
2 parents 4134a8b + 1b78bb3 commit fb894ae
Show file tree
Hide file tree
Showing 300 changed files with 10,964 additions and 7,189 deletions.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions .changeset/friendly-nails-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/localizations": patch
---

pl-PL localization updates
5 changes: 5 additions & 0 deletions .changeset/real-boats-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/upgrade": minor
---

Enhancing error handling throughout the SDK upgrade flow
5 changes: 0 additions & 5 deletions .changeset/shiny-files-smash.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/twelve-frogs-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/express": patch
---

Expose `AuthObject` type helper
5 changes: 0 additions & 5 deletions .changeset/twenty-kids-speak.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/unlucky-crabs-hunt.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
run: |
if [ "${{ matrix.node-version }}" == "18" ]; then
echo "Running tests on Node 18 only for packages with LTS support."
npx turbo test $TURBO_ARGS --filter="@clerk/astro" --filter="@clerk/backend" --filter="@clerk/express" --filter="@clerk/nextjs" --filter="@clerk/clerk-react" --filter="@clerk/fastify" --filter="@clerk/clerk-sdk-node" --filter="@clerk/shared" --filter="@clerk/remix" --filter="@clerk/tanstack-start" --filter="@clerk/elements"
npx turbo test $TURBO_ARGS --filter="@clerk/astro" --filter="@clerk/backend" --filter="@clerk/express" --filter="@clerk/nextjs" --filter="@clerk/clerk-react" --filter="@clerk/clerk-sdk-node" --filter="@clerk/shared" --filter="@clerk/remix" --filter="@clerk/tanstack-start" --filter="@clerk/elements"
else
echo "Running tests for all packages on Node 20."
npx turbo test $TURBO_ARGS
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/major-version-check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Major Version Check

on:
workflow_dispatch:
pull_request:
types: [opened, edited, synchronize]
issue_comment:
Expand All @@ -20,7 +21,7 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const prNumber = context.payload?.pull_request?.number || context.payload?.issue?.number;
// Get list of files changed in the PR
const { data: files } = await github.rest.pulls.listFiles({
Expand All @@ -29,6 +30,18 @@ jobs:
pull_number: prNumber,
});
let pullRequest = context.payload.pull_request;
if (!pullRequest) {
// Fetch the pull request data
const pullRequestData = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
pullRequest = pullRequestData.data;
}
// Check if any changeset files indicate a major bump
let hasMajorChangeset = false;
for (const file of files) {
Expand All @@ -38,7 +51,7 @@ jobs:
owner: context.repo.owner,
repo: context.repo.repo,
path: file.filename,
ref: context.payload.pull_request.head.sha,
ref: pullRequest.head.sha,
});
const content = Buffer.from(changesetContent.content, changesetContent.encoding).toString();
Expand All @@ -58,7 +71,7 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const prNumber = context.payload?.pull_request?.number || context.payload?.issue?.number;
const org = context.repo.owner;
// Get all comments on the PR
Expand Down
8 changes: 4 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"printWidth": 120,
"singleAttributePerLine": true,
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxSingleQuote": true,
"plugins": ["prettier-plugin-packagejson", "prettier-plugin-tailwindcss"],
"printWidth": 120,
"semi": true,
"singleAttributePerLine": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"plugins": ["prettier-plugin-tailwindcss"]
"trailingComma": "all"
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ Would you like to work on Open Source software and help maintain this repository
This repository contains the SDKs for environment/platforms that Clerk supports. For example, if you want to use Clerk with Node.js you can install:

```sh
npm install @clerk/clerk-sdk-node
npm install @clerk/backend
# or
yarn add @clerk/clerk-sdk-node
yarn add @clerk/backend
# or
pnpm add @clerk/clerk-sdk-node
pnpm add @clerk/backend
```

## 🎓 Learning Clerk
Expand Down
10 changes: 5 additions & 5 deletions integration/templates/astro-hybrid/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "astro-clerk-hybrid-playground",
"type": "module",
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "astro dev",
"start": "astro dev --port $PORT",
"astro": "astro",
"build": "astro check && astro build",
"dev": "astro dev",
"preview": "astro preview --port $PORT",
"astro": "astro"
"start": "astro dev --port $PORT"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/react": "^3.6.2",
"@astrojs/node": "^8.3.4",
"@astrojs/react": "^3.6.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"astro": "^4.15.11",
Expand Down
10 changes: 5 additions & 5 deletions integration/templates/astro-node/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "astro-clerk-playground",
"type": "module",
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "astro dev",
"start": "astro dev --port $PORT",
"astro": "astro",
"build": "astro check && astro build",
"dev": "astro dev",
"preview": "astro preview --port $PORT",
"astro": "astro"
"start": "astro dev --port $PORT"
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@astrojs/node": "^8.3.4",
"@astrojs/react": "^3.6.2",
"@astrojs/tailwind": "^5.1.1",
"@astrojs/node": "^8.3.4",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"astro": "^4.15.11",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
import { ViewTransitions } from 'astro:transitions';
interface Props {
title: string;
}
const { title } = Astro.props;
---

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="description" content="Astro description" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
<ViewTransitions />
</head>
<body>
<main>
<slot />
</main>
</body>
</html>
15 changes: 15 additions & 0 deletions integration/templates/astro-node/src/pages/transitions/index.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
import { SignedIn, SignedOut, UserButton } from "@clerk/astro/components";
import Layout from "../../layouts/ViewTransitionsLayout.astro";
---

<Layout title="Sign in">
<div class="w-full flex justify-center">
<SignedOut>
<a href="/transitions/sign-in">Sign in</a>
</SignedOut>
<SignedIn>
<UserButton />
</SignedIn>
</div>
</Layout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
import { SignIn } from "@clerk/astro/components";
import Layout from "../../layouts/ViewTransitionsLayout.astro";
---

<Layout title="Sign in">
<div class="w-full flex justify-center">
<SignIn forceRedirectUrl="/transitions" />
</div>
</Layout>
16 changes: 8 additions & 8 deletions integration/templates/expo-web/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "expo-web",
"main": "expo-router/entry",
"version": "1.0.0",
"private": true,
"main": "expo-router/entry",
"scripts": {
"dev": "RCT_METRO_PORT=$PORT expo start --web --port $PORT",
"build": "expo export -p web",
"start": "npx serve dist --single",
"lint": "expo lint"
"dev": "RCT_METRO_PORT=$PORT expo start --web --port $PORT",
"lint": "expo lint",
"start": "npx serve dist --single"
},
"jest": {
"preset": "jest-expo"
Expand All @@ -30,8 +31,8 @@
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.9",
"react-native-screens": "~3.31.1",
"react-native-web": "~0.19.6",
"react-native-url-polyfill": "^2.0.0"
"react-native-url-polyfill": "^2.0.0",
"react-native-web": "~0.19.6"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand All @@ -42,6 +43,5 @@
"jest-expo": "~51.0.3",
"react-test-renderer": "18.2.0",
"typescript": "~5.6.2"
},
"private": true
}
}
4 changes: 2 additions & 2 deletions integration/templates/next-app-router/src/app/api/me/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { auth } from '@clerk/nextjs/server';

export function GET() {
const { userId } = auth();
export async function GET() {
const { userId } = await auth();
return new Response(JSON.stringify({ userId }));
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { auth } from '@clerk/nextjs/server';

export function GET() {
const { userId } = auth().protect(has => has({ role: 'admin' }) || has({ role: 'org:editor' }));
export async function GET() {
const { userId } = await auth.protect((has: any) => has({ role: 'admin' }) || has({ role: 'org:editor' }));
return new Response(JSON.stringify({ userId }));
}
6 changes: 4 additions & 2 deletions integration/templates/next-app-router/src/app/csp/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { headers } from 'next/headers';
import { ClerkLoaded } from '@clerk/nextjs';

export default function CSPPage() {
export default async function CSPPage() {
const cspHeader = await headers().get('Content-Security-Policy');

return (
<div>
CSP: <pre>{headers().get('Content-Security-Policy')}</pre>
CSP: <pre>{cspHeader}</pre>
<ClerkLoaded>
<p>clerk loaded</p>
</ClerkLoaded>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function Page() {
return <div>User is admin</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { auth } from '@clerk/nextjs/server';

export default async function Home({ params }: { params: { id: string } }) {
const { orgId } = await auth();

if (params.id != orgId) {
console.log('Mismatch - returning nothing for now...', params.id, orgId);
}

console.log("I'm the server and I got this id: ", orgId);

return (
<>
<p>Org-specific home</p>
<p>From auth(), I know your org id is: {orgId}</p>
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { auth } from '@clerk/nextjs/server';

export default async function Home({ params }: { params: { id: string } }) {
const { orgId } = await auth();

if (params.id != orgId) {
console.log('Mismatch - returning nothing for now...', params.id, orgId);
}

console.log("I'm the server and I got this id: ", orgId);

return (
<>
<p>Org-specific settings</p>
<p>From auth(), I know your org id is: {orgId}</p>
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { auth } from '@clerk/nextjs/server';

export default async function Home({ params }: { params: { slug: string } }) {
const { orgSlug } = await auth();

if (params.slug != orgSlug) {
console.log('Mismatch - returning nothing for now...', params.slug, orgSlug);
}

console.log("I'm the server and I got this slug: ", orgSlug);

return (
<>
<p>Org-specific home</p>
<p>From auth(), I know your org slug is: {orgSlug}</p>
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { auth } from '@clerk/nextjs/server';

export default async function Home({ params }: { params: { slug: string } }) {
const { orgSlug } = await auth();

if (params.slug != orgSlug) {
console.log('Mismatch - returning nothing for now...', params.slug, orgSlug);
}

console.log("I'm the server and I got this slug: ", orgSlug);

return (
<>
<p>Org-specific settings</p>
<p>From auth(), I know your org slug is: {orgSlug}</p>
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { auth } from '@clerk/nextjs/server';

export default function Page() {
auth().protect();
export default async function Page() {
await auth.protect();

return <div>Protected Page</div>;
}
Loading

0 comments on commit fb894ae

Please sign in to comment.