OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
update publish script
Carl-Gerhard Lindesvärd131e6e7fb640
diff --git a/packages/types/package.json b/packages/types/package.jsonindex ac3d85462..6ebfbe75c 100644--- a/packages/types/package.json+++ b/packages/types/package.json@@ -3,6 +3,7 @@"version": "0.0.1","module": "index.ts","scripts": {+ "build": "rm -rf dist && tsup","lint": "eslint .","format": "prettier --check \"**/*.{mjs,ts,md,json}\"","typecheck": "tsc --noEmit"diff --git a/tooling/publish/publish.ts b/tooling/publish/publish.tsindex 058353f57..754a8203c 100644--- a/tooling/publish/publish.ts+++ b/tooling/publish/publish.ts@@ -3,9 +3,11 @@ import fs from 'node:fs';import path from 'node:path';import semver from 'semver';-import sdkPkg from '../../packages/sdk/package.json';import typesPkg from '../../packages/types/package.json';+const sdkPackages = ['sdk', 'sdk-native', 'sdk-web'];+// const sdkPackages = ['sdk'];+const workspacePath = (relativePath: string) =>path.resolve(__dirname, '../../', relativePath);@@ -50,17 +52,20 @@ function main() {};try {- savePackageJson(workspacePath('./packages/sdk/package.json'), {- ...sdkPkg,- ...properties,- dependencies: Object.entries(sdkPkg.dependencies).reduce(- (acc, [depName, depVersion]) => ({- ...acc,- [depName]: depName.startsWith('@mixan') ? version : depVersion,- }),- {}- ),- });+ for (const name of sdkPackages) {+ const pkgJson = require(workspacePath(`./packages/${name}/package.json`));+ savePackageJson(workspacePath(`./packages/${name}/package.json`), {+ ...pkgJson,+ ...properties,+ dependencies: Object.entries(pkgJson.dependencies).reduce(+ (acc, [depName, depVersion]) => ({+ ...acc,+ [depName]: depName.startsWith('@mixan') ? version : depVersion,+ }),+ {}+ ),+ });+ }savePackageJson(workspacePath('./packages/types/package.json'), {...typesPkg,@@ -73,11 +78,13 @@ function main() {console.log('✅ Update JSON files');try {- execSync('pnpm dlx tsup', {- cwd: workspacePath('./packages/sdk'),- });- execSync('pnpm dlx tsup', {- cwd: workspacePath('./packages/types'),+ for (const name of sdkPackages) {+ execSync('pnpm build', {+ cwd: workspacePath(`./packages/${name}`),+ });+ }+ execSync('pnpm build', {+ cwd: workspacePath(`./packages/types`),});} catch (error) {exit('Failed build packages', error);@@ -86,9 +93,11 @@ function main() {console.log('✅ Built packages');try {- execSync('npm publish --access=public', {- cwd: workspacePath('./packages/sdk'),- });+ for (const name of sdkPackages) {+ execSync('npm publish --access=public', {+ cwd: workspacePath(`./packages/${name}`),+ });+ }execSync('npm publish --access=public', {cwd: workspacePath('./packages/types'),