Skip to content

Commit

Permalink
Merge branch 'main' into izaak/ORGS-132-middleware-orgsync
Browse files Browse the repository at this point in the history
  • Loading branch information
izaaklauer committed Oct 7, 2024
2 parents 3aa3f67 + 60934ad commit bc89068
Show file tree
Hide file tree
Showing 147 changed files with 10,544 additions and 3,002 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-files-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/localizations": patch
---

Update `de-DE` translation to be GDPR-compliant
2 changes: 2 additions & 0 deletions .changeset/stupid-cherries-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
5 changes: 0 additions & 5 deletions .changeset/tricky-bikes-move.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/twenty-kids-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/clerk-js": patch
---

Updates webpack to address CVE-2024-43788.
5 changes: 5 additions & 0 deletions .changeset/unlucky-crabs-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/localizations": minor
---

Add be-BY translation
2 changes: 2 additions & 0 deletions .changeset/young-llamas-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 1 addition & 1 deletion .github/actions/init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ runs:
registry-url: ${{ inputs.registry-url }}

- name: Install NPM Dependencies
run: npm ci --audit=false --fund=false
run: npm ci --audit=false --fund=false --engine-strict=false
shell: bash

- name: Get Playwright Version
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
turbo-summarize: ${{ env.TURBO_SUMMARIZE }}
turbo-team: ${{ vars.TURBO_TEAM }}
turbo-token: ${{ secrets.TURBO_TOKEN }}
node-version: 20

- name: Require Changeset
if: ${{ !(github.event_name == 'merge_group') }}
Expand Down Expand Up @@ -65,11 +66,7 @@ jobs:
run: npx turbo lint:publint $TURBO_ARGS --only

- name: Lint types using attw
run: npx turbo lint:attw $TURBO_ARGS --filter=!@clerk/nextjs --filter=!@clerk/tanstack-start --filter=!@clerk/elements --filter=!@clerk/backend --filter=!@clerk/astro --only

- name: Lint types using attw [Errors Allowed]
run: npx turbo lint:attw $TURBO_ARGS --filter=@clerk/nextjs --filter=@clerk/tanstack-start --filter=@clerk/backend --filter=@clerk/elements --filter=@clerk/astro --continue --only
continue-on-error: true # TODO: Remove this when all related errors are fixed
run: npx turbo lint:attw $TURBO_ARGS --only

- name: Run lint
run: npx turbo lint $TURBO_ARGS --only -- --quiet
Expand Down
100 changes: 100 additions & 0 deletions .github/workflows/major-version-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Major Version Check

on:
pull_request:
types: [opened, edited, synchronize]
issue_comment:
types: [created, edited]

permissions:
contents: read
issues: read
pull-requests: read

jobs:
check-major-bump:
runs-on: ubuntu-latest
steps:
- name: Check for major changesets
id: check_major
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
// Get list of files changed in the PR
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
// Check if any changeset files indicate a major bump
let hasMajorChangeset = false;
for (const file of files) {
if (file.filename.startsWith('.changeset/') && file.status !== 'removed') {
// Fetch the contents of the changeset file
const { data: changesetContent } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: file.filename,
ref: context.payload.pull_request.head.sha,
});
const content = Buffer.from(changesetContent.content, changesetContent.encoding).toString();
if (/major/.test(content)) {
hasMajorChangeset = true;
break;
}
}
}
core.setOutput('has_major_changeset', hasMajorChangeset);
- name: Check if major version bump is allowed
if: steps.check_major.outputs.has_major_changeset == 'true'
id: check_approval
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const org = context.repo.owner;
// Get all comments on the PR
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
let approvalFound = false;
for (const comment of comments) {
if (comment.body.trim().toLowerCase() === '!allow-major') {
const username = comment.user.login;
// Check if the user is a public member of the organization
try {
const { status } = await github.rest.orgs.checkMembershipForUser({
org,
username,
});
if (status === 204) {
approvalFound = true;
break;
}
} catch (error) {
if (error.status !== 204) {
// User is not a public member
continue;
}
}
}
}
if (!approvalFound) {
core.setFailed('Major version bump requires approval from an organization member by commenting "!allow-major" on the PR.');
} else {
console.log('Major version bump approved by an organization member.');
}
2 changes: 2 additions & 0 deletions docs/PUBLISH.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ _Note: Only Clerk employees can trigger the actions described below._

