Skip to content

Commit dc16c9b

Browse files
authored
Merge branch 'next' into nexxel/add-timestamps-to-example-model
2 parents eef9b75 + cf99211 commit dc16c9b

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

.changeset/four-files-end.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-t3-app": minor
3+
---
4+
5+
consistent cli text color

.changeset/wise-toys-fry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-t3-app": patch
3+
---
4+
5+
fix git spinner

cli/src/helpers/git.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ const isRootGitRepo = (dir: string): boolean => {
2222
};
2323

2424
/** If dir is inside a git worktree, meaning a parent directory has `.git` */
25-
const isInsideGitRepo = (dir: string): boolean => {
25+
const isInsideGitRepo = async (dir: string): Promise<boolean> => {
2626
try {
27-
const stdout = execSync("git rev-parse --is-inside-work-tree", {
27+
// If this command succeeds, we're inside a git repo
28+
await execa("git", ["rev-parse", "--is-inside-work-tree"], {
2829
cwd: dir,
29-
}).toString();
30-
return stdout.trim() === "true";
30+
stdout: "ignore",
31+
});
32+
return true;
3133
} catch (_e) {
34+
// Else, it will throw a git-error and we return false
3235
return false;
3336
}
3437
};
@@ -53,12 +56,12 @@ export const initializeGit = async (projectDir: string) => {
5356
const spinner = ora("Creating a new git repo...\n").start();
5457

5558
const isRoot = isRootGitRepo(projectDir);
56-
const isInside = isInsideGitRepo(projectDir);
59+
const isInside = await isInsideGitRepo(projectDir);
5760
const dirName = path.parse(projectDir).name; // skip full path for logging
5861

5962
if (isInside && isRoot) {
6063
// Dir is a root git repo
61-
spinner.stopAndPersist();
64+
spinner.stop();
6265
const { overwriteGit } = await inquirer.prompt<{
6366
overwriteGit: boolean;
6467
}>({
@@ -77,7 +80,7 @@ export const initializeGit = async (projectDir: string) => {
7780
fs.removeSync(path.join(projectDir, ".git"));
7881
} else if (isInside && !isRoot) {
7982
// Dir is inside a git worktree
80-
spinner.stopAndPersist();
83+
spinner.stop();
8184
const { initializeChildGitRepo } = await inquirer.prompt<{
8285
initializeChildGitRepo: boolean;
8386
}>({

cli/src/helpers/installDependencies.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import chalk from "chalk";
12
import { execa } from "execa";
23
import ora from "ora";
34
import { getUserPkgManager } from "~/utils/getUserPkgManager.js";
@@ -10,5 +11,5 @@ export const installDependencies = async (projectDir: string) => {
1011

1112
await execa(pkgManager, ["install"], { cwd: projectDir });
1213

13-
spinner.succeed("Successfully installed dependencies!\n");
14+
spinner.succeed(chalk.green("Successfully installed dependencies!\n"));
1415
};

cli/src/helpers/scaffoldProject.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,7 @@ export const scaffoldProject = async ({
102102
const scaffoldedName =
103103
projectName === "." ? "App" : chalk.cyan.bold(projectName);
104104

105-
spinner.succeed(`${scaffoldedName} scaffolded successfully!\n`);
105+
spinner.succeed(
106+
`${scaffoldedName} ${chalk.green("scaffolded successfully!")}\n`,
107+
);
106108
};

0 commit comments

Comments
 (0)