Skip to content

Commit

Permalink
feat(repo): Use workspace: protocol (#4566)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekradko authored Nov 19, 2024
1 parent 7510d5c commit 6468853
Show file tree
Hide file tree
Showing 38 changed files with 172 additions and 161 deletions.
2 changes: 2 additions & 0 deletions .changeset/small-knives-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
6 changes: 4 additions & 2 deletions .github/actions/init-blacksmith/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ runs:
if: inputs.playwright-enabled == 'true'
shell: bash
id: playwright-version
run: echo "VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> "$GITHUB_OUTPUT"

run: |
VERSION=$(node -p "require('@playwright/test/package.json').version")
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Cache Playwright Binaries
if: inputs.playwright-enabled == 'true'
uses: useblacksmith/cache@v5
Expand Down
4 changes: 3 additions & 1 deletion .github/actions/init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ runs:
if: inputs.playwright-enabled == 'true'
shell: bash
id: playwright-version
run: echo "VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> "$GITHUB_OUTPUT"
run: |
VERSION=$(node -p "require('@playwright/test/package.json').version")
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Cache Playwright Binaries
if: inputs.playwright-enabled == 'true'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ jobs:
publish-cmd: |
if [ "$(pnpm config get registry)" = "https://registry.npmjs.org/" ]; then echo 'Error: Using default registry' && exit 1; else pnpm turbo build $TURBO_ARGS --only && pnpm changeset publish --no-git-tag; fi
- name: Edit .npmrc [link-workspace-packages=false]
run: sed -i -E 's/link-workspace-packages=(deep|true)/link-workspace-packages=false/' .npmrc

- name: Install @clerk/backend in /integration
if: ${{ steps.task-status.outputs.affected == '1' }}
working-directory: ./integration
Expand Down
4 changes: 1 addition & 3 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
engine-strict=false
legacy-peer-deps=false

prefer-workspace-packages=true
link-workspace-packages=true
link-workspace-packages=true
30 changes: 25 additions & 5 deletions integration/models/longRunningApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,31 @@ export const longRunningApplication = (params: LongRunningApplicationParams) =>
// will be called by global.setup.ts and by the test runner
// the first time this is called, the app starts and the state is persisted in the state file
init: async () => {
app = await config.commit();
await app.withEnv(params.env);
await app.setup();
const { port, serverUrl, pid } = await app.dev({ detached: true });
stateFile.addLongRunningApp({ port, serverUrl, pid, id, appDir: app.appDir, env: params.env.toJson() });
try {
app = await config.commit();
} catch (error) {
console.error('Error committing config:', error);
throw error;
}
try {
await app.withEnv(params.env);
} catch (error) {
console.error('Error setting up environment:', error);
throw error;
}
try {
await app.setup();
} catch (error) {
console.error('Error during app setup:', error);
throw error;
}
try {
const { port, serverUrl, pid } = await app.dev({ detached: true });
stateFile.addLongRunningApp({ port, serverUrl, pid, id, appDir: app.appDir, env: params.env.toJson() });
} catch (error) {
console.error('Error during app dev:', error);
throw error;
}
},
// will be called by global.teardown.ts
destroy: async () => {
Expand Down
10 changes: 3 additions & 7 deletions integration/presets/astro.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';

const clerkAstroLocal = `file:${process.cwd()}/packages/astro`;
const clerkTypesLocal = `file:${process.cwd()}/packages/types`;
const clerkLocalizationLocal = `file:${process.cwd()}/packages/localizations`;

const astroNode = applicationConfig()
.setName('astro-node')
.useTemplate(templates['astro-node'])
Expand All @@ -13,9 +9,9 @@ const astroNode = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm preview')
.addDependency('@clerk/astro', clerkAstroLocal)
.addDependency('@clerk/types', clerkTypesLocal)
.addDependency('@clerk/localizations', clerkLocalizationLocal);
.addDependency('@clerk/astro', '*')
.addDependency('@clerk/types', '*')
.addDependency('@clerk/localizations', '*');

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

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

const clerkNextjsLocal = `file:${process.cwd()}/packages/nextjs`;
const clerkElementsLocal = `file:${process.cwd()}/packages/elements`;

const nextAppRouter = applicationConfig()
.setName('elements-next')
.useTemplate(templates['elements-next'])
Expand All @@ -16,8 +13,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 || clerkNextjsLocal)
.addDependency('@clerk/elements', constants.E2E_CLERK_VERSION || clerkElementsLocal);
.addDependency('@clerk/nextjs', constants.E2E_CLERK_VERSION || '*')
.addDependency('@clerk/elements', constants.E2E_CLERK_VERSION || '*');

export const elements = {
nextAppRouter,
Expand Down
4 changes: 1 addition & 3 deletions integration/presets/expo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';

const clerkExpoLocal = `file:${process.cwd()}/packages/expo`;

const expoWeb = applicationConfig()
.setName('expo-web')
.useTemplate(templates['expo-web'])
Expand All @@ -11,7 +9,7 @@ const expoWeb = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/clerk-expo', clerkExpoLocal);
.addDependency('@clerk/clerk-expo', '*');

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

const clerkNodeLocal = `file:${process.cwd()}/packages/sdk-node`;
const vite = applicationConfig()
.setName('express-vite')
.useTemplate(templates['express-vite'])
Expand All @@ -11,7 +10,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 || clerkNodeLocal);
.addDependency('@clerk/clerk-sdk-node', constants.E2E_CLERK_VERSION || '*');

export const express = {
vite,
Expand Down
9 changes: 3 additions & 6 deletions integration/presets/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { constants } from '../constants';
import { applicationConfig } from '../models/applicationConfig.js';
import { templates } from '../templates/index.js';

const clerkNextjsLocal = `file:${process.cwd()}/packages/nextjs`;
const clerkSharedLocal = `file:${process.cwd()}/packages/shared`;
const clerkTypesLocal = `file:${process.cwd()}/packages/types`;
const appRouter = applicationConfig()
.setName('next-app-router')
.useTemplate(templates['next-app-router'])
Expand All @@ -16,9 +13,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 || clerkNextjsLocal)
.addDependency('@clerk/shared', clerkSharedLocal)
.addDependency('@clerk/types', clerkTypesLocal);
.addDependency('@clerk/nextjs', constants.E2E_CLERK_VERSION || '*')
.addDependency('@clerk/shared', '*')
.addDependency('@clerk/types', '*');

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

Expand Down
7 changes: 2 additions & 5 deletions integration/presets/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { constants } from '../constants';
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';

const clerkReactLocal = `file:${process.cwd()}/packages/react`;
const clerkThemesLocal = `file:${process.cwd()}/packages/themes`;

const cra = applicationConfig()
.setName('react-cra')
.useTemplate(templates['react-cra'])
Expand All @@ -13,8 +10,8 @@ const cra = applicationConfig()
.addScript('dev', 'pnpm start')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/clerk-react', constants.E2E_CLERK_VERSION || clerkReactLocal)
.addDependency('@clerk/themes', constants.E2E_CLERK_VERSION || clerkThemesLocal);
.addDependency('@clerk/clerk-react', constants.E2E_CLERK_VERSION || '*')
.addDependency('@clerk/themes', constants.E2E_CLERK_VERSION || '*');

const vite = cra
.clone()
Expand Down
3 changes: 1 addition & 2 deletions integration/presets/remix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { constants } from '../constants';
import { applicationConfig } from '../models/applicationConfig.js';
import { templates } from '../templates/index.js';

const clerkRemixLocal = `file:${process.cwd()}/packages/remix`;
const remixNode = applicationConfig()
.setName('remix-node')
.useTemplate(templates['remix-node'])
Expand All @@ -11,7 +10,7 @@ const remixNode = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/remix', constants.E2E_CLERK_VERSION || clerkRemixLocal);
.addDependency('@clerk/remix', constants.E2E_CLERK_VERSION || '*');

export const remix = {
remixNode,
Expand Down
6 changes: 2 additions & 4 deletions integration/presets/tanstack.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { applicationConfig } from '../models/applicationConfig.js';
import { templates } from '../templates/index.js';

const clerkTanStackLocal = `file:${process.cwd()}/packages/tanstack-start`;

const router = applicationConfig()
.setName('tanstack-router')
.useTemplate(templates['tanstack-router'])
Expand All @@ -11,7 +9,7 @@ const router = applicationConfig()
.addScript('dev', 'pnpm dev')
.addScript('build', 'pnpm build')
.addScript('serve', 'pnpm start')
.addDependency('@clerk/tanstack-start', clerkTanStackLocal);
.addDependency('@clerk/tanstack-start', '*');

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

export const tanstack = {
start,
Expand Down
4 changes: 1 addition & 3 deletions integration/presets/vue.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { applicationConfig } from '../models/applicationConfig';
import { templates } from '../templates';

const clerkVueLocal = `file:${process.cwd()}/packages/vue`;

const vite = applicationConfig()
.setName('vue-vite')
.useTemplate(templates['vue-vite'])
Expand All @@ -11,7 +9,7 @@ const vite = applicationConfig()
.addScript('dev', 'npm run dev')
.addScript('build', 'npm run build')
.addScript('serve', 'npm run preview')
.addDependency('@clerk/vue', clerkVueLocal);
.addDependency('@clerk/vue', '*');

export const vue = {
vite,
Expand Down
5 changes: 5 additions & 0 deletions integration/templates/expo-web/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ const path = require('node:path');
const getClerkExpoPath = () => {
const clerkExpoPath = packageJson.dependencies['@clerk/clerk-expo'];

if (clerkExpoPath?.startsWith('*')) {
const pathToModule = require.resolve('@clerk/clerk-expo');
return pathToModule.replace('dist/index.js', '');
}

if (clerkExpoPath?.startsWith('file:')) {
return clerkExpoPath.replace('file:', '');
}
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@
"publish:local": "pnpm dlx yalc push --replace --sig"
},
"dependencies": {
"@clerk/backend": "1.17.0",
"@clerk/shared": "2.15.0",
"@clerk/types": "4.34.0",
"@clerk/backend": "workspace:*",
"@clerk/shared": "workspace:*",
"@clerk/types": "workspace:*",
"nanoid": "5.0.7",
"nanostores": "0.11.3"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
"test:cloudflare-miniflare": "vitest --environment miniflare"
},
"dependencies": {
"@clerk/shared": "2.15.0",
"@clerk/types": "4.34.0",
"@clerk/shared": "workspace:*",
"@clerk/types": "workspace:*",
"cookie": "0.7.0",
"snakecase-keys": "5.4.4",
"tslib": "2.4.1"
Expand Down
6 changes: 3 additions & 3 deletions packages/chrome-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
"test:coverage": "jest --collectCoverage && open coverage/lcov-report/index.html"
},
"dependencies": {
"@clerk/clerk-js": "5.34.3",
"@clerk/clerk-react": "5.16.0",
"@clerk/shared": "2.15.0",
"@clerk/clerk-js": "workspace:*",
"@clerk/clerk-react": "workspace:*",
"@clerk/shared": "workspace:*",
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/clerk-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
},
"browserslist": "last 2 years, Safari > 12, iOS > 12",
"dependencies": {
"@clerk/localizations": "3.6.4",
"@clerk/shared": "2.15.0",
"@clerk/types": "4.34.0",
"@clerk/localizations": "workspace:*",
"@clerk/shared": "workspace:*",
"@clerk/types": "workspace:*",
"@coinbase/wallet-sdk": "4.0.4",
"@emotion/cache": "11.11.0",
"@emotion/react": "11.11.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"test:cache:clear": "jest --clearCache --useStderr"
},
"dependencies": {
"@clerk/clerk-react": "5.16.0",
"@clerk/shared": "2.15.0",
"@clerk/clerk-react": "workspace:*",
"@clerk/shared": "workspace:*",
"@clerk/types": "^4.34.0",
"@radix-ui/primitive": "^1.1.0",
"@radix-ui/react-form": "^0.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/expo-passkeys/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"publish:local": "pnpm dlx yalc push --replace --sig"
},
"dependencies": {
"@clerk/shared": "2.15.0",
"@clerk/types": "4.34.0",
"@clerk/shared": "workspace:*",
"@clerk/types": "workspace:*",
"expo-modules-core": "1.12.26"
},
"devDependencies": {},
Expand Down
10 changes: 5 additions & 5 deletions packages/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
"publish:local": "pnpm dlx yalc push --replace --sig"
},
"dependencies": {
"@clerk/clerk-js": "5.34.3",
"@clerk/clerk-react": "5.16.0",
"@clerk/expo-passkeys": "0.0.6",
"@clerk/shared": "2.15.0",
"@clerk/types": "4.34.0",
"@clerk/clerk-js": "workspace:*",
"@clerk/clerk-react": "workspace:*",
"@clerk/expo-passkeys": "workspace:*",
"@clerk/shared": "workspace:*",
"@clerk/types": "workspace:*",
"base-64": "^1.0.0",
"react-native-url-polyfill": "2.0.0",
"tslib": "2.4.1"
Expand Down
6 changes: 3 additions & 3 deletions packages/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
"test:ci": "jest --maxWorkers=70%"
},
"dependencies": {
"@clerk/backend": "^1.17.0",
"@clerk/shared": "^2.15.0",
"@clerk/types": "4.34.0",
"@clerk/backend": "workspace:^",
"@clerk/shared": "workspace:^",
"@clerk/types": "workspace:^",
"tslib": "2.4.1"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"test:cache:clear": "jest --clearCache --useStderr"
},
"dependencies": {
"@clerk/backend": "1.17.0",
"@clerk/shared": "2.15.0",
"@clerk/types": "4.34.0",
"@clerk/backend": "workspace:*",
"@clerk/shared": "workspace:*",
"@clerk/types": "workspace:*",
"cookies": "0.8.0",
"fastify-plugin": "^5.0.1"
},
Expand Down
Loading

0 comments on commit 6468853

Please sign in to comment.