Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(start-slicemachine): Remove logged in info when starting Slice Machine #1185

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions packages/start-slicemachine/src/StartSliceMachineProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,25 +109,10 @@ export class StartSliceMachineProcess {
`Running at ${chalk.magenta(url)}`,
),
);
console.log(await this._buildLoggedInAsLine(chalk.dim("Loading...")));
console.log();

const profile = await this._fetchProfile();

// Non-TTY environments (like GitHub Actions) do not support line management.
process.stdout.moveCursor?.(0, -2);
process.stdout.clearLine?.(1);
console.log(
await this._buildLoggedInAsLine(
profile
? `${[profile.firstName, profile.lastName]
.filter(Boolean)
.join(" ")} ${chalk.dim(`(${profile.email})`)}`
: chalk.dim("Not logged in"),
),
);
console.log();

if (profile) {
this._sliceMachineManager.telemetry.identify({
userID: profile.shortId,
Expand Down Expand Up @@ -176,23 +161,6 @@ export class StartSliceMachineProcess {
)} ${chalk.dim("→")} ${value}`;
}

/**
* Returns a string with logged in Prismic user info formatted for the
* console.
*
* @param value - User info to display.
*
* @returns String to pass to the console.
*/
private async _buildLoggedInAsLine(value: string): Promise<string> {
const currentVersion =
await this._sliceMachineManager.versions.getRunningSliceMachineVersion();

return `${chalk.bgBlack(
` ${" ".repeat(currentVersion.length)}${chalk.bold("Logged in as")} `,
)} ${chalk.dim("→")} ${value}`;
}

/**
* Validates the project's config and content models.
*
Expand Down