From 33de22449d11da56f9c90782f29e5e7c1d0c4ff2 Mon Sep 17 00:00:00 2001 From: Jesse Katsumata Date: Tue, 10 Mar 2020 04:02:32 +0900 Subject: [PATCH] chore(gatsby): migrate spinner to typescript (#22080) --- .../src/reporter/loggers/ink/cli.js | 3 +-- .../loggers/ink/components/spinner.js | 16 --------------- .../loggers/ink/components/spinner.tsx | 20 +++++++++++++++++++ 3 files changed, 21 insertions(+), 18 deletions(-) delete mode 100644 packages/gatsby-cli/src/reporter/loggers/ink/components/spinner.js create mode 100644 packages/gatsby-cli/src/reporter/loggers/ink/components/spinner.tsx diff --git a/packages/gatsby-cli/src/reporter/loggers/ink/cli.js b/packages/gatsby-cli/src/reporter/loggers/ink/cli.js index 39463cc8111d4..27a761f9a4a68 100644 --- a/packages/gatsby-cli/src/reporter/loggers/ink/cli.js +++ b/packages/gatsby-cli/src/reporter/loggers/ink/cli.js @@ -3,9 +3,8 @@ import { Box, Static } from "ink" import isTTY from "../../../util/is-tty" import { trackBuildError } from "gatsby-telemetry" -import Spinner from "../ink/components/spinner" +import { Spinner } from "../ink/components/spinner" import { ProgressBar } from "../ink/components/progress-bar" - import { Message } from "../ink/components/messages" import Error from "./components/error" import Develop from "../ink/components/develop" diff --git a/packages/gatsby-cli/src/reporter/loggers/ink/components/spinner.js b/packages/gatsby-cli/src/reporter/loggers/ink/components/spinner.js deleted file mode 100644 index f429f4a2b327e..0000000000000 --- a/packages/gatsby-cli/src/reporter/loggers/ink/components/spinner.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from "react" -import { Box } from "ink" -import Spinner from "ink-spinner" - -export default function Activity({ text, statusText }) { - let label = text - if (statusText) { - label += ` — ${statusText}` - } - - return ( - - {label} - - ) -} diff --git a/packages/gatsby-cli/src/reporter/loggers/ink/components/spinner.tsx b/packages/gatsby-cli/src/reporter/loggers/ink/components/spinner.tsx new file mode 100644 index 0000000000000..aebe30f001226 --- /dev/null +++ b/packages/gatsby-cli/src/reporter/loggers/ink/components/spinner.tsx @@ -0,0 +1,20 @@ +import React from "react" +import { Box } from "ink" +import InkSpinner from "ink-spinner" + +interface IProps { + text: string + statusText?: string +} +export function Spinner({ text, statusText }: IProps): JSX.Element { + let label = text + if (statusText) { + label += ` — ${statusText}` + } + + return ( + + {label} + + ) +}