1- import { join } from 'node:path'
1+ import { join } from 'node:path'
22import * as process from 'node:process'
3- import { Box , Text } from 'ink'
4- import { Script , Spawn } from 'ink-spawn'
5- import React , { useState , type FC } from 'react'
6- import { repoUrl } from './config.js'
7- import { canShowStep } from './utils.js'
3+ import { Box , Text } from 'ink'
4+ import { Script , Spawn } from 'ink-spawn'
5+ import React , { useState , type FC } from 'react'
6+ import { repoUrl } from './config.js'
7+ import { canShowStep } from './utils.js'
88
99interface Props {
1010 projectName : string
@@ -14,19 +14,19 @@ interface Props {
1414/**
1515 * @description Clone the repository
1616 */
17- const CloneRepo : FC < Props > = ( { projectName, onCompletion } ) => {
17+ const CloneRepo : FC < Props > = ( { projectName, onCompletion} ) => {
1818 const projectDir = join ( process . cwd ( ) , projectName )
19- const [ step , setStep ] = useState ( 1 )
19+ const [ currentStep , setCurrentStep ] = useState ( 1 )
2020
21- const finishStep = ( ) => setStep ( step + 1 )
21+ const finishStep = ( ) => setCurrentStep ( currentStep + 1 )
2222
2323 return (
2424 < Box
2525 flexDirection = { 'column' }
2626 gap = { 0 }
2727 >
2828 < Script >
29- { canShowStep ( step , 1 ) && (
29+ { canShowStep ( currentStep , 1 ) && (
3030 < >
3131 < Text color = { 'whiteBright' } > Cloning dAppBooster in </ Text >
3232 < Text italic > { projectName } </ Text >
@@ -44,7 +44,7 @@ const CloneRepo: FC<Props> = ({ projectName, onCompletion }) => {
4444 command = "git"
4545 args = { [ 'clone' , '--depth' , '1' , '--no-checkout' , repoUrl , projectName ] }
4646 />
47- { canShowStep ( step , 2 ) && < Text color = { 'whiteBright' } > Fetching tags</ Text > }
47+ { canShowStep ( currentStep , 2 ) && < Text color = { 'whiteBright' } > Fetching tags</ Text > }
4848 < Spawn
4949 shell
5050 cwd = { projectDir }
@@ -58,7 +58,7 @@ const CloneRepo: FC<Props> = ({ projectName, onCompletion }) => {
5858 finishStep ( )
5959 } }
6060 />
61- { canShowStep ( step , 3 ) && < Text color = { 'whiteBright' } > Checking out latest tag</ Text > }
61+ { canShowStep ( currentStep , 3 ) && < Text color = { 'whiteBright' } > Checking out latest tag</ Text > }
6262 < Spawn
6363 shell
6464 cwd = { projectDir }
@@ -70,7 +70,7 @@ const CloneRepo: FC<Props> = ({ projectName, onCompletion }) => {
7070 finishStep ( )
7171 } }
7272 />
73- { canShowStep ( step , 4 ) && < Text color = { 'whiteBright' } > Removing .git folder</ Text > }
73+ { canShowStep ( currentStep , 4 ) && < Text color = { 'whiteBright' } > Removing .git folder</ Text > }
7474 < Spawn
7575 shell
7676 cwd = { projectDir }
@@ -82,7 +82,7 @@ const CloneRepo: FC<Props> = ({ projectName, onCompletion }) => {
8282 finishStep ( )
8383 } }
8484 />
85- { canShowStep ( step , 5 ) && < Text color = { 'whiteBright' } > Initializing Git repository</ Text > }
85+ { canShowStep ( currentStep , 5 ) && < Text color = { 'whiteBright' } > Initializing Git repository</ Text > }
8686 < Spawn
8787 shell
8888 cwd = { projectDir }
0 commit comments