generated from nhcarrigan/template
feat: more debugging
This commit is contained in:
+45
-17
@@ -95,6 +95,50 @@ const getCurrentVersionOnBranch = async(
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Runs pnpm install in the specified directory.
|
||||
* @param logger - The logger instance.
|
||||
* @param repoPath - The repository path.
|
||||
*/
|
||||
const runPnpmInstall = async(
|
||||
logger: Logger,
|
||||
repoPath: string,
|
||||
): Promise<void> => {
|
||||
const pnpmPath = "/home/naomi/.local/share/pnpm/pnpm";
|
||||
/* eslint-disable capitalized-comments -- v8 coverage requires lowercase */
|
||||
/* v8 ignore start -- @preserve */
|
||||
/* eslint-enable capitalized-comments -- Re-enable rule */
|
||||
const pnpmEnvironment = {
|
||||
...process.env,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Environment variables use SCREAMING_SNAKE_CASE
|
||||
HOME: "/home/naomi",
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- Environment variables use SCREAMING_SNAKE_CASE
|
||||
PATH: `${process.env.PATH ?? ""}:/home/naomi/.local/share/pnpm`,
|
||||
};
|
||||
/* eslint-disable capitalized-comments -- v8 coverage requires lowercase */
|
||||
/* v8 ignore stop -- @preserve */
|
||||
/* eslint-enable capitalized-comments -- Re-enable rule */
|
||||
try {
|
||||
await execAsync(`${pnpmPath} install --no-frozen-lockfile`, {
|
||||
cwd: repoPath,
|
||||
env: pnpmEnvironment,
|
||||
});
|
||||
} catch (pnpmError: unknown) {
|
||||
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Catch blocks receive unknown, cast needed to access stderr/stdout */
|
||||
const details = pnpmError as Error & { stderr?: string; stdout?: string };
|
||||
|
||||
/* eslint-disable capitalized-comments -- v8 coverage requires lowercase */
|
||||
/* v8 ignore next 5 -- @preserve */
|
||||
/* eslint-enable capitalized-comments -- Re-enable rule */
|
||||
/* eslint-disable @typescript-eslint/strict-boolean-expressions, @typescript-eslint/prefer-nullish-coalescing -- Intentionally using || to treat empty strings as falsy */
|
||||
const errorMessage = details.stderr || details.stdout || details.message;
|
||||
/* eslint-enable @typescript-eslint/strict-boolean-expressions, @typescript-eslint/prefer-nullish-coalescing -- Re-enable rules */
|
||||
|
||||
void logger.log("info", `pnpm install failed: ${errorMessage}`);
|
||||
throw pnpmError;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates package.json and creates a commit.
|
||||
* @param options - Configuration for which package to update and where.
|
||||
@@ -119,23 +163,7 @@ const updatePackageAndCommit = async(
|
||||
await writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
|
||||
|
||||
void logger.log("info", `Running pnpm install for ${packageName}...`);
|
||||
const pnpmPath = "/home/naomi/.local/share/pnpm/pnpm";
|
||||
try {
|
||||
await execAsync(`${pnpmPath} install --no-frozen-lockfile`, { cwd: repoPath });
|
||||
} catch (pnpmError: unknown) {
|
||||
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Catch blocks receive unknown, cast needed to access stderr/stdout */
|
||||
const details = pnpmError as Error & { stderr?: string; stdout?: string };
|
||||
|
||||
/* eslint-disable capitalized-comments -- v8 coverage requires lowercase */
|
||||
/* v8 ignore next 5 -- @preserve */
|
||||
/* eslint-enable capitalized-comments -- Re-enable rule */
|
||||
/* eslint-disable @typescript-eslint/strict-boolean-expressions, @typescript-eslint/prefer-nullish-coalescing -- Intentionally using || to treat empty strings as falsy */
|
||||
const errorMessage = details.stderr || details.stdout || details.message;
|
||||
/* eslint-enable @typescript-eslint/strict-boolean-expressions, @typescript-eslint/prefer-nullish-coalescing -- Re-enable rules */
|
||||
|
||||
void logger.log("info", `pnpm install failed: ${errorMessage}`);
|
||||
throw pnpmError;
|
||||
}
|
||||
await runPnpmInstall(logger, repoPath);
|
||||
|
||||
await runGitCommand(logger, repoPath, "git add package.json pnpm-lock.yaml");
|
||||
const commitMessage = `deps: update ${packageName} to ${targetVersion}`;
|
||||
|
||||
Reference in New Issue
Block a user