From 1115f24801cbf76162abba2806478c65b0ff8b87 Mon Sep 17 00:00:00 2001 From: Nick Boldt Date: Fri, 13 Mar 2026 11:39:08 -0400 Subject: [PATCH] chore(cli): bump package.json to 1.10.1 (#78) * chore: trap for yarn install failure and echo file in /tmp folder to console if it failed; also break on error instead of continuing (RHDHBUGS-2819) Generated-by: Cursor Signed-off-by: Nick Boldt * bump package.json to 1.10.1 Signed-off-by: Nick Boldt --------- Signed-off-by: Nick Boldt rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED --- .changeset/puny-dryers-write.md | 5 +++++ package.json | 2 +- src/commands/export-dynamic-plugin/backend.ts | 18 ++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 .changeset/puny-dryers-write.md diff --git a/.changeset/puny-dryers-write.md b/.changeset/puny-dryers-write.md new file mode 100644 index 0000000..b77c35f --- /dev/null +++ b/.changeset/puny-dryers-write.md @@ -0,0 +1,5 @@ +--- +'@red-hat-developer-hub/cli': patch +--- + +chore: trap for yarn install failure and echo file in /tmp folder to console if it failed; also break on error instead of continuing (RHDHBUGS-2819) diff --git a/package.json b/package.json index 53722a8..b441fb2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@red-hat-developer-hub/cli", "description": "CLI for developing Backstage plugins and apps", - "version": "1.9.1", + "version": "1.9.2", "publishConfig": { "access": "public" }, diff --git a/src/commands/export-dynamic-plugin/backend.ts b/src/commands/export-dynamic-plugin/backend.ts index 5a0e5f0..bf5c477 100644 --- a/src/commands/export-dynamic-plugin/backend.ts +++ b/src/commands/export-dynamic-plugin/backend.ts @@ -25,6 +25,7 @@ import * as semver from 'semver'; import { execSync } from 'child_process'; import { createRequire } from 'node:module'; +import os from 'node:os'; import * as path from 'path'; import { productionPack } from '../../lib/packager/productionPack'; @@ -356,7 +357,7 @@ throw new Error( if (opts.install) { Task.log(`Installing private dependencies of the main package`); - const logFile = 'yarn-install.log'; + const logFile = path.join(os.tmpdir(), 'rhdh-cli.yarn-install.log'); const redirect = `> ${logFile}`; const yarnInstall = yarnVersion.startsWith('1.') ? `${yarn} install --production${ @@ -364,7 +365,20 @@ throw new Error( } ${redirect}` : `${yarn} install${yarnLockExists ? ' --immutable' : ' --no-immutable'} ${redirect}`; - await Task.forCommand(yarnInstall, { cwd: target, optional: false }); + try { + await Task.forCommand(yarnInstall, { cwd: target, optional: false }); + } catch (err) { + if (await fs.pathExists(logFile)) { + const logContents = await fs.readFile(logFile, 'utf8'); + console.error( + chalk.red( + `\n${chalk.bold('yarn install failed. Log output from')} ${chalk.cyan(logFile)}:\n`, + ), + ); + console.error(logContents); + } + throw err; + } await fs.remove(paths.resolveTarget(targetRelativePath, '.yarn')); // Checking if some shared dependencies have been included inside the private dependencies