From 9b75c4707197e2d50d6ca894ba4b8d9b501e0487 Mon Sep 17 00:00:00 2001 From: Tadeu Tupinamba Date: Fri, 13 Feb 2026 15:46:42 -0300 Subject: [PATCH] fix(react): use pnpm publish for workspace dependency resolution (SD-1908) The react package was using @semantic-release/npm which runs `npm publish` and does not resolve pnpm workspace:* references. This caused version 1.0.0-canary.2 to be published with "superdoc": "workspace:*" as a dependency, breaking npm installs for consumers. Switch to semantic-release-pnpm (for version bumping, npmPublish: false) + a custom publish script that calls `pnpm publish` directly, matching the pattern used by the superdoc package. This avoids the --userconfig incompatibility with pnpm v10 while ensuring workspace:* references are resolved on publish. --- packages/react/.releaserc.cjs | 3 ++- scripts/publish-react.cjs | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 scripts/publish-react.cjs diff --git a/packages/react/.releaserc.cjs b/packages/react/.releaserc.cjs index 77c3b4ffef..75a707bec1 100644 --- a/packages/react/.releaserc.cjs +++ b/packages/react/.releaserc.cjs @@ -11,7 +11,8 @@ const config = { 'semantic-release-commit-filter', '@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator', - ['semantic-release-pnpm', { npmPublish: true }], + ['semantic-release-pnpm', { npmPublish: false }], + '../../scripts/publish-react.cjs', ], }; diff --git a/scripts/publish-react.cjs b/scripts/publish-react.cjs new file mode 100644 index 0000000000..4c8f3cb414 --- /dev/null +++ b/scripts/publish-react.cjs @@ -0,0 +1,20 @@ +#!/usr/bin/env node +const { execFileSync } = require('node:child_process'); +const path = require('node:path'); + +const rootDir = path.resolve(__dirname, '..'); +const reactDir = path.join(rootDir, 'packages', 'react'); + +module.exports = { + publish: async (_pluginConfig, context) => { + const { nextRelease, logger = console } = context; + const distTag = (nextRelease && nextRelease.channel) || 'latest'; + + logger.log(`Publishing @superdoc-dev/react with dist-tag "${distTag}"...`); + execFileSync( + 'pnpm', + ['publish', '--access', 'public', '--tag', distTag, '--no-git-checks'], + { stdio: 'inherit', cwd: reactDir } + ); + }, +};