Skip to content

Commit

Permalink
Merge pull request #201 from siguici/main
Browse files Browse the repository at this point in the history
🚸 Use `false` as default for overwriting existing directory
  • Loading branch information
siguici authored Dec 30, 2024
2 parents c7f38aa + 27aed1c commit 49ef661
Showing 1 changed file with 28 additions and 31 deletions.
59 changes: 28 additions & 31 deletions libs/create-qwikdev-astro/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class Application extends Program<Definition, Input> {
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
)
Expand All @@ -193,13 +193,16 @@ export class Application extends Program<Definition, Input> {
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;

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 @@ -235,40 +238,34 @@ export class Application extends Program<Definition, Input> {
adapter = definition.adapter;
}

const biome =
!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 =
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 =
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 =
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;

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 49ef661

Please sign in to comment.