From 25aa611fdfd9552566fc02822e268a287177b661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigui=20Kess=C3=A9=20Emmanuel?= Date: Mon, 30 Dec 2024 20:02:54 +0100 Subject: [PATCH] :children_crossing: No longer ask anything if the directory exists and it should not be touched --- libs/create-qwikdev-astro/src/app.ts | 31 +++++++++++++++------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/libs/create-qwikdev-astro/src/app.ts b/libs/create-qwikdev-astro/src/app.ts index 95259f4..458a4bb 100644 --- a/libs/create-qwikdev-astro/src/app.ts +++ b/libs/create-qwikdev-astro/src/app.ts @@ -198,9 +198,11 @@ export class Application extends Program { )) : false; + const ask = !exists || add || force; + let adapter: Adapter; - if ((!add || force) && definition.adapter === defaultDefinition.adapter) { + if (ask && (!add || force) && definition.adapter === defaultDefinition.adapter) { const adapterInput = ((await this.scanBoolean( definition, @@ -237,7 +239,7 @@ export class Application extends Program { } const biome = - !add && definition.biome === undefined + ask && !add && definition.biome === undefined ? !!(await this.scanBoolean( definition, "Would you prefer Biome over ESLint/Prettier?" @@ -245,31 +247,32 @@ export class Application extends Program { : !!definition.biome; const ci = - definition.ci === undefined + ask && definition.ci === undefined ? !!(await this.scanBoolean(definition, "Would you like to add CI workflow?")) - : definition.ci; + : !!definition.ci; const install = - definition.install === undefined + ask && definition.install === undefined ? !!(await this.scanBoolean( definition, `Would you like to install ${this.#packageManger} dependencies?` )) - : definition.install; + : !!definition.install; const git = - definition.git === undefined + ask && definition.git === undefined ? !!(await this.scanBoolean(definition, "Would you like to initialize Git?")) - : definition.git; + : !!definition.git; const dryRun = !!definition.dryRun; - packageName = definition.yes - ? packageName - : await this.scanString( - "What should be the name of this package?", - exists && !force ? (getPackageJson(outDir).name ?? packageName) : packageName - ); + packageName = + !ask || definition.yes + ? packageName + : await this.scanString( + "What should be the name of this package?", + exists && !force ? (getPackageJson(outDir).name ?? packageName) : packageName + ); return { destination,