mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-08 22:03:01 +02:00
chore: minor refactor (#1630)
* feat: minor refactor * Minor fix * Update init.ts
This commit is contained in:
parent
a6736dd8dc
commit
f4effe49fc
1 changed files with 5 additions and 7 deletions
|
@ -23,7 +23,7 @@ function hasYarn(): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isValidGitRepoUrl(gitRepoUrl): 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> {
|
async function updatePkg(pkgPath: string, obj): Promise<void> {
|
||||||
|
@ -162,12 +162,10 @@ export async function init(
|
||||||
console.log();
|
console.log();
|
||||||
|
|
||||||
// Display the most elegant way to cd.
|
// Display the most elegant way to cd.
|
||||||
let cdpath;
|
const cdpath =
|
||||||
if (path.join(process.cwd(), name) === dest) {
|
path.join(process.cwd(), name) === dest
|
||||||
cdpath = name;
|
? name
|
||||||
} else {
|
: path.relative(process.cwd(), name);
|
||||||
cdpath = path.relative(process.cwd(), dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log();
|
console.log();
|
||||||
console.log(`Success! Created ${chalk.cyan(cdpath)}`);
|
console.log(`Success! Created ${chalk.cyan(cdpath)}`);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue