Skip to content

Commit

Permalink
Merge branch 'main' into mery/update-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
kaftarmery authored Dec 19, 2024
2 parents 72e3fc2 + 4fecdac commit 3bfbff3
Show file tree
Hide file tree
Showing 101 changed files with 674 additions and 464 deletions.
2 changes: 2 additions & 0 deletions .changeset/eleven-months-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
12 changes: 0 additions & 12 deletions .changeset/old-dryers-approve.md

This file was deleted.

4 changes: 0 additions & 4 deletions integration/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ export const constants = {
* The version of the dependency to use, controlled programmatically.
*/
E2E_REACT_DOM_VERSION: process.env.E2E_REACT_DOM_VERSION,
/**
* The version of the dependency to use, controlled programmatically.
*/
E2E_REMIX_VERSION: process.env.E2E_REMIX_VERSION,
/**
* The version of the dependency to use, controlled programmatically.
*/
Expand Down
7 changes: 4 additions & 3 deletions integration/presets/astro.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';
import { linkPackage } from './utils';

const astroNode = applicationConfig()
.setName('astro-node')
Expand All @@ -9,9 +10,9 @@ const astroNode = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm preview')
.addDependency('@clerk/astro', '*')
.addDependency('@clerk/types', '*')
.addDependency('@clerk/localizations', '*');
.addDependency('@clerk/astro', linkPackage('astro'))
.addDependency('@clerk/types', linkPackage('types'))
.addDependency('@clerk/localizations', linkPackage('localizations'));

const astroStatic = astroNode.clone().setName('astro-hybrid').useTemplate(templates['astro-hybrid']);

Expand Down
5 changes: 3 additions & 2 deletions integration/presets/elements.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { constants } from '../constants';
import { applicationConfig } from '../models/applicationConfig.js';
import { templates } from '../templates/index.js';
import { linkPackage } from './utils';

const nextAppRouter = applicationConfig()
.setName('elements-next')
Expand All @@ -13,8 +14,8 @@ const nextAppRouter = applicationConfig()
.addDependency('next', constants.E2E_NEXTJS_VERSION)
.addDependency('react', constants.E2E_REACT_VERSION)
.addDependency('react-dom', constants.E2E_REACT_DOM_VERSION)
.addDependency('@clerk/nextjs', constants.E2E_CLERK_VERSION || '*')
.addDependency('@clerk/elements', constants.E2E_CLERK_VERSION || '*');
.addDependency('@clerk/nextjs', constants.E2E_CLERK_VERSION || linkPackage('nextjs'))
.addDependency('@clerk/elements', constants.E2E_CLERK_VERSION || linkPackage('elements'));

export const elements = {
nextAppRouter,
Expand Down
3 changes: 2 additions & 1 deletion integration/presets/expo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';
import { linkPackage } from './utils';

const expoWeb = applicationConfig()
.setName('expo-web')
Expand All @@ -9,7 +10,7 @@ const expoWeb = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/clerk-expo', '*');
.addDependency('@clerk/clerk-expo', linkPackage('expo'));

export const expo = {
expoWeb,
Expand Down
3 changes: 2 additions & 1 deletion integration/presets/express.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { constants } from '../constants';
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';
import { linkPackage } from './utils';

const vite = applicationConfig()
.setName('express-vite')
Expand All @@ -10,7 +11,7 @@ const vite = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/clerk-sdk-node', constants.E2E_CLERK_VERSION || '*');
.addDependency('@clerk/clerk-sdk-node', constants.E2E_CLERK_VERSION || linkPackage('sdk-node'));

export const express = {
vite,
Expand Down
2 changes: 0 additions & 2 deletions integration/presets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { next } from './next';
import { nuxt } from './nuxt';
import { react } from './react';
import { reactRouter } from './react-router';
import { remix } from './remix';
import { tanstack } from './tanstack';

export const appConfigs = {
Expand All @@ -17,7 +16,6 @@ export const appConfigs = {
longRunningApps: createLongRunningApps(),
next,
react,
remix,
elements,
expo,
astro,
Expand Down
2 changes: 0 additions & 2 deletions integration/presets/longRunningApps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { next } from './next';
import { nuxt } from './nuxt';
import { react } from './react';
import { reactRouter } from './react-router';
import { remix } from './remix';
import { tanstack } from './tanstack';
import { vue } from './vue';

Expand All @@ -24,7 +23,6 @@ export const createLongRunningApps = () => {
{ id: 'react.vite.withEmailCodes', config: react.vite, env: envs.withEmailCodes },
{ 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',
Expand Down
7 changes: 4 additions & 3 deletions integration/presets/next.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { constants } from '../constants';
import { applicationConfig } from '../models/applicationConfig.js';
import { templates } from '../templates/index.js';
import { linkPackage } from './utils';

const appRouter = applicationConfig()
.setName('next-app-router')
Expand All @@ -13,9 +14,9 @@ const appRouter = applicationConfig()
.addDependency('next', constants.E2E_NEXTJS_VERSION)
.addDependency('react', constants.E2E_REACT_VERSION)
.addDependency('react-dom', constants.E2E_REACT_DOM_VERSION)
.addDependency('@clerk/nextjs', constants.E2E_CLERK_VERSION || '*')
.addDependency('@clerk/shared', '*')
.addDependency('@clerk/types', '*');
.addDependency('@clerk/nextjs', constants.E2E_CLERK_VERSION || linkPackage('nextjs'))
.addDependency('@clerk/shared', linkPackage('shared'))
.addDependency('@clerk/types', linkPackage('types'));

const appRouterTurbo = appRouter.clone().setName('next-app-router-turbopack').addScript('dev', 'pnpm dev');

Expand Down
3 changes: 2 additions & 1 deletion integration/presets/nuxt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';
import { linkPackage } from './utils';

const nuxtNode = applicationConfig()
.setName('nuxt-node')
Expand All @@ -10,7 +11,7 @@ const nuxtNode = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm preview')
.addDependency('@clerk/nuxt', '*');
.addDependency('@clerk/nuxt', linkPackage('nuxt'));

export const nuxt = {
node: nuxtNode,
Expand Down
14 changes: 13 additions & 1 deletion integration/presets/react-router.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { constants } from '../constants';
import { applicationConfig } from '../models/applicationConfig.js';
import { templates } from '../templates/index.js';
import { linkPackage } from './utils';

const reactRouterNode = applicationConfig()
.setName('react-router-node')
Expand All @@ -10,8 +11,19 @@ const reactRouterNode = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/react-router', constants.E2E_CLERK_VERSION || '*');
.addDependency('@clerk/react-router', constants.E2E_CLERK_VERSION || linkPackage('react-router'));

const reactRouterLibrary = applicationConfig()
.setName('react-router-library')
.useTemplate(templates['react-router-library'])
.setEnvFormatter('public', key => `VITE_${key}`)
.addScript('setup', 'pnpm install')
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm preview')
.addDependency('@clerk/react-router', constants.E2E_CLERK_VERSION || linkPackage('react-router'));

export const reactRouter = {
reactRouterNode,
reactRouterLibrary,
} as const;
5 changes: 3 additions & 2 deletions integration/presets/react.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { constants } from '../constants';
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';
import { linkPackage } from './utils';

const cra = applicationConfig()
.setName('react-cra')
Expand All @@ -10,8 +11,8 @@ const cra = applicationConfig()
.addScript('dev', 'pnpm start')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/clerk-react', constants.E2E_CLERK_VERSION || '*')
.addDependency('@clerk/themes', constants.E2E_CLERK_VERSION || '*');
.addDependency('@clerk/clerk-react', constants.E2E_CLERK_VERSION || linkPackage('react'))
.addDependency('@clerk/themes', constants.E2E_CLERK_VERSION || linkPackage('themes'));

const vite = cra
.clone()
Expand Down
17 changes: 0 additions & 17 deletions integration/presets/remix.ts

This file was deleted.

5 changes: 3 additions & 2 deletions integration/presets/tanstack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { applicationConfig } from '../models/applicationConfig.js';
import { templates } from '../templates/index.js';
import { linkPackage } from './utils';

const router = applicationConfig()
.setName('tanstack-router')
Expand All @@ -9,7 +10,7 @@ const router = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/tanstack-start', '*');
.addDependency('@clerk/tanstack-start', linkPackage('tanstack-start'));

const start = applicationConfig()
.setName('tanstack-start')
Expand All @@ -19,7 +20,7 @@ const start = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/tanstack-start', '*');
.addDependency('@clerk/tanstack-start', linkPackage('tanstack-start'));

export const tanstack = {
start,
Expand Down
8 changes: 8 additions & 0 deletions integration/presets/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import path from 'node:path';

export function linkPackage(pkg: string) {
// eslint-disable-next-line turbo/no-undeclared-variables
if (process.env.CI === 'true') return '*';

return `link:${path.resolve(process.cwd(), `packages/${pkg}`)}`;
}
3 changes: 2 additions & 1 deletion integration/presets/vue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';
import { linkPackage } from './utils';

const vite = applicationConfig()
.setName('vue-vite')
Expand All @@ -9,7 +10,7 @@ const vite = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm preview')
.addDependency('@clerk/vue', '*');
.addDependency('@clerk/vue', linkPackage('vue'));

export const vue = {
vite,
Expand Down
2 changes: 1 addition & 1 deletion integration/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const templates = {
'react-cra': resolve(__dirname, './react-cra'),
'react-vite': resolve(__dirname, './react-vite'),
'express-vite': resolve(__dirname, './express-vite'),
'remix-node': resolve(__dirname, './remix-node'),
'elements-next': resolve(__dirname, './elements-next'),
'astro-node': resolve(__dirname, './astro-node'),
'astro-hybrid': resolve(__dirname, './astro-hybrid'),
Expand All @@ -19,6 +18,7 @@ export const templates = {
'vue-vite': resolve(__dirname, './vue-vite'),
'nuxt-node': resolve(__dirname, './nuxt-node'),
'react-router-node': resolve(__dirname, './react-router-node'),
'react-router-library': resolve(__dirname, './react-router-library'),
} as const;

if (new Set([...Object.values(templates)]).size !== Object.values(templates).length) {
Expand Down
50 changes: 50 additions & 0 deletions integration/templates/react-router-library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
});
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react';

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
});
```
23 changes: 23 additions & 0 deletions integration/templates/react-router-library/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link
rel="icon"
type="image/svg+xml"
href="/vite.svg"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script
type="module"
src="/src/main.tsx"
></script>
</body>
</html>
Loading

0 comments on commit 3bfbff3

Please sign in to comment.