Skip to content

Commit

Permalink
feat(shared): Ensure we only load clerk-js v4 in the interstitial, in…
Browse files Browse the repository at this point in the history
…stead of latest
  • Loading branch information
brkalow authored and dimkl committed Nov 22, 2023
1 parent 383d336 commit f0379a2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/shared/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export {};

declare global {
const CLERK_JS_PACKAGE_VERSION: string;
const PACKAGE_VERSION: string;
const __DEV__: boolean;
}
2 changes: 1 addition & 1 deletion packages/shared/src/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const getClerkJsMajorVersionOrTag = (frontendApi: string, pkgVersion?: st
*/
export const getScriptUrl = (
frontendApi: string,
{ pkgVersion, clerkJSVersion }: { pkgVersion?: string; clerkJSVersion?: string },
{ pkgVersion = CLERK_JS_PACKAGE_VERSION, clerkJSVersion }: { pkgVersion?: string; clerkJSVersion?: string },
) => {
const noSchemeFrontendApi = frontendApi.replace(/http(s)?:\/\//, '');
const major = getClerkJsMajorVersionOrTag(frontendApi, pkgVersion);
Expand Down
4 changes: 3 additions & 1 deletion packages/shared/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { transform } from 'esbuild';
import { readFile } from 'fs/promises';
import { defineConfig } from 'tsup';

import { version as clerkJsVersion } from '../clerk-js/package.json';
import { name, version } from './package.json';

export default defineConfig(overrideOptions => {
Expand All @@ -17,8 +18,9 @@ export default defineConfig(overrideOptions => {
sourcemap: true,
dts: true,
external: ['react', 'react-dom'],
esbuildPlugins: [WebWorkerMinifyPlugin as any],
esbuildPlugins: [WebWorkerMinifyPlugin],
define: {
CLERK_JS_PACKAGE_VERSION: `"${clerkJsVersion}"`,
PACKAGE_NAME: `"${name}"`,
PACKAGE_VERSION: `"${version}"`,
__DEV__: `${isWatch}`,
Expand Down

0 comments on commit f0379a2

Please sign in to comment.