-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enabling create app in current directory #200
Conversation
src/commands/create.js
Outdated
type: 'confirm', | ||
name: 'enableForce', | ||
message: `You are using '--force'. Do you wish to continue?`, | ||
default: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default should be false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, will change it once I reach home.
Sent from my OnePlus ONEPLUS A3003 using FastHub
src/commands/create.js
Outdated
if (exists && !argv.force) { | ||
throw Error('Directory already exists.'); | ||
throw Error('Cannot intialize in the current directory, please specify a different destination.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we write messages using chalk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sure, not a problem at all. Red color?
Sent from my OnePlus ONEPLUS A3003 using FastHub
src/commands/create.js
Outdated
throw Error('Directory already exists.'); | ||
if (exists && argv.force) { | ||
const question = { | ||
type: 'confirm', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace <3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
src/commands/create.js
Outdated
if (forceInit.enableForce) { | ||
process.stdout.write('Initializing project in the current directory...\n'); | ||
} else { | ||
process.stdout.write(`${chalk.red('Error:')} Cannot initialize in the current directory`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be process.stderr.write
. BTW why not color whole message to red?
src/commands/create.js
Outdated
} | ||
|
||
if (exists && !argv.force) { | ||
process.stdout.write(`${chalk.red('Error:')} Cannot initialize in the current directory, please specify a different destination`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be process.stderr.write
src/commands/create.js
Outdated
default: false, | ||
}; | ||
|
||
let forceInit = await inquirer.prompt(question); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let the tests run !! :P Merging this one 😄 |
Fixes #110
by specifying --force this will allow you to create project in current directory.
@developit just curious, the discussion emphasize upon the usage of
--force
?What if we do it without this? Whats the harm with that?