Fix npm publish (#10545)

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artyom Savchenko
2026-02-24 23:50:05 +05:00
committed by GitHub
parent 103a81fa39
commit 2dd45f56a0
2 changed files with 21 additions and 3 deletions
+18 -2
View File
@@ -43,8 +43,24 @@ function checkPackageExists(packageName, version) {
*/
function getPublishablePackages(includePattern) {
try {
const output = execSync('rush list -p --json', { encoding: 'utf-8' })
const config = JSON.parse(output)
const repoRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim()
const output = execSync('node common/scripts/install-run-rush.js list -p --json', {
encoding: 'utf-8',
cwd: repoRoot
})
const lines = output.split('\n')
let jsonStart = -1
for (let i = 0; i < lines.length; i++) {
if (lines[i].trim().startsWith('{')) {
jsonStart = i
break
}
}
if (jsonStart === -1) {
console.error('Could not find JSON output from rush list')
return []
}
const config = JSON.parse(lines.slice(jsonStart).join('\n'))
return config.projects.filter((project) => {
// Check if package should be published according to rush.json