Fix dev CLI output when not printing update messages
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
---
|
||||
|
||||
Fix dev CLI output when not printing update messages
|
||||
@@ -135,12 +135,13 @@ async function startDev(
|
||||
|
||||
await printStandloneInitialBanner(true);
|
||||
|
||||
let displayedUpdateMessage = false;
|
||||
|
||||
if (!options.skipUpdateCheck) {
|
||||
console.log(); // spacing
|
||||
await updateTriggerPackages(dir, { ...options }, true, true);
|
||||
displayedUpdateMessage = await updateTriggerPackages(dir, { ...options }, true, true);
|
||||
}
|
||||
|
||||
printDevBanner(!options.skipUpdateCheck);
|
||||
printDevBanner(displayedUpdateMessage);
|
||||
|
||||
logger.debug("Starting dev session", { dir, options, authorization });
|
||||
|
||||
|
||||
@@ -50,7 +50,9 @@ export async function updateTriggerPackages(
|
||||
options: UpdateCommandOptions,
|
||||
embedded?: boolean,
|
||||
requireUpdate?: boolean
|
||||
) {
|
||||
): Promise<boolean> {
|
||||
let hasOutput = false;
|
||||
|
||||
if (!embedded) {
|
||||
intro("Updating packages");
|
||||
}
|
||||
@@ -61,7 +63,7 @@ export async function updateTriggerPackages(
|
||||
|
||||
if (!packageJson) {
|
||||
log.error("Failed to load package.json. Try to re-run with `-l debug` to see what's going on.");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
const cliVersion = getVersion();
|
||||
@@ -73,6 +75,8 @@ export async function updateTriggerPackages(
|
||||
`Current: ${cliVersion}\nLatest: ${newCliVersion}`,
|
||||
"Run latest: npx trigger.dev@beta"
|
||||
);
|
||||
|
||||
hasOutput = true;
|
||||
}
|
||||
|
||||
const triggerDependencies = getTriggerDependencies(packageJson);
|
||||
@@ -96,8 +100,9 @@ export async function updateTriggerPackages(
|
||||
if (versionMismatches.length === 0) {
|
||||
if (!embedded) {
|
||||
outro(`Nothing to do${newCliVersion ? " ..but you should really update your CLI!" : ""}`);
|
||||
return hasOutput;
|
||||
}
|
||||
return;
|
||||
return hasOutput;
|
||||
}
|
||||
|
||||
prettyWarning(
|
||||
@@ -149,7 +154,7 @@ export async function updateTriggerPackages(
|
||||
outro("You've been warned!");
|
||||
}
|
||||
|
||||
return;
|
||||
return hasOutput;
|
||||
}
|
||||
|
||||
const installSpinner = spinner();
|
||||
@@ -213,6 +218,8 @@ export async function updateTriggerPackages(
|
||||
`Packages updated${newCliVersion ? " ..but you should really update your CLI too!" : ""}`
|
||||
);
|
||||
}
|
||||
|
||||
return hasOutput;
|
||||
}
|
||||
|
||||
type Dependency = {
|
||||
|
||||
@@ -40,15 +40,17 @@ After installation, run Trigger.dev with \`npx trigger.dev\`.`
|
||||
export async function printStandloneInitialBanner(performUpdateCheck = true) {
|
||||
const cliVersion = getVersion();
|
||||
|
||||
logger.log(`\n${logo()} ${chalkGrey(`(${cliVersion})`)}\n`);
|
||||
|
||||
if (performUpdateCheck) {
|
||||
const maybeNewVersion = await updateCheck();
|
||||
|
||||
// Log a slightly more noticeable message if this is a major bump
|
||||
if (maybeNewVersion !== undefined) {
|
||||
logger.log(`Update available ${chalk.green(maybeNewVersion)}`);
|
||||
logger.log(`\n${logo()} ${chalkGrey(`(${cliVersion} -> ${chalk.green(maybeNewVersion)})`)}`);
|
||||
} else {
|
||||
logger.log(`\n${logo()} ${chalkGrey(`(${cliVersion})`)}`);
|
||||
}
|
||||
} else {
|
||||
logger.log(`\n${logo()} ${chalkGrey(`(${cliVersion})`)}`);
|
||||
}
|
||||
|
||||
logger.log(`${chalkGrey("-".repeat(54))}`);
|
||||
|
||||
Reference in New Issue
Block a user