Skip to content

Commit

Permalink
fix(repo): Link local packages for e2e (#4800)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekradko authored Dec 18, 2024
1 parent 784b50e commit a9234f2
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 18 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 @@
---
---
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
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
3 changes: 2 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,7 +11,7 @@ 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'));

export const reactRouter = {
reactRouterNode,
Expand Down
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
3 changes: 2 additions & 1 deletion integration/presets/remix.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 remixNode = applicationConfig()
.setName('remix-node')
Expand All @@ -10,7 +11,7 @@ const remixNode = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/remix', constants.E2E_CLERK_VERSION || '*');
.addDependency('@clerk/remix', constants.E2E_CLERK_VERSION || linkPackage('remix'));

export const remix = {
remixNode,
Expand Down
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

0 comments on commit a9234f2

Please sign in to comment.