prepare sdk packages

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-03-11 19:52:14 +01:00
parent e6c0bc2ec8
commit f9e5feb688
16 changed files with 68 additions and 64 deletions

View File

@@ -2,12 +2,21 @@ import Script from 'next/script';
import type {
OpenpanelEventOptions,
OpenpanelWebOptions,
OpenpanelOptions,
PostEventPayload,
UpdateProfilePayload,
} from '@openpanel/web';
const CDN_URL = 'http://localhost:3002/op.js';
const CDN_URL = 'https://openpanel.dev/op.js';
declare global {
interface Window {
op: {
q?: [string, ...any[]];
(method: OpenpanelMethods, ...args: any[]): void;
};
}
}
type OpenpanelMethods =
| 'ctor'
@@ -19,7 +28,7 @@ type OpenpanelMethods =
| 'clear';
declare global {
interface Window {
interface window {
op: {
q?: [string, ...any[]];
(method: OpenpanelMethods, ...args: any[]): void;
@@ -27,7 +36,7 @@ declare global {
}
}
type OpenpanelProviderProps = OpenpanelWebOptions & {
type OpenpanelProviderProps = OpenpanelOptions & {
profileId?: string;
cdnUrl?: string;
};

View File

@@ -4,13 +4,11 @@
"module": "index.ts",
"scripts": {
"build": "rm -rf dist && tsup",
"build-for-openpanel": "pnpm build && cp dist/cdn.global.js ../../apps/public/public/op.js && cp dist/cdn.global.js ../../apps/test/public/op.js",
"lint": "eslint .",
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@openpanel/sdk": "workspace:*",
"@openpanel/web": "workspace:*"
},
"peerDependencies": {
@@ -20,6 +18,7 @@
"@openpanel/eslint-config": "workspace:*",
"@openpanel/prettier-config": "workspace:*",
"@openpanel/tsconfig": "workspace:*",
"@types/react": "^18.2.20",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",

View File

@@ -1,6 +1,7 @@
{
"extends": "@openpanel/tsconfig/base.json",
"compilerOptions": {
"incremental": false,
"outDir": "dist"
}
}

View File

@@ -4,6 +4,6 @@ import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json'
export default defineConfig({
...(config as any),
entry: ['index.ts'],
entry: ['index.tsx'],
format: ['cjs', 'esm'],
});