chore: minor refactor (#1630)

* feat: minor refactor

* Minor fix

* Update init.ts
This commit is contained in:
James George 2019-06-30 11:08:39 +05:30 committed by Yangshun Tay
parent a6736dd8dc
commit f4effe49fc

View file

@ -23,7 +23,7 @@ function hasYarn(): boolean {
}
function isValidGitRepoUrl(gitRepoUrl): boolean {
return gitRepoUrl.startsWith('https://') || gitRepoUrl.startsWith('git@');
return ['https://', 'git@'].some(item => gitRepoUrl.startsWith(item));
}
async function updatePkg(pkgPath: string, obj): Promise<void> {
@ -162,12 +162,10 @@ export async function init(
console.log();
// Display the most elegant way to cd.
let cdpath;
if (path.join(process.cwd(), name) === dest) {
cdpath = name;
} else {
cdpath = path.relative(process.cwd(), dest);
}
const cdpath =
path.join(process.cwd(), name) === dest
? name
: path.relative(process.cwd(), name);
console.log();
console.log(`Success! Created ${chalk.cyan(cdpath)}`);