Skip to content

Commit

Permalink
feat: stage the template once created (#1031)
Browse files Browse the repository at this point in the history
* feat: stage the template once created

* chore: add changeset for template staging

* fix: intialize git after all steps
  • Loading branch information
complexengine committed Dec 30, 2022
1 parent f82b08a commit 61ba991
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-scissors-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-t3-app": minor
---

The CLI now stages the files on project initialization.
5 changes: 4 additions & 1 deletion cli/src/helpers/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,11 @@ export const initializeGit = async (projectDir: string) => {
cwd: projectDir,
});
}
await execa("git", ["add", "."], { cwd: projectDir });
spinner.succeed(
`${chalk.green("Successfully initialized")} ${chalk.green.bold("git")}\n`,
`${chalk.green("Successfully initialized and staged")} ${chalk.green.bold(
"git",
)}\n`,
);
} catch (error) {
// Safeguard, should be unreachable
Expand Down
8 changes: 4 additions & 4 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ const main = async () => {
await installDependencies({ projectDir });
}

if (!noGit) {
await initializeGit(projectDir);
}

logNextSteps({ projectName: appDir, packages: usePackages, noInstall });

// Write name to package.json
Expand All @@ -65,6 +61,10 @@ const main = async () => {
spaces: 2,
});

if (!noGit) {
await initializeGit(projectDir);
}

process.exit(0);
};

Expand Down

1 comment on commit 61ba991

@vercel
Copy link

@vercel vercel bot commented on 61ba991 Dec 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.