-
Notifications
You must be signed in to change notification settings - Fork 297
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
feat(sdks): Add sdkMetadata to Clerk singleton, populate it for each SDK #1857
Changes from all commits
68b7cc3
4749db8
9ec1392
77a1006
529fbeb
680c218
b563235
dd4c507
e5fedd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
'gatsby-plugin-clerk': patch | ||
'@clerk/clerk-js': patch | ||
'@clerk/chrome-extension': patch | ||
'@clerk/fastify': patch | ||
'@clerk/nextjs': patch | ||
'@clerk/clerk-react': patch | ||
'@clerk/remix': patch | ||
'@clerk/types': patch | ||
'@clerk/clerk-expo': patch | ||
--- | ||
|
||
Introduce a new property on the core Clerk singleton, `sdkMetadata`. This will be populated by each host SDK. This metadata will be used to make logging and debugging easier. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ yarn-error.log | |
testem.log | ||
/typings | ||
**/coverage/** | ||
*.tsbuildinfo | ||
|
||
# System Files | ||
.DS_Store | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export {}; | ||
|
||
declare global { | ||
const PACKAGE_NAME: string; | ||
const PACKAGE_VERSION: string; | ||
const __DEV__: boolean; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export {}; | ||
|
||
declare global { | ||
const PACKAGE_NAME: string; | ||
const PACKAGE_VERSION: string; | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"skipLibCheck": true, | ||
"noEmit": false, | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"declarationMap": true, | ||
"sourceMap": false, | ||
"declarationDir": "./dist" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
{ | ||
"extends": "./tsconfig.build.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should extend this from a root/base tsconfig.json But that's for another PR |
||
"baseUrl": ".", | ||
"lib": ["es6", "dom"], | ||
"jsx": "react", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"importHelpers": true, | ||
"declaration": true, | ||
"declarationMap": false, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"resolveJsonModule": true, | ||
"sourceMap": false, | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"allowJs": true, | ||
"target": "ES2019", | ||
"noEmitOnError": false, | ||
"incremental": true | ||
} | ||
}, | ||
"include": ["src"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { Options } from 'tsup'; | ||
import { defineConfig } from 'tsup'; | ||
|
||
import { runAfterLast } from '../../scripts/utils'; | ||
import { version as clerkJsVersion } from '../clerk-js/package.json'; | ||
import { name, version } from './package.json'; | ||
|
||
export default defineConfig(overrideOptions => { | ||
const isWatch = !!overrideOptions.watch; | ||
const shouldPublish = !!overrideOptions.env?.publish; | ||
|
||
const options: Options = { | ||
format: 'cjs', | ||
outDir: './dist', | ||
entry: ['./src/**/*.{ts,tsx,js,jsx}'], | ||
bundle: false, | ||
clean: true, | ||
minify: false, | ||
sourcemap: true, | ||
legacyOutput: true, | ||
define: { | ||
PACKAGE_NAME: `"${name}"`, | ||
PACKAGE_VERSION: `"${version}"`, | ||
JS_PACKAGE_VERSION: `"${clerkJsVersion}"`, | ||
__DEV__: `${isWatch}`, | ||
}, | ||
}; | ||
|
||
return runAfterLast(['npm run build:declarations', shouldPublish && 'npm run publish:local'])(options); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export {}; | ||
|
||
declare global { | ||
const PACKAGE_NAME: string; | ||
const PACKAGE_VERSION: string; | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"skipLibCheck": true, | ||
"noEmit": false, | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"declarationMap": true, | ||
"sourceMap": false, | ||
"declarationDir": "./dist" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
{ | ||
"extends": "./tsconfig.build.json", | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"baseUrl": ".", | ||
"lib": ["es6", "dom"], | ||
"jsx": "react", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"importHelpers": true, | ||
"declaration": true, | ||
"declarationMap": false, | ||
"noImplicitReturns": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"resolveJsonModule": true, | ||
"sourceMap": false, | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"allowJs": true, | ||
"target": "ES2019", | ||
"noEmitOnError": false, | ||
"incremental": true | ||
} | ||
}, | ||
"include": ["src"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { Options } from 'tsup'; | ||
import { defineConfig } from 'tsup'; | ||
|
||
import { runAfterLast } from '../../scripts/utils'; | ||
import { version as clerkJsVersion } from '../clerk-js/package.json'; | ||
import { name, version } from './package.json'; | ||
|
||
export default defineConfig(overrideOptions => { | ||
const isWatch = !!overrideOptions.watch; | ||
const shouldPublish = !!overrideOptions.env?.publish; | ||
|
||
const options: Options = { | ||
format: 'cjs', | ||
outDir: './dist', | ||
entry: ['./src/**/*.{ts,tsx,js,jsx}'], | ||
bundle: false, | ||
clean: true, | ||
minify: false, | ||
sourcemap: true, | ||
legacyOutput: true, | ||
define: { | ||
PACKAGE_NAME: `"${name}"`, | ||
PACKAGE_VERSION: `"${version}"`, | ||
JS_PACKAGE_VERSION: `"${clerkJsVersion}"`, | ||
__DEV__: `${isWatch}`, | ||
}, | ||
}; | ||
|
||
return runAfterLast(['npm run build:declarations', shouldPublish && 'npm run publish:local'])(options); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,6 +198,8 @@ export default class IsomorphicClerk { | |
await global.Clerk.load(this.options); | ||
} | ||
|
||
global.Clerk.sdkMetadata = this.options.sdkMetadata ?? { name: PACKAGE_NAME, version: PACKAGE_VERSION }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For SDKs that use |
||
|
||
if (global.Clerk?.loaded || global.Clerk?.isReady()) { | ||
return this.hydrateClerkJS(global.Clerk); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that we do this in the other packages but IMO we should just use
tsup
to also output the types and not use TSCBut that can happen in another PR