Skip to content

Commit

Permalink
cli: skip prettier formatting if install dependency is skipped (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 committed Mar 23, 2024
1 parent 75267de commit 988434e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export async function createProject(options: Options) {
{
title: "🪄 Formatting files with prettier",
task: () => prettierFormat(targetDirectory),
skip: () => {
if (!options.install) {
return "Skipping because prettier install was skipped";
}
},
},
{
title: `📡 Initializing Git repository ${
Expand Down
1 change: 1 addition & 0 deletions src/tasks/prettier-format.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { execa } from "execa";

// TODO: Instead of using execa, use prettier package from cli to format targetDir
export async function prettierFormat(targetDir: string) {
try {
const result = await execa("yarn", ["format"], { cwd: targetDir });
Expand Down

0 comments on commit 988434e

Please sign in to comment.