We are using [changesets](https://github.com/changesets/changesets), so our CICD is using [`changesets/action`](https://github.com/changesets/action) to automate the release process when releasing stable package versions targeting the `@latest` tag.

**Important:** In order to merge PRs that include changesets with **major** version bumps, you need to comment `!allow-major` in the PR. This is to ensure that major version bumps are intentional and not accidental. **Note:** Ensure that your Clerk organization membership status is set to "Public". To set your status to "Public", follow [these steps](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-membership-in-organizations/publicizing-or-hiding-organization-membership).

Every time a PR is merged into `main`, the changesets action parses all changesets found in `.changeset` and updates the "ci(repo): Version packages" PR with the new package versions and the changelog for the next stable release.

To release a new stable version of all Clerk packages, find the "ci(repo): Version packages" PR, verify the changes, and merge it.
Expand Down
13 changes: 10 additions & 3 deletions integration/presets/envs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const withEmailCodes = base
.setEnvVariable('public', 'CLERK_PUBLISHABLE_KEY', instanceKeys.get('with-email-codes').pk)
.setEnvVariable('private', 'CLERK_ENCRYPTION_KEY', constants.E2E_CLERK_ENCRYPTION_KEY || 'a-key');

const withEmailCodes_persist_client = withEmailCodes
const withEmailCodes_destroy_client = withEmailCodes
.clone()
.setEnvVariable('public', 'EXPERIMENTAL_PERSIST_CLIENT', 'true');
.setEnvVariable('public', 'EXPERIMENTAL_PERSIST_CLIENT', 'false');

const withEmailLinks = base
.clone()
Expand Down Expand Up @@ -88,10 +88,16 @@ const withDynamicKeys = withEmailCodes
.setEnvVariable('private', 'CLERK_SECRET_KEY', '')
.setEnvVariable('private', 'CLERK_DYNAMIC_SECRET_KEY', instanceKeys.get('with-email-codes').sk);

const withRestrictedMode = withEmailCodes
.clone()
.setId('withRestrictedMode')
.setEnvVariable('private', 'CLERK_SECRET_KEY', instanceKeys.get('with-restricted-mode').sk)
.setEnvVariable('public', 'CLERK_PUBLISHABLE_KEY', instanceKeys.get('with-restricted-mode').pk);

export const envs = {
base,
withEmailCodes,
withEmailCodes_persist_client,
withEmailCodes_destroy_client,
withEmailLinks,
withCustomRoles,
withEmailCodesQuickstart,
Expand All @@ -100,4 +106,5 @@ export const envs = {
withAPCore2ClerkLatest,
withAPCore2ClerkV4,
withDynamicKeys,
withRestrictedMode,
} as const;
4 changes: 2 additions & 2 deletions integration/presets/longRunningApps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export const createLongRunningApps = () => {
const configs = [
{ id: 'express.vite.withEmailCodes', config: express.vite, env: envs.withEmailCodes },
{ id: 'react.vite.withEmailCodes', config: react.vite, env: envs.withEmailCodes },
{ id: 'react.vite.withEmailCodes_persist_client', config: react.vite, env: envs.withEmailCodes_persist_client },
{ id: 'react.vite.withEmailCodes_persist_client', config: react.vite, env: envs.withEmailCodes_destroy_client },
{ id: 'react.vite.withEmailLinks', config: react.vite, env: envs.withEmailLinks },
{ id: 'remix.node.withEmailCodes', config: remix.remixNode, env: envs.withEmailCodes },
{ id: 'next.appRouter.withEmailCodes', config: next.appRouter, env: envs.withEmailCodes },
{
id: 'next.appRouter.withEmailCodes_persist_client',
config: next.appRouter,
env: envs.withEmailCodes_persist_client,
env: envs.withEmailCodes_destroy_client,
},
{ id: 'next.appRouter.withCustomRoles', config: next.appRouter, env: envs.withCustomRoles },
{ id: 'quickstart.next.appRouter', config: next.appRouterQuickstart, env: envs.withEmailCodesQuickstart },
Expand Down
10 changes: 5 additions & 5 deletions integration/templates/astro-hybrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/react": "^3.6.0",
"@astrojs/node": "^8.3.2",
"@astrojs/check": "^0.9.4",
"@astrojs/react": "^3.6.2",
"@astrojs/node": "^8.3.4",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"astro": "^4.11.5",
"astro": "^4.15.11",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.6.2"
}
}
12 changes: 6 additions & 6 deletions integration/templates/astro-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/react": "^3.6.0",
"@astrojs/tailwind": "^5.1.0",
"@astrojs/node": "^8.3.2",
"@astrojs/check": "^0.9.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.11.5",
"astro": "^4.15.11",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.3"
"typescript": "^5.6.2"
}
}
8 changes: 4 additions & 4 deletions integration/templates/elements-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"@types/node": "^18.19.33",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"next": "^14.2.3",
"next": "^14.2.13",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.4.5"
"typescript": "^5.6.2"
},
"devDependencies": {
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.3"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion integration/templates/expo-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"jest": "^29.2.1",
"jest-expo": "~51.0.3",
"react-test-renderer": "18.2.0",
"typescript": "~5.3.3"
"typescript": "~5.6.2"
},
"private": true
}
4 changes: 2 additions & 2 deletions integration/templates/express-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"ejs": "^3.1.6",
"express": "^4.18.2",
"ts-node": "^10.9.1",
"typescript": "^5.4.5",
"typescript": "^5.6.2",
"vite-express": "^0.11.0"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/node": "^18.19.33",
"nodemon": "^2.0.20",
"nodemon": "^2.0.22",
"vite": "^4.0.4"
}
}
4 changes: 2 additions & 2 deletions integration/templates/next-app-router-quickstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"@types/node": "^20.12.12",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"next": "14.2.5",
"next": "14.2.10",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.4.5"
"typescript": "^5.6.2"
},
"engines": {
"node": ">=18.17.0"
Expand Down
4 changes: 2 additions & 2 deletions integration/templates/next-app-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"@types/node": "^18.19.33",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"next": "^14.1.1",
"next": "^14.2.13",
"react": "18.3.1",
"react-dom": "18.3.1",
"typescript": "^5.4.5"
"typescript": "^5.6.2"
},
"engines": {
"node": ">=18.17.0"
Expand Down
4 changes: 3 additions & 1 deletion integration/templates/next-app-router/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default function RootLayout({ children }: { children: React.ReactNode })
return (
<ClerkProvider
experimental={{
persistClient: process.env.NEXT_PUBLIC_EXPERIMENTAL_PERSIST_CLIENT === 'true',
persistClient: process.env.NEXT_PUBLIC_EXPERIMENTAL_PERSIST_CLIENT
? process.env.NEXT_PUBLIC_EXPERIMENTAL_PERSIST_CLIENT === 'true'
: undefined,
}}
>
<html lang='en'>
Expand Down
2 changes: 1 addition & 1 deletion integration/templates/react-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"eslint": "^8.38.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.0",
"typescript": "^5.4.5",
"typescript": "^5.6.2",
"vite": "^4.3.9"
},
"engines": {
Expand Down
1 change: 0 additions & 1 deletion integration/templates/react-vite/src/client-id.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useClerk, useSession } from '@clerk/clerk-react';
import React from 'react';

export function ClientId() {
const clerk = useClerk();
Expand Down
4 changes: 3 additions & 1 deletion integration/templates/react-vite/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const Root = () => {
routerPush={(to: string) => navigate(to)}
routerReplace={(to: string) => navigate(to, { replace: true })}
experimental={{
persistClient: import.meta.env.VITE_EXPERIMENTAL_PERSIST_CLIENT === 'true',
persistClient: import.meta.env.VITE_EXPERIMENTAL_PERSIST_CLIENT
? import.meta.env.VITE_EXPERIMENTAL_PERSIST_CLIENT === 'true'
: undefined,
}}
>
<Outlet />
Expand Down
2 changes: 1 addition & 1 deletion integration/templates/remix-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"eslint": "^8.38.0",
"typescript": "^5.4.5"
"typescript": "^5.6.2"
},
"engines": {
"node": ">=18.17.0"
Expand Down
4 changes: 2 additions & 2 deletions integration/templates/tanstack-start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"@types/react-dom": "^18.2.21",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.40",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.7",
"typescript": "^5.5.3",
"typescript": "^5.6.2",
"vite": "^5.3.5",
"vite-tsconfig-paths": "^4.3.2"
}
Expand Down
Loading

0 comments on commit bc89068

Please sign in to comment.