fix(init): document Vite and ask in init (#3281) (#3286)

Expands #3277

---------

Co-authored-by: fry69 <142489379+fry69@users.noreply.github.com>
This commit is contained in:
Marvin Hagemeister
2025-09-01 07:58:37 +02:00
committed by GitHub
co-authored by fry69
parent e33b447768
commit 33cb164b7d
4 changed files with 100 additions and 8 deletions
Generated
+75 -5
View File
@@ -3,40 +3,57 @@
"specifiers": {
"jsr:@astral/astral@~0.5.3": "0.5.3",
"jsr:@deno-library/progress@^1.5.1": "1.5.1",
"jsr:@deno/cache-dir@0.14": "0.14.0",
"jsr:@deno/doc@0.172": "0.172.0",
"jsr:@deno/esbuild-plugin@^1.2.0": "1.2.0",
"jsr:@deno/graph@0.86": "0.86.9",
"jsr:@deno/graph@~0.82.3": "0.82.3",
"jsr:@deno/loader@~0.3.2": "0.3.5",
"jsr:@deno/loader@~0.3.3": "0.3.5",
"jsr:@marvinh-test/fresh-island@^0.0.2": "0.0.2",
"jsr:@marvinh-test/import-json@^0.0.1": "0.0.1",
"jsr:@std/assert@^1.0.13": "1.0.14",
"jsr:@std/assert@^1.0.14": "1.0.14",
"jsr:@std/async@1": "1.0.14",
"jsr:@std/async@^1.0.13": "1.0.14",
"jsr:@std/bytes@^1.0.2": "1.0.6",
"jsr:@std/bytes@^1.0.6": "1.0.6",
"jsr:@std/cli@^1.0.19": "1.0.21",
"jsr:@std/cli@^1.0.21": "1.0.21",
"jsr:@std/collections@^1.0.11": "1.1.1",
"jsr:@std/collections@^1.1.1": "1.1.2",
"jsr:@std/collections@^1.1.2": "1.1.2",
"jsr:@std/crypto@^1.0.5": "1.0.5",
"jsr:@std/data-structures@^1.0.9": "1.0.9",
"jsr:@std/encoding@1": "1.0.10",
"jsr:@std/encoding@^1.0.10": "1.0.10",
"jsr:@std/expect@^1.0.16": "1.0.17",
"jsr:@std/fmt@1.0.3": "1.0.3",
"jsr:@std/fmt@^1.0.3": "1.0.8",
"jsr:@std/fmt@^1.0.7": "1.0.8",
"jsr:@std/fmt@^1.0.8": "1.0.8",
"jsr:@std/front-matter@^1.0.5": "1.0.9",
"jsr:@std/fs@1": "1.0.19",
"jsr:@std/fs@^1.0.19": "1.0.19",
"jsr:@std/fs@^1.0.6": "1.0.19",
"jsr:@std/html@1": "1.0.4",
"jsr:@std/html@^1.0.4": "1.0.4",
"jsr:@std/http@^1.0.15": "1.0.20",
"jsr:@std/internal@^1.0.10": "1.0.10",
"jsr:@std/internal@^1.0.9": "1.0.10",
"jsr:@std/io@0.225": "0.225.0",
"jsr:@std/io@0.225.0": "0.225.0",
"jsr:@std/json@^1.0.2": "1.0.2",
"jsr:@std/jsonc@1": "1.0.2",
"jsr:@std/media-types@1": "1.1.0",
"jsr:@std/media-types@^1.1.0": "1.1.0",
"jsr:@std/net@^1.0.4": "1.0.4",
"jsr:@std/path@1": "1.1.2",
"jsr:@std/path@^1.0.8": "1.1.2",
"jsr:@std/path@^1.1.1": "1.1.2",
"jsr:@std/semver@1": "1.0.5",
"jsr:@std/streams@1": "1.0.11",
"jsr:@std/streams@^1.0.10": "1.0.11",
"jsr:@std/testing@^1.0.12": "1.0.15",
"jsr:@std/toml@^1.0.3": "1.0.8",
"jsr:@std/uuid@^1.0.7": "1.0.9",
@@ -96,7 +113,24 @@
"integrity": "966611826b8bb27baae73ab1c4fa4317cd4edd2abb99750cd6f8488d22d5b121",
"dependencies": [
"jsr:@std/fmt@1.0.3",
"jsr:@std/io"
"jsr:@std/io@0.225.0"
]
},
"@deno/cache-dir@0.14.0": {
"integrity": "729f0b68e7fc96443c09c2c544b830ca70897bdd5168598446d752f7a4c731ad",
"dependencies": [
"jsr:@deno/graph@0.86",
"jsr:@std/fmt@^1.0.3",
"jsr:@std/fs@^1.0.6",
"jsr:@std/io@0.225",
"jsr:@std/path@^1.0.8"
]
},
"@deno/doc@0.172.0": {
"integrity": "72a68ed533576a06feb930a84784ad9ba6d83ca9d581fc734d498c58e32b7cf5",
"dependencies": [
"jsr:@deno/cache-dir",
"jsr:@deno/graph@~0.82.3"
]
},
"@deno/esbuild-plugin@1.2.0": {
@@ -107,9 +141,22 @@
"npm:esbuild@~0.25.5"
]
},
"@deno/graph@0.82.3": {
"integrity": "5c1fe944368172a9c87588ac81b82eb027ca78002a57521567e6264be322637e"
},
"@deno/graph@0.86.9": {
"integrity": "c4f353a695bcc5246c099602977dabc6534eacea9999a35a8cb24e807192e6a1"
},
"@deno/loader@0.3.5": {
"integrity": "72f6ce9c6e7242c6e070705dbd8a838884dd236d5dd0bd907d08bece92db5722"
},
"@marvinh-test/fresh-island@0.0.2": {
"integrity": "77fc811a677de22d7149e326aa99e03530e4ce06fb8ce3ea296c16729ef65a54",
"dependencies": [
"npm:@preact/signals@2",
"npm:preact@^10.22.0"
]
},
"@marvinh-test/import-json@0.0.1": {
"integrity": "12d3030cfb8406b71ea798249fee12f8617cb1259748092638a05b72a7727fcf"
},
@@ -137,6 +184,12 @@
"@std/collections@1.1.2": {
"integrity": "f1685dd45c3ec27c39d0e8a642ccf810f391ec8a6cb5e7355926e6dacc64c43e"
},
"@std/crypto@1.0.5": {
"integrity": "0dcfbb319fe0bba1bd3af904ceb4f948cde1b92979ec1614528380ed308a3b40"
},
"@std/data-structures@1.0.9": {
"integrity": "033d6e17e64bf1f84a614e647c1b015fa2576ae3312305821e1a4cb20674bb4d"
},
"@std/encoding@1.0.10": {
"integrity": "8783c6384a2d13abd5e9e87a7ae0520a30e9f56aeeaa3bdf910a3eaaf5c811a1"
},
@@ -173,14 +226,25 @@
"@std/http@1.0.20": {
"integrity": "b5cc33fc001bccce65ed4c51815668c9891c69ccd908295997e983d8f56070a1",
"dependencies": [
"jsr:@std/encoding@^1.0.10"
"jsr:@std/cli@^1.0.21",
"jsr:@std/encoding@^1.0.10",
"jsr:@std/fmt@^1.0.8",
"jsr:@std/fs@^1.0.19",
"jsr:@std/html@^1.0.4",
"jsr:@std/media-types@^1.1.0",
"jsr:@std/net",
"jsr:@std/path@^1.1.1",
"jsr:@std/streams@^1.0.10"
]
},
"@std/internal@1.0.10": {
"integrity": "e3be62ce42cab0e177c27698e5d9800122f67b766a0bea6ca4867886cbde8cf7"
},
"@std/io@0.225.0": {
"integrity": "c1db7c5e5a231629b32d64b9a53139445b2ca640d828c26bf23e1c55f8c079b3"
"integrity": "c1db7c5e5a231629b32d64b9a53139445b2ca640d828c26bf23e1c55f8c079b3",
"dependencies": [
"jsr:@std/bytes@^1.0.2"
]
},
"@std/json@1.0.2": {
"integrity": "d9e5497801c15fb679f55a2c01c7794ad7a5dfda4dd1bebab5e409cb5e0d34d4"
@@ -194,6 +258,9 @@
"@std/media-types@1.1.0": {
"integrity": "c9d093f0c05c3512932b330e3cc1fe1d627b301db33a4c2c2185c02471d6eaa4"
},
"@std/net@1.0.4": {
"integrity": "2f403b455ebbccf83d8a027d29c5a9e3a2452fea39bb2da7f2c04af09c8bc852"
},
"@std/path@1.1.0": {
"integrity": "ddc94f8e3c275627281cbc23341df6b8bcc874d70374f75fec2533521e3d6886"
},
@@ -209,13 +276,15 @@
"@std/streams@1.0.11": {
"integrity": "db583d27e28d133f389f1eec318cffdf4998305e5134c1d4b1c56b361cee6018",
"dependencies": [
"jsr:@std/bytes"
"jsr:@std/bytes@^1.0.6"
]
},
"@std/testing@1.0.15": {
"integrity": "a490169f5ccb0f3ae9c94fbc69d2cd43603f2cffb41713a85f99bbb0e3087cbc",
"dependencies": [
"jsr:@std/assert@^1.0.13",
"jsr:@std/async@^1.0.13",
"jsr:@std/data-structures",
"jsr:@std/fs@^1.0.19",
"jsr:@std/internal@^1.0.10",
"jsr:@std/path@^1.1.1"
@@ -230,7 +299,8 @@
"@std/uuid@1.0.9": {
"integrity": "44b627bf2d372fe1bd099e2ad41b2be41a777fc94e62a3151006895a037f1642",
"dependencies": [
"jsr:@std/bytes"
"jsr:@std/bytes@^1.0.6",
"jsr:@std/crypto"
]
},
"@std/yaml@1.0.8": {
+11 -1
View File
@@ -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;
+14
View File
@@ -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");
});
-2
View File
@@ -1,5 +1,3 @@
import denoJson from "../../packages/fresh/deno.json" with { type: "json" };
export { extractYaml as frontMatter } from "@std/front-matter";
import * as Marked from "marked";