Expands #3277 --------- Co-authored-by: fry69 <142489379+fry69@users.noreply.github.com>
This commit is contained in:
co-authored by
fry69
parent
e33b447768
commit
33cb164b7d
@@ -58,6 +58,9 @@ export const CONFIRM_TAILWIND_MESSAGE = `Set up ${
|
||||
colors.cyan("Tailwind CSS")
|
||||
} for styling?`;
|
||||
export const CONFIRM_VSCODE_MESSAGE = `Do you use ${colors.cyan("VS Code")}?`;
|
||||
export const CONFIRM_VITE_MESSAGE = `Set up ${
|
||||
colors.cyan("Vite")
|
||||
} for build tooling?`;
|
||||
|
||||
export async function initProject(
|
||||
cwd = Deno.cwd(),
|
||||
@@ -110,7 +113,14 @@ export async function initProject(
|
||||
}
|
||||
}
|
||||
|
||||
const useVite = flags.vite ?? false;
|
||||
let useVite = flags.vite || false;
|
||||
if (flags.vite == null) {
|
||||
if (
|
||||
confirm(CONFIRM_VITE_MESSAGE)
|
||||
) {
|
||||
useVite = true;
|
||||
}
|
||||
}
|
||||
|
||||
const useDocker = flags.docker;
|
||||
let useTailwind = flags.tailwind || false;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { expect } from "@std/expect";
|
||||
import {
|
||||
CONFIRM_TAILWIND_MESSAGE,
|
||||
CONFIRM_VITE_MESSAGE,
|
||||
CONFIRM_VSCODE_MESSAGE,
|
||||
initProject,
|
||||
} from "./init.ts";
|
||||
@@ -322,3 +323,16 @@ Deno.test.ignore("init - vite build", async () => {
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("init - with vite", async () => {
|
||||
await using tmp = await withTmpDir();
|
||||
const dir = tmp.dir;
|
||||
using _promptStub = stubPrompt(".");
|
||||
using _confirmStub = stubConfirm({
|
||||
[CONFIRM_VITE_MESSAGE]: true,
|
||||
});
|
||||
await initProject(dir, [], {});
|
||||
|
||||
await expectProjectFile(dir, "vite.config.ts");
|
||||
await expectNotProjectFile(dir, "dev.ts");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user