From 6ae6a9d118da2e8b140999c73aa9752ceebb2795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigui=20Kess=C3=A9=20Emmanuel?= Date: Mon, 30 Dec 2024 19:41:45 +0100 Subject: [PATCH 1/4] :pencil2: Update the directory name example --- libs/create-qwikdev-astro/src/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/create-qwikdev-astro/src/app.ts b/libs/create-qwikdev-astro/src/app.ts index dcf3f86..b2a397e 100644 --- a/libs/create-qwikdev-astro/src/app.ts +++ b/libs/create-qwikdev-astro/src/app.ts @@ -166,7 +166,7 @@ export class Application extends Program { definition.destination === defaultDefinition.destination ? await this.scanString( `Where would you like to create your new project? ${this.gray( - `(Use '.' or './' for current directory)` + `(Use '.' or 'qwik-astro-app' for current directory)` )}`, definition.destination ) From 3140e7211a539ab5e67d9904d782533b3b1059f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigui=20Kess=C3=A9=20Emmanuel?= Date: Mon, 30 Dec 2024 19:45:18 +0100 Subject: [PATCH 2/4] :children_crossing: Use `false` as default for overwriting existing directory --- libs/create-qwikdev-astro/src/app.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/create-qwikdev-astro/src/app.ts b/libs/create-qwikdev-astro/src/app.ts index b2a397e..95259f4 100644 --- a/libs/create-qwikdev-astro/src/app.ts +++ b/libs/create-qwikdev-astro/src/app.ts @@ -193,7 +193,8 @@ export class Application extends Program { definition, `Directory "./${resolveRelativeDir( outDir - )}" already exists and is not empty. What would you like to overwrite it?` + )}" already exists and is not empty. What would you like to overwrite it?`, + false )) : false; 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 3/4] :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, From 27aed1c2c5556d6048b3e2412a1078798bfea93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigui=20Kess=C3=A9=20Emmanuel?= Date: Mon, 30 Dec 2024 20:07:22 +0100 Subject: [PATCH 4/4] :recycle: Improve conditions --- libs/create-qwikdev-astro/src/app.ts | 37 +++++++++++----------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/libs/create-qwikdev-astro/src/app.ts b/libs/create-qwikdev-astro/src/app.ts index 458a4bb..dc85949 100644 --- a/libs/create-qwikdev-astro/src/app.ts +++ b/libs/create-qwikdev-astro/src/app.ts @@ -238,31 +238,24 @@ export class Application extends Program { adapter = definition.adapter; } - const biome = - ask && !add && definition.biome === undefined - ? !!(await this.scanBoolean( - definition, - "Would you prefer Biome over ESLint/Prettier?" - )) - : !!definition.biome; + const biome = !!(ask && !add && definition.biome === undefined + ? await this.scanBoolean(definition, "Would you prefer Biome over ESLint/Prettier?") + : definition.biome); - const ci = - ask && definition.ci === undefined - ? !!(await this.scanBoolean(definition, "Would you like to add CI workflow?")) - : !!definition.ci; + const ci = !!(ask && definition.ci === undefined + ? await this.scanBoolean(definition, "Would you like to add CI workflow?") + : definition.ci); - const install = - ask && definition.install === undefined - ? !!(await this.scanBoolean( - definition, - `Would you like to install ${this.#packageManger} dependencies?` - )) - : !!definition.install; + const install = !!(ask && definition.install === undefined + ? await this.scanBoolean( + definition, + `Would you like to install ${this.#packageManger} dependencies?` + ) + : definition.install); - const git = - ask && definition.git === undefined - ? !!(await this.scanBoolean(definition, "Would you like to initialize Git?")) - : !!definition.git; + const git = !!(ask && definition.git === undefined + ? await this.scanBoolean(definition, "Would you like to initialize Git?") + : definition.git); const dryRun = !!definition.dryRun;