Skip to content

Commit

Permalink
Merge pull request #1081 from chromaui/cody/cap-2208-update-cli-to-sh…
Browse files Browse the repository at this point in the history
…ow-more-helpful-error-for-unlinked-projects

Show steps for initializing a new Git repo
  • Loading branch information
codykaup authored Oct 7, 2024
2 parents bd798a1 + 21cb727 commit 1f55db6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion node-src/ui/messages/errors/gitNotInitialized.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('<', '&lt').replaceAll('>', '&gt');
12 changes: 12 additions & 0 deletions node-src/ui/messages/errors/gitNotInitialized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@ 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`
${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 <FILE_PATH(S)>\`
- Commit the file(s) with \`git commit --message="<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')}
`);

0 comments on commit 1f55db6

Please sign in to comment.