From b902a0029b4dcb6eb3d73cd40d139f55841d8776 Mon Sep 17 00:00:00 2001 From: Cody Kaup Date: Fri, 4 Oct 2024 15:40:02 -0500 Subject: [PATCH 1/2] Show steps for initializing a new Git repo --- node-src/ui/messages/errors/gitNotInitialized.stories.ts | 3 ++- node-src/ui/messages/errors/gitNotInitialized.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/node-src/ui/messages/errors/gitNotInitialized.stories.ts b/node-src/ui/messages/errors/gitNotInitialized.stories.ts index 6522b8b5a..9f482838b 100644 --- a/node-src/ui/messages/errors/gitNotInitialized.stories.ts +++ b/node-src/ui/messages/errors/gitNotInitialized.stories.ts @@ -4,4 +4,5 @@ export default { title: 'CLI/Messages/Errors', }; -export const GitNotInitialized = () => gitNotInitialized({ command: 'git --version' }); +export const GitNotInitialized = () => + gitNotInitialized({ command: 'git --version' }).replaceAll('<', '<').replaceAll('>', '>'); diff --git a/node-src/ui/messages/errors/gitNotInitialized.ts b/node-src/ui/messages/errors/gitNotInitialized.ts index 27650783d..44d045c26 100644 --- a/node-src/ui/messages/errors/gitNotInitialized.ts +++ b/node-src/ui/messages/errors/gitNotInitialized.ts @@ -7,4 +7,13 @@ export default ({ command }: { command: string }) => dedent(chalk` ${error} {bold Unable to execute command}: ${command} Chromatic only works from inside a Git repository. + + You can initialize a new Git repository with \`git init\`. + + You will also need a single commit in order to run a build. To do that: + + - Add a file (or multiple files) with \`git add \` + - Commit the file(s) with \`git commit --message=""\` + + Once you've done so, please run this build again. `); From 21cb727b02e9e45ce5f003e236816a0f2396908a Mon Sep 17 00:00:00 2001 From: Cody Kaup Date: Mon, 7 Oct 2024 11:37:08 -0500 Subject: [PATCH 2/2] Add link to Pro Git book --- node-src/ui/messages/errors/gitNotInitialized.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/node-src/ui/messages/errors/gitNotInitialized.ts b/node-src/ui/messages/errors/gitNotInitialized.ts index 44d045c26..fec13ad84 100644 --- a/node-src/ui/messages/errors/gitNotInitialized.ts +++ b/node-src/ui/messages/errors/gitNotInitialized.ts @@ -2,6 +2,7 @@ import chalk from 'chalk'; import { dedent } from 'ts-dedent'; import { error } from '../../components/icons'; +import link from '../../components/link'; export default ({ command }: { command: string }) => dedent(chalk` @@ -16,4 +17,6 @@ export default ({ command }: { command: string }) => - Commit the file(s) with \`git commit --message=""\` Once you've done so, please run this build again. + + For more information on Git, feel free to check out the Pro Git book: ${link('https://git-scm.com/book/en/v2')} `);