OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
📦 sdk: fix nextjs package
Carl-Gerhard Lindesvärdf276deeeeb82
diff --git a/packages/sdks/nextjs/package.json b/packages/sdks/nextjs/package.jsonindex 4a3957d86..2dd1293c4 100644--- a/packages/sdks/nextjs/package.json+++ b/packages/sdks/nextjs/package.json@@ -12,9 +12,9 @@"@openpanel/web": "workspace:*"},"peerDependencies": {- "next": "^14.0.0",- "react": "^18.2.0",- "react-dom": "^18.2.0"+ "next": "^12.0.0 || ^13.0.0 || ^14.0.0",+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"},"devDependencies": {"@openpanel/eslint-config": "workspace:*",diff --git a/packages/sdks/nextjs/tsup.config.ts b/packages/sdks/nextjs/tsup.config.tsindex befb10755..346bb9a56 100644--- a/packages/sdks/nextjs/tsup.config.ts+++ b/packages/sdks/nextjs/tsup.config.ts@@ -5,5 +5,5 @@ import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json'export default defineConfig({...(config as any),entry: ['index.tsx'],- format: ['cjs', 'esm'],+ external: ['react', 'next'],});diff --git a/sh/move-sdks-to-examples b/sh/move-sdks-to-examplesnew file mode 100755index 000000000..bca1729e0--- /dev/null+++ b/sh/move-sdks-to-examples@@ -0,0 +1,11 @@+#!/bin/bash++# nextjs-13-pages+rm -rf ../openpanel-examples/nextjs-13-pages/node_modules/@openpanel/nextjs && cp -R packages/sdks/nextjs ../openpanel-examples/nextjs-13-pages/node_modules/@openpanel/nextjs+rm -rf ../openpanel-examples/nextjs-13-pages/node_modules/@openpanel/web && cp -R packages/sdks/nextjs ../openpanel-examples/nextjs-13-pages/node_modules/@openpanel/web+# nextjs-app-dir+rm -rf ../openpanel-examples/nextjs-app-dir/node_modules/@openpanel/nextjs && cp -R packages/sdks/nextjs ../openpanel-examples/nextjs-app-dir/node_modules/@openpanel/nextjs+rm -rf ../openpanel-examples/nextjs-app-dir/node_modules/@openpanel/web && cp -R packages/sdks/nextjs ../openpanel-examples/nextjs-app-dir/node_modules/@openpanel/web+# expo-app+rm -rf ../openpanel-examples/expo-app/node_modules/@openpanel/react-native && cp -R packages/sdks/react-native ../openpanel-examples/expo-app/node_modules/@openpanel/react-native+rm -rf ../openpanel-examples/expo-app/node_modules/@openpanel/sdk && cp -R packages/sdks/sdk ../openpanel-examples/expo-app/node_modules/@openpanel/sdk\ No newline at end of filediff --git a/tooling/publish/publish.ts b/tooling/publish/publish.tsindex 8bb65a91f..9206e9aff 100644--- a/tooling/publish/publish.ts+++ b/tooling/publish/publish.ts@@ -40,16 +40,19 @@ function checkUncommittedChanges() {}function main() {- checkUncommittedChanges();-const args = arg({// Types'--version': String,'--test': Boolean,+ '--skip-git': Boolean,// Aliases'-v': '--version',});+ if (!args['--skip-git']) {+ checkUncommittedChanges();+ }+const version = args['--version'];const test = args['--test'];@@ -57,22 +60,27 @@ function main() {return console.error('Version is not valid');}- const properties = {- private: false,- version,- type: 'module',- main: './dist/index.js',- module: './dist/index.mjs',- types: './dist/index.d.ts',- files: ['dist'],- exports: {- import: './dist/index.js',- require: './dist/index.cjs',- },- };-try {for (const name of sdkPackages) {+ const properties: Record<string, unknown> = {+ private: false,+ version,+ type: 'module',+ main: './dist/index.js',+ module: './dist/index.mjs',+ types: './dist/index.d.ts',+ files: ['dist'],+ exports: {+ import: './dist/index.js',+ require: './dist/index.cjs',+ },+ };++ // Not sure if I even should have type: module for any sdk+ if (name === 'nextjs') {+ delete properties.type;+ }+const pkgJson = require(workspacePath(`./packages/sdks/${name}/package.json`));