From a9234f28b53455c3be5517c9e1098fa525ee0dd4 Mon Sep 17 00:00:00 2001 From: Jacek Radko Date: Wed, 18 Dec 2024 10:49:33 -0600 Subject: [PATCH] fix(repo): Link local packages for e2e (#4800) --- .changeset/eleven-months-swim.md | 2 ++ integration/presets/astro.ts | 7 ++++--- integration/presets/elements.ts | 5 +++-- integration/presets/expo.ts | 3 ++- integration/presets/express.ts | 3 ++- integration/presets/next.ts | 7 ++++--- integration/presets/nuxt.ts | 3 ++- integration/presets/react-router.ts | 3 ++- integration/presets/react.ts | 5 +++-- integration/presets/remix.ts | 3 ++- integration/presets/tanstack.ts | 5 +++-- integration/presets/utils.ts | 8 ++++++++ integration/presets/vue.ts | 3 ++- 13 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 .changeset/eleven-months-swim.md create mode 100644 integration/presets/utils.ts diff --git a/.changeset/eleven-months-swim.md b/.changeset/eleven-months-swim.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/eleven-months-swim.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/integration/presets/astro.ts b/integration/presets/astro.ts index 0b7a208887..7995725b97 100644 --- a/integration/presets/astro.ts +++ b/integration/presets/astro.ts @@ -1,5 +1,6 @@ import { applicationConfig } from '../models/applicationConfig'; import { templates } from '../templates'; +import { linkPackage } from './utils'; const astroNode = applicationConfig() .setName('astro-node') @@ -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']); diff --git a/integration/presets/elements.ts b/integration/presets/elements.ts index ae06dc5442..91bd21fbb0 100644 --- a/integration/presets/elements.ts +++ b/integration/presets/elements.ts @@ -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') @@ -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, diff --git a/integration/presets/expo.ts b/integration/presets/expo.ts index 8380327fd3..bf9806fce2 100644 --- a/integration/presets/expo.ts +++ b/integration/presets/expo.ts @@ -1,5 +1,6 @@ import { applicationConfig } from '../models/applicationConfig'; import { templates } from '../templates'; +import { linkPackage } from './utils'; const expoWeb = applicationConfig() .setName('expo-web') @@ -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, diff --git a/integration/presets/express.ts b/integration/presets/express.ts index fdebf5a530..6470469a0b 100644 --- a/integration/presets/express.ts +++ b/integration/presets/express.ts @@ -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') @@ -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, diff --git a/integration/presets/next.ts b/integration/presets/next.ts index a16a5a521e..6636af850c 100644 --- a/integration/presets/next.ts +++ b/integration/presets/next.ts @@ -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') @@ -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'); diff --git a/integration/presets/nuxt.ts b/integration/presets/nuxt.ts index 8a55270454..8fdc9716c6 100644 --- a/integration/presets/nuxt.ts +++ b/integration/presets/nuxt.ts @@ -1,5 +1,6 @@ import { applicationConfig } from '../models/applicationConfig'; import { templates } from '../templates'; +import { linkPackage } from './utils'; const nuxtNode = applicationConfig() .setName('nuxt-node') @@ -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, diff --git a/integration/presets/react-router.ts b/integration/presets/react-router.ts index 1ff0470482..5ddb035f1b 100644 --- a/integration/presets/react-router.ts +++ b/integration/presets/react-router.ts @@ -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') @@ -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, diff --git a/integration/presets/react.ts b/integration/presets/react.ts index 0dc674300f..06e1434282 100644 --- a/integration/presets/react.ts +++ b/integration/presets/react.ts @@ -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') @@ -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() diff --git a/integration/presets/remix.ts b/integration/presets/remix.ts index 41decccff0..d8f6c619bf 100644 --- a/integration/presets/remix.ts +++ b/integration/presets/remix.ts @@ -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') @@ -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, diff --git a/integration/presets/tanstack.ts b/integration/presets/tanstack.ts index 5b9399abe5..03ddd8d190 100644 --- a/integration/presets/tanstack.ts +++ b/integration/presets/tanstack.ts @@ -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') @@ -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') @@ -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, diff --git a/integration/presets/utils.ts b/integration/presets/utils.ts new file mode 100644 index 0000000000..4c4f6db45d --- /dev/null +++ b/integration/presets/utils.ts @@ -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}`)}`; +} diff --git a/integration/presets/vue.ts b/integration/presets/vue.ts index 3d9cc9e280..1003af19f5 100644 --- a/integration/presets/vue.ts +++ b/integration/presets/vue.ts @@ -1,5 +1,6 @@ import { applicationConfig } from '../models/applicationConfig'; import { templates } from '../templates'; +import { linkPackage } from './utils'; const vite = applicationConfig() .setName('vue-vite') @@ -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,