Skip to content

Commit

Permalink
refactor: compact message for added to .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 22, 2024
1 parent 762f747 commit 67e1828
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/index.ts
Expand Up @@ -26,11 +26,14 @@ async function nitroModule(nitro: Nitro) {
const gitIgnorePath = await findFile(".gitignore", {
startingFrom: nitro.options.rootDir,
}).catch(() => undefined);
let addedToGitIgnore = false;
if (gitIgnorePath) {
const gitIgnore = await fs.readFile(gitIgnorePath, "utf8");
if (!gitIgnore.includes(".wrangler/state/v3")) {
consola.info("Adding `.wrangler/state/v3` to `.gitignore`...");
await fs.writeFile(gitIgnorePath, gitIgnore + "\n.wrangler/state/v3\n");
await fs
.writeFile(gitIgnorePath, gitIgnore + "\n.wrangler/state/v3\n")
.catch(() => {});
addedToGitIgnore = true;
}
}

Expand All @@ -39,7 +42,7 @@ async function nitroModule(nitro: Nitro) {
"🔥 Cloudflare context bindings enabled for dev server",
"",
`Config path: ${configPath ? relative(".", configPath) : colorize("yellow", "cannot find `wrangler.toml`")}`,
`Persist dir: \`${relative(".", persistDir)}\``,
`Persist dir: \`${relative(".", persistDir)}\` ${addedToGitIgnore ? colorize("green", "(added to `.gitignore`)") : ""}`,
].join("\n"),
);

Expand Down

0 comments on commit 67e1828

Please sign in to comment.