The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update prepublish.js
Kiran Keefa55693785
diff --git a/packages/embeds/react/prepublish.js b/packages/embeds/react/prepublish.jsindex cb974ad160..1fd813f81c 100644--- a/packages/embeds/react/prepublish.js+++ b/packages/embeds/react/prepublish.js@@ -4,18 +4,32 @@ const path = require("path");const pkgPath = path.resolve(__dirname, "package.json");const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));-// Replace all "workspace:*" with actual versions-for (const depType of ["dependencies", "peerDependencies", "devDependencies"]) {- if (!pkg[depType]) continue;+const packageDirMap = {+ "@dub/embed-core": "../core",+};+const depType = "dependencies";++if (pkg[depType]) {for (const dep in pkg[depType]) {if (pkg[depType][dep] === "workspace:*") {- // Find the package.json of the dependency- const depPkgPath = path.resolve(__dirname, "..", dep, "package.json");- const depPkg = JSON.parse(fs.readFileSync(depPkgPath, "utf-8"));- pkg[depType][dep] = `^${depPkg.version}`;+ // Resolve the local package's path+ const depPath =+ packageDirMap[dep] || path.join("..", dep.replace("@dub/", ""));+ const depPkgPath = path.resolve(__dirname, depPath, "package.json");++ try {+ const depPkg = JSON.parse(fs.readFileSync(depPkgPath, "utf-8"));+ const version = `^${depPkg.version}`;+ pkg[depType][dep] = version;+ } catch (e) {+ process.exit(1);+ }}}}+// Write the updated package.jsonfs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));++console.log("✅ Dependencies patched for publish.");