Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(repo): Link local packages for e2e #4800

Merged
merged 7 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
---
---
5 changes: 5 additions & 0 deletions integration/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ module.exports = {
'@typescript-eslint/no-redundant-type-constituents': 'warn', // TODO: Remove when we able to update tests
},
},
{
rules: {
'turbo/no-undeclared-variables': 'off',
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to add CI to turbo's global env vars instead of disabling here 👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can disable it on a per-use basis, but adding CI to turbo vars would create separate caches for tasks in CI versus local

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, true! Is anyone using turbo cache locally? 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope so 🥲

},
],
};
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
7 changes: 7 additions & 0 deletions integration/presets/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import path from 'node:path';

export function linkPackage(pkg: string) {
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
Loading