Skip to content

Commit

Permalink
🚸 No longer ask anything if the directory exists and it should not be…
Browse files Browse the repository at this point in the history
… touched
  • Loading branch information
siguici committed Dec 30, 2024
1 parent 3140e72 commit 25aa611
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions libs/create-qwikdev-astro/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,11 @@ export class Application extends Program<Definition, Input> {
))
: 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,
Expand Down Expand Up @@ -237,39 +239,40 @@ export class Application extends Program<Definition, Input> {
}

const biome =
!add && definition.biome === undefined
ask && !add && definition.biome === undefined
? !!(await this.scanBoolean(
definition,
"Would you prefer Biome over ESLint/Prettier?"
))
: !!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,
Expand Down

0 comments on commit 25aa611

Please sign in to comment.